Thread: [Modcplusplus-user] time out during post requests
Brought to you by:
gr84b8,
johnksterling
From: Nathan S. <na...@al...> - 2002-04-15 16:06:07
|
Greetings all, I had emailed John about this earlier, but am posting here to recap what I've figured out thus far. Whenever a HTTP POST request is made to a cpp module, apache immediatly returns whatever output the module provides but then inexplicably (so far) doesn't close the connection, leading to an around 10 second timeout before apache (or browser, unsure which) gives up on waiting, and closes the tcp connection. This only seems to occur with browsers that attempt a keep alive connection during posts. Both Mozilla and IE versions > 4 do this, however Netscape 4.x does not. Here's a sniffed request that works: POST /cpp-handler HTTP/1.1 User-Agent: curl/7.9.2 (i686-pc-linux-gnu) libcurl 7.9.2 (OpenSSL 0.9.6b) Host: nas.office.allmed.net Pragma: no-cache Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* Content-Length: 17 Content-Type: application/x-www-form-urlencoded test1=sa&test2=32 And one that does not: POST /cpp-handler HTTP/1.1 Host: nas.office.allmed.net Accept: */* Accept-Language: en Pragma: no-cache Connection: Keep-Alive Referer: http://nas.office.allmed.net/test.html User-Agent: Mozilla/4.0 (compatible; MSIE 5.12; Mac_PowerPC) UA-OS: MacOS UA-CPU: PPC Content-type: application/x-www-form-urlencoded Extension: Security/Remote-Passphrase Content-length: 17 test1=sa&test2=32 As you can see, the content-length and content is the same for both requests, they are both HTTP/1.1, however the failing request has the Connection: Keep-Alive header. From what I've been able to figure out by crude ap_log statements in the mod_cpp source, the request does get through mod_cpp just fine, and control passes back to apache before the time-out occures. gdb is useless with the multithreaded nature of apache2, and segfaults before even getting it running. The problem to me seems to lie in mod_cpp, as normal cgi's work fine. Therefore perhaps there is something that mod_cpp should perform for post requests that it's not? I've confirmed that turning off keep alives off in httpd.conf, makes the problem go away. Does anyone else see this behaviour or is it only myself? Nathan |
From: <jo...@st...> - 2002-04-15 17:21:33
|
very interesting - the content length looks correct..... but the browser hangs? I'll try to reproduce this. sterling On 15 Apr 2002, Nathan Stitt wrote: > Greetings all, > > I had emailed John about this earlier, but am posting here to recap what > I've figured out thus far. > > Whenever a HTTP POST request is made to a cpp module, apache immediatly > returns whatever output the module provides but then inexplicably (so > far) doesn't close the connection, leading to an around 10 second > timeout before apache (or browser, unsure which) gives up on waiting, > and closes the tcp connection. > > This only seems to occur with browsers that attempt a keep alive > connection during posts. Both Mozilla and IE versions > 4 do this, > however Netscape 4.x does not. > > Here's a sniffed request that works: > > POST /cpp-handler HTTP/1.1 > User-Agent: curl/7.9.2 (i686-pc-linux-gnu) libcurl 7.9.2 (OpenSSL > 0.9.6b) > Host: nas.office.allmed.net > Pragma: no-cache > Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* > Content-Length: 17 > Content-Type: application/x-www-form-urlencoded > > test1=sa&test2=32 > > > And one that does not: > > > POST /cpp-handler HTTP/1.1 > Host: nas.office.allmed.net > Accept: */* > Accept-Language: en > Pragma: no-cache > Connection: Keep-Alive > Referer: http://nas.office.allmed.net/test.html > User-Agent: Mozilla/4.0 (compatible; MSIE 5.12; Mac_PowerPC) > UA-OS: MacOS > UA-CPU: PPC > Content-type: application/x-www-form-urlencoded > Extension: Security/Remote-Passphrase > Content-length: 17 > > test1=sa&test2=32 > > > As you can see, the content-length and content is the same for both > requests, they are both HTTP/1.1, however the failing request has the > Connection: Keep-Alive header. > > >From what I've been able to figure out by crude ap_log statements in the > mod_cpp source, the request does get through mod_cpp just fine, and > control passes back to apache before the time-out occures. gdb is > useless with the multithreaded nature of apache2, and segfaults before > even getting it running. > > The problem to me seems to lie in mod_cpp, as normal cgi's work fine. > Therefore perhaps there is something that mod_cpp should perform for > post requests that it's not? > > I've confirmed that turning off keep alives off in httpd.conf, makes the > problem go away. > > Does anyone else see this behaviour or is it only myself? > > Nathan > > > _______________________________________________ > Modcplusplus-user mailing list > Mod...@li... > https://lists.sourceforge.net/lists/listinfo/modcplusplus-user > |
From: <jo...@st...> - 2002-04-15 18:24:34
|
Just curious - do you have the example filters loaded too in your config file? maybe the problem is in the filters...... i'm not quite able to reproduce it yet.... have you modified the exmpample cpp handler? thanks. sterling |
From: Nathan S. <na...@al...> - 2002-04-15 18:50:13
|
On Mon, 2002-04-15 at 13:22, jo...@st... wrote: > Just curious - do you have the example filters loaded too in your config > file? maybe the problem is in the filters...... i'm not quite able to > reproduce it yet.... > No, I'm running a completly stock Apache 2.0.35 GA, configured with: ./configure --enable-info --with-mpm=worker and the following added in the httpd.conf: LoadFile /usr/lib/libstdc++.so.3.0.2 LoadModule cplusplus_module modules/libmod_cplusplus.so.0.0.0 LoadCPPHandler test_handler modules/libtest_handler.so AddCPPConnectionInputFilter test_input_filter <Location /cpp-handler> SetHandler cpp-handler AddCPPHandler test_handler </Location> > have you modified the exmpample cpp handler? > > I'm not sure which handler your refering to. I've been testing with the example/handler/test_handler.cpp. The only changes I've made is to add mHits = 0 in the constructor, and then when I saw it wasn't handling posts correctly, added a bunch of ap_log_error(...) calls. I'm testing with some of the other examples now to see if they exibit the same behaviour. Will let you know the results. Nathan |
From: sterling <ste...@co...> - 2002-04-15 19:02:13
|
On 15 Apr 2002, Nathan Stitt wrote: > On Mon, 2002-04-15 at 13:22, jo...@st... wrote: > > have you modified the exmpample cpp handler? > > > > > I'm not sure which handler your refering to. I've been testing with the > example/handler/test_handler.cpp. The only changes I've made is to add > mHits = 0 in the constructor, and then when I saw it wasn't handling > posts correctly, added a bunch of ap_log_error(...) calls. cool - i think i just found the problem. if your handler expects POSTs it either need to suck the content out of the bucket, or tell the request to discard it before returning..... i just committed it to cvs - are you building from cvs? or using the tarball up on sourceforge? i'll update the tarball with the change. sterling |
From: Nathan S. <na...@al...> - 2002-04-15 22:44:20
|
On Mon, 2002-04-15 at 13:59, sterling wrote: > On 15 Apr 2002, Nathan Stitt wrote: > > > On Mon, 2002-04-15 at 13:22, jo...@st... wrote: > > > have you modified the exmpample cpp handler? > > > > > > > > I'm not sure which handler your refering to. I've been testing with the > > example/handler/test_handler.cpp. The only changes I've made is to add > > mHits = 0 in the constructor, and then when I saw it wasn't handling > > posts correctly, added a bunch of ap_log_error(...) calls. > > cool - i think i just found the problem. if your handler expects POSTs it > either need to suck the content out of the bucket, or tell the request to > discard it before returning..... i just committed it to cvs - are you > building from cvs? or using the tarball up on sourceforge? i'll update > the tarball with the change. > Cool! Was wondering if it was something like that. I'm running cvs, I'll resync tommorow and give it a shot. Thanks for all your help on this! On a side note, I've been looking into moddifing the gnu c++ cgi library http://www.gnu.org/software/cgicc/cgicc.html for use with modcplusplus apache. Right now it looks like a rather easy change, but will know more once I get started on it. It's a bit more heavy that I would like, as it has lots of classes to generate html tables, forms, etc. I probably won't use them, but looks like they aren't constructed unless used, and someone else would probably appreciate them. Later, Nathan |
From: Nathan S. <na...@al...> - 2002-04-16 13:34:15
|
On Mon, 2002-04-15 at 13:59, sterling wrote: > cool - i think i just found the problem. if your handler expects POSTs it > either need to suck the content out of the bucket, or tell the request to > discard it before returning..... i just committed it to cvs - are you > building from cvs? or using the tarball up on sourceforge? i'll update > the tarball with the change. > It looks as though that fixed it! So all I was missing reading the content? I was mistakenly ignoring it for the purpose of my simple tests, I guess apache didn't like that. Thanks for all your help on this. Now I can start focusing on getting an actually library together for easily accessing the get and post values. Later, nathan |
From: <jo...@st...> - 2002-04-16 17:05:47
|
On 16 Apr 2002, Nathan Stitt wrote: > On Mon, 2002-04-15 at 13:59, sterling wrote: > > > cool - i think i just found the problem. if your handler expects POSTs it > > either need to suck the content out of the bucket, or tell the request to > > discard it before returning..... i just committed it to cvs - are you > > building from cvs? or using the tarball up on sourceforge? i'll update > > the tarball with the change. > > > > It looks as though that fixed it! So all I was missing reading the > content? I was mistakenly ignoring it for the purpose of my simple > tests, I guess apache didn't like that. yup - if you are planning on not reading the content, apache needs to be told via pRequest->discard_request_body() method. sterling |