libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] No response to client.


From: Christian Grothoff
Subject: Re: [libmicrohttpd] No response to client.
Date: Thu, 7 Apr 2016 18:43:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0

On 04/07/2016 03:53 PM, Martin Bonner wrote:
> I have an embedded webserver written with libmicrohttpd.  A client is posting 
> messages to it with custom crafted TCP send/recv calls (so not libcurl or 
> anything trusted like that).  In real life, these messages are sent every 
> half a second.  Every so often (about one in 3000 calls), the client doesn't 
> receive a response.
> 
> I have simplified the code, reduced the delays, and increased the logging.  I 
> now get a message every millisecond or so.  The bad news is that the failure 
> seems to happen with a similar real time frequency.  The message I am sending 
> is quite short (TTMCOMMAND: {"command":"ping"}), and usually the 
> AccessHandler callback gets all the data in one byte.  Occasionally however 
> it gets split up into two chunks.  (That is not a problem, I handle
> it correctly, but it might be clue as to what is going on.)
> 
> The one time I have seen a failure on the debug code, the first AccessHandler 
> occurred as usual, but the second call (which actually gets passed the
> upload data) didn't happen until the client timed out, and created a new 
> connection, and sent a new command to the webserver.  Looking at the logs,
> I *don't* see that happen in the real case (the AccessHandler just never 
> seems to occur).
> 
> Let me be clear: It is unlikely that the problem is in libmicrohttpd - it is 
> much more likely to be in the client (which might not be sending quite
> valid HTTP commands), or in my code (which is making invalid assumptions).
> 
> I am using version 0.9.42 (I've checked the changelog - this doesn't seem to 
> be a fixed problem).
> 
> Any clue what I am doing wrong ? Alternatively, what additional logging would 
> be helpful? 

First thing I'd want to just know is which threading mode you are using
(threads? epoll? select? poll? thread-pool?).  Then I'd add 'strace',
specifically checking when (and how much) MHD read()s data from the
socket and/or when select/epoll unblock (if applicable).


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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