[Top][All Lists]

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

Re: [libmicrohttpd] No response to client.

From: Martin Bonner
Subject: Re: [libmicrohttpd] No response to client.
Date: Thu, 7 Apr 2016 16:28:46 +0000

Further information:

* Heavily loading the server by having two worker processes continually writing 
to the SSD and
deleting the file makes this *much* more likely.  

* Both server and client machines are ARM running Linux in case that matters. 
uname -a says
Linux VC-Z 3.14.51-vc-z #2 SMP PREEMPT Mon Aug 17 15:03:28 CEST 2015 armv7l 

* The command is being sent in multi-part format.

* The client makes four calls to send:  headers; multi-part start; data; 
multi-part end.
   Hacking the client to cork and uncork the socket before and after the send 
makes no difference.

* MHD_start_daemon is started with MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG

* No output is seen on stderr.

I am beginning to think this is more likely to be a problem in MHD.  
Particularly as loading the
server makes it break.

One final thought:  I have also seen problems uploading a large (100MB) file.  
It will chug along,
and then hang for several seconds.  Any clues?

-----Ursprüngliche Nachricht-----
Von: address@hidden [mailto:address@hidden Im Auftrag von Martin Bonner
Gesendet: Donnerstag, 7. April 2016 15:54
An: address@hidden
Betreff: [libmicrohttpd] No response to client.

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? 

Martin Bonner


Daimlerstraße 15
D-79761 Waldshut - Tiengen
Handelsregister Freiburg HRB 712206
Tel:      +49 7741 96 58 08 - 4
Fax:      +49 7741 - 808 176 

reply via email to

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