[Top][All Lists]

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

Re: [libmicrohttpd] Re : Re: Connection time out and MHD_USE_POLL_INTERN

From: Christian Grothoff
Subject: Re: [libmicrohttpd] Re : Re: Connection time out and MHD_USE_POLL_INTERNALLY causes busy loop
Date: Fri, 17 Apr 2015 17:56:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.5.0

On 04/16/15 16:38, address@hidden wrote:
> HI,
> May I suggest two other fixes related to that issue:
> 1) When the loop info is set to MHD_EVENT_LOOP_INFO_CLEANUP, we should
> not wait for the timeout as we want to release the thread and the
> ressources ASAP.
> I suggest to add
>         /* When a connection needs clean up, we have to do it now */
>         timeout = 0;
> at daemon.c:2417 (SVN 35535)

Sure, this makes sense.
=> SVN 35538.

> 2) When the MHD has determined that the connections has timed out, we
> should send 408 to the client
> I suggest to add
>       transmit_error_response (connection, MHD_HTTP_REQUEST_TIMEOUT, "");
>       connection->write_handler (connection);
> at connection.c:2646 (SVN 35532)

That's not quite OK in my view. MHD timeout semantic is to close the
connection. Just queuing a reply doesn't work as we then need to spend
extra time to send the timeout reply, and it is quite conceivable that
the issue was client-side anyway.

If you want to send a timeout like this, my suggestion would be to
configure the MHD timeout at X and queue this reply in the application
logic at X-1s if you find out that your application is too slow to
produce the reply in a timely fashion.  That'll also enable sending a
more detailed timeout response with a more reasonable body.

Happy hacking!


reply via email to

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