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: Evgeny Grin
Subject: Re: [libmicrohttpd] Problem with Keep-Alive and MHD_OPTION_CONNECTION_TIMEOUT in MHD_USE_THREAD_PER_CONNECTION mode
Date: Sun, 06 Dec 2015 03:49:39 +0300

Christian,

You solved the problem.
I was able to reproduce the problem: if you make a single request from chrome 
for example and wait more than timeout seconds, than all following requests 
will be put on long waiting. But it you make a new request from another client 
or tab, than all requests (including waiting ones) are served immediately. 
Debugger show that MHD select thread are waiting for return from 
MHD_sys_select_ when client are in long waiting.
On latest SVN the problem is gone.
Do we need any refactoring/renaming in MHD code as we are using MHD_EPOLL_TURBO 
in MHD_start_daemon_va to prevent sockets shutdown on W32?

-- 
Best Wishes,
Evgeny Grin


05.12.2015, 19:33, "Christian Grothoff" <address@hidden>:
> 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



reply via email to

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