aMule Forum

English => en_Bugs => Topic started by: KyroMaster on October 11, 2005, 07:41:02 AM

Title: Can´t start aMule with proxy
Post by: KyroMaster on October 11, 2005, 07:41:02 AM
If I´ve a HTTP proxy enabled, when I start aMule it checks my shared dirs and then I got:

Http-CONNECT(0001): 0 -> 1
process_end - ok=false, 0 bytes

Http-CONNECT(0001): 0 -> 1
process_end - ok=false, 0 bytes

and aMule freezes. When I press CTRL-X I get

Shutdown requested, terminating in next event loop.

but nothing happens. I´ve to press it again to make aMule close. If I don´t use the proxy it works correctly.
Title: Re: Can´t start aMule with proxy
Post by: KyroMaster on October 22, 2005, 07:54:57 PM
Should I give more information about this or does just nobody use a http proxy?
Title: Re: Can´t start aMule with proxy
Post by: phoenix on October 23, 2005, 02:01:34 PM
KyroMaster,

It works for me. Probably you are using a proxy with no support for the CONNECT method. Try to google for "free proxy list connect" and use one of the proxies you will certainly find.

I have attached my output, IP numbers removed.

Cheers!
Code: [Select]
Http-CONNECT(0001): 0 -> 0
process_start - ok=true, 0 bytes

Http-CONNECT(0002): 0 -> 2
process_send_command_request - ok=true, 69 bytes
00000000  43 4f 4e 4e 45 43 54 20  3X 3X 3X 2e 3X 3X 3X 2e  |CONNECT XXX.XXX.|
00000010  3X 3X 3X 2e 3X 3X 3X 3a  34 36 36 31 20 48 54 54  |XXX.XXX:4661 HTT|
00000020  50 2f 31 2e 31 0d 0a 48  6f 73 74 3a 20 31 39 35  |P/1.1  Host: XXX|
00000030  2e 3X 3X 3X 2e 3X 3X 3X  2e 3X 3X 3X 3a 34 36 36  |.XXX.XXX.XXX:466|
00000040  31 0d 0a 0d 0a                                    |1               |

Http-CONNECT(0001): 0 -> 0
process_start - ok=true, 0 bytes

Http-CONNECT(0002): 0 -> 2
process_send_command_request - ok=true, 65 bytes
00000000  43 4f 4e 4e 45 43 54 20  3X 3X 2e 3X 3X 3X 2e 3X  |CONNECT XX.XXX.X|
00000010  3X 3X 2e 3X 3X 3X 34 33  32 31 20 48 54 54 50 2f  |XX.XX:4321 HTTP/|
00000020  31 2e 31 0d 0a 48 6f 73  74 3a 20 3X 3X 2e 3X 3X  |1.1  Host: XX.XX|
00000030  3X 2e 3X 3X 3X 2e 3X 3X  3a 34 33 32 31 0d 0a 0d  |X.XXX.XX:4321   |
00000040  0a                                                |                |

Http-CONNECT(0003): 2 -> 3
process_receive_command_reply - ok=true, 0 bytes

Http-CONNECT(0004): 3 -> 4
process_process_command_reply - ok=true, 39 bytes
00000000  48 54 54 50 2f 31 2e 30  20 32 30 30 20 43 6f 6e  |HTTP/1.0 200 Con|
00000010  6e 65 63 74 69 6f 6e 20  65 73 74 61 62 6c 69 73  |nection establis|
00000020  68 65 64 0d 0a 0d 0a                              |hed             |

Http-CONNECT(0005): 4 -> 1
process_end - ok=true, 0 bytes

Http-CONNECT(0003): 2 -> 3
process_receive_command_reply - ok=true, 0 bytes

Http-CONNECT(0004): 3 -> 4
process_process_command_reply - ok=true, 39 bytes
00000000  48 54 54 50 2f 31 2e 30  20 32 30 30 20 43 6f 6e  |HTTP/1.0 200 Con|
00000010  6e 65 63 74 69 6f 6e 20  65 73 74 61 62 6c 69 73  |nection establis|
00000020  68 65 64 0d 0a 0d 0a                              |hed             |

Http-CONNECT(0005): 4 -> 1
process_end - ok=true, 0 bytes
Title: Re: Can´t start aMule with proxy
Post by: KyroMaster on October 23, 2005, 05:36:37 PM
OK you´re right.
I thought a regular HTTP proxy is enough. Can aMule work also with "regular" HTTP proxies (almost none of them implement the CONNECT option)?
And in general it would be better if aMule wouldn´t hang but issue an error in the log if the proxy doesn´t support CONNECT.
Title: Re: Can´t start aMule with proxy
Post by: phoenix on October 25, 2005, 12:59:22 AM
KyroMaster,

Sorry, but afaik, you cannot know in advance whether the proxy supports CONNECT, the connnection just fails. Also, I don't think it hangs, it is probably just trying to connect to other servers. Please, if you find I am wrong, tell me so that I can fix it.

Cheers!
Title: Re: Can´t start aMule with proxy
Post by: KyroMaster on October 25, 2005, 01:36:51 AM
I retested it and I´ve found out there appear

Http-CONNECT(0001): 0 -> 1
process_end - ok=false, 0 bytes

messages over and over again. aMule becomes unresponsive and uses 100% CPU but about every 30 seconds it´s responsive for some seconds (making me able to close it after some time).
But I think if the connection should fail then this is a bug.
Title: Re: Can´t start aMule with proxy
Post by: phoenix on October 25, 2005, 09:24:12 AM
KyroMaster,

In your case, if you are going from 0 to 1 directly, it means that the proxy is not responding, not even with an error message, so the connection times out. How are we supposed to detect its capabilities?

About the 100% cpu problem, I don't think I can trigger it here, but I'll try. Could be because aMule tries to connect to several servers until it connects to the first, but there is no apparent reason to use 100% cpu. Maybe you have too many debug/log options turned on?

Cheers!
Title: Re: Can´t start aMule with proxy
Post by: KyroMaster on October 25, 2005, 04:28:35 PM
I don´t know why the proxy doesn´t respond, it´s a regular http proxy which works fine for web pages and ftp.
I have no debug options turned on at all.
Is there a howto about launching the debug version of aMule in a debugger (e.g. kdb) and see where it hangs? I´m a C++-programmer by myself but I never debugged a program which I didn´t write *g
Title: Re: Can´t start aMule with proxy
Post by: phoenix on October 26, 2005, 12:48:26 PM
KyroMaster,

I have experienced the same, some (most?) proxys do not respond when asked for CONNECT, maybe it is some kind of bandwidth protection.

Notice that the debug options I am refering to are not compile options, I mean preference options. If you are seeing these "Http-CONNECT(0002): 0 -> 2" messages, you probably have "debug proxy" enabled in preferences. Or else, I made some mistake in the code :D

There are some docs here:
http://www.amule.org/wiki/index.php/Using_gdb_and_valgrind
http://www.amule.org/wiki/index.php/Backtraces

And, of course, you are welcome to ask anything here ;)

I also recommend that you compile a debug version of wxWidgets. I usually do it like this:
cvs up && ./configure --enable-debug --disable-optimise --enable-debug_flag --enable-debug_info --enable-debug_gdb --with-opengl --enable-gtk2 --enable-unicode --enable-largefile --prefix=/home/user/wxWidgets-cvsu && make && make install

Notice that if you do exactly as I said, you will have to run aMule like this:
LD_LIBRARY_PATH=/home/user/wxWidgets-cvsu/lib /path/to/amule &

kdbg is a good front end for gdb, maybe the most friendly, but it crashes for me from time to time, mainly when you need to restart the program and that makes me angry. There is also ddd, which is very stable. But most of the time, I use gdb directly, no intermediaries ;)

Cheers!
Title: Re: Can´t start aMule with proxy
Post by: KyroMaster on October 26, 2005, 05:30:41 PM
I´ve disabled the "debugging" at all in the "advanced" tab of the preferences. The Proxy channel is also not selected (the debug messages usually go in the "aMule log" in the GUI anyway not to stderr/stdout).
I think if I´ve some time I´ll compile aMule with a debug version of wx and then see why it doesn´t respond any more  ?(. Or does aMule use synced I/O and wait for the proxy (so that when it won´t respond aMule hangs)?
Title: Re: Can´t start aMule with proxy
Post by: phoenix on October 27, 2005, 10:06:53 AM
aMule socket i/o is event driven. It uses the wxWidgets event system. In fact, it is not different at all from the non-proxy code. If you choose to use a proxy to connect, of course it will take a little longer to connect, because some time will be used to connect to the proxy and wait for it to connect on behalf of you, but once connected, you talk to the proxy very much the same way you would talk to the server side.

So in this sense, aMule should never hang. The hanging sensation is probably due to high cpu usage, please, correct me if I am wrong on that. Most probably due to trying to connect to servers on startup.

One thing I have never tested is proxy with aMuled, I really don't know if it works. aMuled uses threads for each connection (socket), because it cannot use the wxWidgets event system. In this case, a thread always "hangs", but the app itself is on another thread not "hang".