aMule Forum

English => en_Linux => Topic started by: fidoboy on July 29, 2009, 03:42:39 AM

Title: aMule web fails loading sometimes...
Post by: fidoboy on July 29, 2009, 03:42:39 AM
Hello, i'm using the emule-daemon and i'm accesing to the machine from outside using the web server (ip address:4711) but the problem is that when loading the web page almost everytime it keeps loading forever, some other times it loads and it shows all the contents but the spinning animation keeps moving and it seems like there is still something remaining to load in the page. Also, some pages does not completely load and i must retry until it's shown...

it's a bug? i'm doing something wrong?

thanks in advance, regards.
Title: Re: aMule web fails loading sometines...
Post by: ^marcell^ on July 29, 2009, 12:24:49 PM
Have you tried accessing it from the same computer?
Does the same thing occur if you do so?
Title: Re: aMule web fails loading sometines...
Post by: fidoboy on July 29, 2009, 12:38:11 PM
I can't make that test because that computer does not have a desktop to use the graphical interface, but i've done the tests from two different computers (Mac OSX and Windows Vista) and also using different internet browsers (Firefox 3.5, Safari 4 and Chrome)

regards,
Title: Re: aMule web fails loading sometines...
Post by: ^marcell^ on July 29, 2009, 01:20:32 PM
Establish a telnet to the server (on port: 4711) and enter the following things:
Code: [Select]
GET  /index.php HTTP/1.0
Accept: text/html

And press [Enter] twice.
Not sure whether the default page is "index.php" though.
Title: Re: aMule web fails loading sometines...
Post by: fidoboy on July 29, 2009, 05:48:16 PM
I must say that this happens using tchoum skin for webserver. I've tried using telnet, but i can't connect. In windows vista, there is no telnet command and using OSX it tries to connect to my external IP when i use telnet 192.168.1.3:4711

any ideas?

regards,
Title: Re: aMule web fails loading sometines...
Post by: Stu Redman on July 29, 2009, 10:46:08 PM
In windows vista, there is no telnet command
Yes, there is. Just ran it.
Title: Re: aMule web fails loading sometimes...
Post by: fidoboy on July 29, 2009, 11:34:56 PM
Ok, i've ran it and there is no response, all i get is a black screen.  :-\
Title: Re: aMule web fails loading sometines...
Post by: fidoboy on August 01, 2009, 03:50:36 AM
Establish a telnet to the server (on port: 4711) and enter the following things:
Code: [Select]
GET  /index.php HTTP/1.0
Accept: text/html

And press [Enter] twice.
Not sure whether the default page is "index.php" though.

OK, finally i got it working. Here it's the output of that commands:

HTTP/1.1 200 OK
Server: aMule
Pragma: no-cache
Expires: 0
Cache-Control: no-cache, no-store, must-revalidate
Set-Cookie: amuleweb_session_id=1681692777
Connection: close
Content-Type: text/html
Content-Length: 868
Content-Encoding: gzip

and after that i got a lot of garbage...

i hope that it helps...

Title: Re: aMule web fails loading sometimes...
Post by: wuischke on August 01, 2009, 08:09:41 AM
The garbage is gzip compressed text.

To be honest, I'm a bit worried that amuleweb a) uses HTTP 1.1 in a response to an HTTP 1.0 request and b) uses gzip even though the client didn't say that it supports gzip.
Title: Re: aMule web fails loading sometimes...
Post by: GonoszTopi on August 01, 2009, 09:22:51 AM
amuleweb does a lot of things it shouldn't. This is going to change soon. Probably on Monday.
Title: Re: aMule web fails loading sometimes...
Post by: lfroen on August 01, 2009, 10:53:55 AM
Quote
amuleweb does a lot of things it shouldn't
I really like to hear the list, 'cause amuleweb doesn't do a lot of things

Quote
This is going to change soon.
Discussing changes before is simpler that code-and-fix later. IMHO.

Quote
a) uses HTTP 1.1 in a response to an HTTP 1.0 request and b) uses gzip even though the client didn't say that it supports gzip.
Do you know at least 1 modern browser (no, Lynx doesn't count) that a) only support http 1.0 b) doesn't support gzip.
Truth to be told - I have no idea how 1.1 is different from 1.0 and whether amuleweb uses those features at all. Same for gzip. I don't remember single person complained that his/her browser can't display amuleweb output (that would be symptom for lack of gzip support).
Given that - both your "a)" and "b)" are useless discussion. Don't fix what isn't broken, please. There are broken things in amule. They are not here.
Title: Re: aMule web fails loading sometimes...
Post by: fidoboy on August 01, 2009, 12:00:56 PM
"There are broken things in amule. They are not here."

Yes, i also think that this problem is not related with gzip or the protocol version. But i'm sure that there is a problem. I've tried opening the web in many different browsers and also different machines and it happens the same. The page uses frames and many times some of them are not loaded, or when the autorefresh is launched, some frames contents disappears...

regards,
Title: Re: aMule web fails loading sometimes...
Post by: lfroen on August 01, 2009, 01:05:09 PM
"here" means very specific code.
amuleweb is not very big application. There's 4 parts in it:
1. socket code handling in/out http
2. php interpreter
3. connection to amule code
4. web page itself.

Problem you describe may have source either in (1) or in (4). Or in both. If you're willing to debug - use wireshark (or other sniffer of choice) and dump traffic to/from amuleweb.
Title: Re: aMule web fails loading sometimes...
Post by: fidoboy on August 01, 2009, 01:31:14 PM
I'm sorry but debugging it is beyond my intentions now (i've limited time for this) I just want to help reporting the bug and doing tests to find the problem source. I've never used wireshark so i could need a lot of time to mastering it...

regards... ;)
Title: Re: aMule web fails loading sometimes...
Post by: Stu Redman on August 01, 2009, 02:52:46 PM
Probably on Monday.
Hehe, our new running gag.  ;D
(I doubt "running gag" is actually English  now that I see it... It means perpetual joke.)

I really like to hear the list, 'cause amuleweb doesn't do a lot of things
- is a bitch to set up (you need two directories "default" and "php-default" with identical content, you have to enter settings in the remote.conf by hand). Of course, as a dev you have it set up and never notice.
- on Linux it always crashes for me (with LibPNG, having about 100 downloads). That was one reason I ported it to Windows, so I can start debugging it.
- there are some doubtful pieces of code in it, like CImageLib::AddImage, RemoveImage, GetImage
Quote
There are broken things in amule.
Just name them. (I don't doubt it, but that's not helpful.)

uses gzip even though the client didn't say that it supports gzip.
@fidoboy: You can always turn gzip compression off in the config for such cases.
Title: Re: aMule web fails loading sometimes...
Post by: fidoboy on August 01, 2009, 07:00:38 PM
Probably on Monday.
Hehe, our new running gag.  ;D
(I doubt "running gag" is actually English  now that I see it... It means perpetual joke.)

I really like to hear the list, 'cause amuleweb doesn't do a lot of things
- is a bitch to set up (you need two directories "default" and "php-default" with identical content, you have to enter settings in the remote.conf by hand). Of course, as a dev you have it set up and never notice.
- on Linux it always crashes for me (with LibPNG, having about 100 downloads). That was one reason I ported it to Windows, so I can start debugging it.
- there are some doubtful pieces of code in it, like CImageLib::AddImage, RemoveImage, GetImage
Quote
There are broken things in amule.
Just name them. (I don't doubt it, but that's not helpful.)

uses gzip even though the client didn't say that it supports gzip.
@fidoboy: You can always turn gzip compression off in the config for such cases.

Ok, i'll do my test turning gzip off and i'll report my results here... but i think that it has something to do with the use of frames...

regards,
Title: Re: aMule web fails loading sometimes...
Post by: lfroen on August 01, 2009, 08:29:51 PM
Some notes for Stu:
Quote
is a bitch to set up
If default (should be set by package manager) doesn't work for you - too bad. That's called "advanced usage" and require some knowledge of shell.


Quote
on Linux it always crashes for me (with LibPNG, having about 100 downloads)
As you may guess, number "100" is not written anywhere in code.
Quote
That was one reason I ported it to Windows, so I can start debugging it.
Wrong idea. If it's crashed on Linux - you should be debugging it ... well ... on Linux. Maybe the problem is your specific Linux/libpng/libc etc.

Quote
doubtful pieces of code in it, like CImageLib::AddImage, RemoveImage, GetImage
That's mind-blowing statement. What's so "doubtful" about it?! One can easy guess, what AddImage() does. Hint: it have something to do with "adding image".

Quote
Just name them.
Offtopic. Point was, that if you looking to things to fix - amuleweb is not best place to start.

Title: Re: aMule web fails loading sometimes...
Post by: Stu Redman on August 01, 2009, 10:11:30 PM
That's called "advanced usage" and require some knowledge of shell.
Yeah, I deserved that.  :)

Quote
Quote
on Linux it always crashes for me (with LibPNG, having about 100 downloads)
As you may guess, number "100" is not written anywhere in code.
You know the meaning of "about" ?

Quote
Wrong idea. If it's crashed on Linux - you should be debugging it ... well ... on Linux. Maybe the problem is your specific Linux/libpng/libc etc.
We'll see that. I don't think the code is that platform dependent.

Quote
Quote
doubtful pieces of code in it, like CImageLib::AddImage, RemoveImage, GetImage
That's mind-blowing statement. What's so "doubtful" about it?! One can easy guess, what AddImage() does. Hint: it have something to do with "adding image".
Not the purpose is doubtful, just the implementation.
Code: [Select]
void CImageLib::AddImage(CAnyImage *img, const wxString &name)
{
CAnyImage *prev = m_image_map[name];
if ( prev ) {
delete prev;
}
m_image_map[name] = img;
}
Looks like someone should look up how std::map works (http://www.cplusplus.com/reference/stl/map/operator%5B%5D/).  :P

Quote
Offtopic.
So start a new thread. But don't call our project "broken" and then evade details.
Title: Re: aMule web fails loading sometimes...
Post by: fidoboy on August 01, 2009, 10:37:48 PM
Hey guys, c'mon, i've started this thread to talk about a problem/bug that i'm having with the amule webserver, it's not my intention to discuss about the quality of amule's code...

regards,  ;)
Title: Re: aMule web fails loading sometimes...
Post by: lfroen on August 01, 2009, 10:58:17 PM
Not the purpose is doubtful, just the implementation.
Code: [Select]
void CImageLib::AddImage(CAnyImage *img, const wxString &name)
{
CAnyImage *prev = m_image_map[name];
if ( prev ) {
delete prev;
}
m_image_map[name] = img;
}
Looks like someone should look up how std::map works (http://www.cplusplus.com/reference/stl/map/operator%5B%5D/).  :P
Looks perfectly OK to me. std::map doesn't call delete on contained objects by itself, because it doesn't maintain reference count.
Someone should learn how std::* works before talking nonsense.
Title: Re: aMule web fails loading sometimes...
Post by: Stu Redman on August 01, 2009, 11:10:51 PM
This is not an ordinary forum. We like to talk straight and direct. And we occasionally disagree. (Some of us often.) Even bad language (http://forum.amule.org/index.php?topic=16845.msg89662#msg89662) has been sighted here. No need to be concerned.  ;)

And its perfectly okay if a newbie moderates two moderators.  :D

Looks perfectly OK to me.
If m_image_map has no member with a key of name then m_image_map[name] creates one. The value is a pointer. Pointers have no ctor, so the pointer is random. If random is not zero, random is deleted.
If you're lucky, your runtime lib zeros allocated memory for new objects. Then it would work accidentally.
Title: Re: aMule web fails loading sometimes...
Post by: Stu Redman on August 02, 2009, 12:48:02 AM
Quote
Wrong idea. If it's crashed on Linux - you should be debugging it ... well ... on Linux. Maybe the problem is your specific Linux/libpng/libc etc.
We'll see that. I don't think the code is that platform dependent.
Debugged it on Windows and fixed it. Problem was a tiny download. There is special code for these which was broken.
(It wasn't built with libpng on Linux after all.)
Title: Re: aMule web fails loading sometimes...
Post by: lfroen on August 02, 2009, 06:52:35 PM
Quote
If m_image_map has no member with a key of name then m_image_map[name] creates one. The value is a pointer. Pointers have no ctor, so the pointer is random.
Wrong. When value doesn't exists in map, default, not random value is inserted. http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01322.html (http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01322.html)

In case of pointer (or other built-in integral type) this value is 0.
Title: Re: aMule web fails loading sometimes...
Post by: Stu Redman on August 02, 2009, 10:17:32 PM
As I said, you got lucky. But you should be able to tell if code is working without reviewing the library. And what about other platforms than gcc ?
Fixed in 9744.
Title: Re: aMule web fails loading sometimes...
Post by: GonoszTopi on August 02, 2009, 11:12:55 PM
you should be able to tell if code is working without reviewing the library. And what about other platforms than gcc ?

The C++ standard requires this behaviour.
Title: Re: aMule web fails loading sometimes...
Post by: fidoboy on August 03, 2009, 01:07:36 AM
This is amazing, i've came here looking for an answer to my problem and now i'm in the middle of... nowhere! Well, i hope that you can solve that bug soon... amule webserver is really useful.

keep up the good work!  ;)
Title: Re: aMule web fails loading sometimes...
Post by: lfroen on August 03, 2009, 06:00:40 AM
As I said, you got lucky. But you should be able to tell if code is working without reviewing the library.
As you already saw, I am able to tell. You can't. Like I said before - that's bloody c++ standard, which have nothing to do with gcc/platform or whatever else. So, please leave it as is.

Any other "questionable" code you see?
Title: Re: aMule web fails loading sometimes...
Post by: Stu Redman on August 03, 2009, 10:46:23 PM
So, please leave it as is.
Too late.

Quote
Any other "questionable" code you see?
How about
Code: [Select]
void CImageLib::RemoveImage(const wxString &name)
{
CAnyImage *prev = m_image_map[name];
if ( prev ) {
m_image_map.erase(name);
}
}
If the key is in the map it removes the map entry, but does not delete the data pointed to.
If the key is not in the map it leaves a new entry with a Null pointer.
(fixed)
And then there is the code that still causes it to crash. Haven't tracked it down yet, must first enable libPNG for win.

This is amazing, i've came here looking for an answer to my problem and now i'm in the middle of... nowhere!
Sorry. We usually don't misbehave in users' threads.
About your initial problem: I've noticed it too, yeah. But I've not got so far as to start analyzing it. Is your webserver linked with libPNG ? I think it might be related (occurring in builds without libPNG). Lfroen could probably fix it in a minute if he bothered to climb down from his higher spheres.  :)
Title: Re: aMule web fails loading sometimes...
Post by: lfroen on August 04, 2009, 07:28:13 PM
Quote
Lfroen could probably fix it in a minute if he bothered to climb down from his higher spheres
Here, on Earth those "spheres" called "growing family". Dictionary is your friend at this point.

Quote
If the key is in the map it removes the map entry, but does not delete the data pointed to.
If the key is not in the map it leaves a new entry with a Null pointer.
Technically speaking, you're correct. Second case should not happen, however - how do you remove image that you didn't inserted earlier?
The only reason why image is being removed is file removal from download queue. And since you can't remove something which is not there, it should not happen.
If it indeed happen - there's another problem elsewhere.