libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] Problem with Keep-Alive and MHD_OPTION_CONNECTION_TI


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Problem with Keep-Alive and MHD_OPTION_CONNECTION_TIMEOUT in MHD_USE_THREAD_PER_CONNECTION mode
Date: Sat, 5 Dec 2015 17:33:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.3.0

Hi!

Reading the code I noticed an #ifdef WINDOWS'ed call to shutdown() that
would only be executed (in your particular setting) whenever yet another
connection was accepted, possibly delaying the TCP connection tear down.
I've tried to move the respective logic to happen earlier in SVN 36731.
 Please try this version, and let me know if this fixes your problem.
(Again, the problem doesn't really hit me on GNU/Linux, so this may or
may not be related.)

Happy hacking!

Christian


On 12/05/2015 01:02 AM, silvioprog wrote:
> Hello,
> 
> I'm trying to use Keep-Alive in the `MHD_USE_THREAD_PER_CONNECTION` mode
> with the `MHD_OPTION_CONNECTION_TIMEOUT` option, however, when timeout is
> ends, it locks the client that can't get more responses from my MHD server.
> 
> Is very easy to reproduce that, you just:
> 
> . compile and run this demo[1] (hellobrowser.c modified);
> . make some simultaneous requests in the `http://localhost:8080` link;
> . wait five or ten more seconds;
> . try a new request in the `http://localhost:8080` link. (the client will
> locks)
> 
> (the timeout 3 was purposeful to allow to reproduce the problem)
> 
> It seems that the connection is closed when the thread die, yes it's the
> right behaviour, but it seems that the client still connected in a 'ghost'
> connection, trying new requests in that. Is there any callback to force a
> client disconnection? I can't use the `Connection: close` header because I
> want to use Keep-Alive.
> 
> Notice: using only the `MHD_USE_SELECT_INTERNALLY` it works fine even with
> a timeout, the problem happens only when I declare the
> `MHD_USE_THREAD_PER_CONNECTION` option.
> 
> [1] http://pastebin.com/LpmvH87b
> 

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]