libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] MHD_AccessHandlerCallback calls


From: Christian Grothoff
Subject: Re: [libmicrohttpd] MHD_AccessHandlerCallback calls
Date: Sun, 25 Oct 2015 15:35:21 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0

Hi Olivier,

Thanks for the report, I've done a visual inspection of the code based
on your report, and I think I've found the issue.  Please try it by
using SVN 36568 or the attached diff, and let me know if this fixes the
problem (as I didn't reproduce it myself).

(If I'm right, it only occurs if your client sends the next request
before having received the fully response, and it arrives faster at the
server than the server can process the previous response, and does so
continuously, resulting in a shrinking buffer (which may cause the
server to be again slower, further increasing the speed-advantage of the
client. And it's limited to the duration of one TCP connection, so one
needs to massively pipeline POSTs to trigger it, which explains nicely
why only you noticed...).

Happy hacking!

Christian

On 10/24/2015 10:54 PM, Olivier Delhomme wrote:
> Hi to everyone,
> 
> I'm new to libmicrohttpd and found something related to the
> calls of MHD_AccessHandlerCallback function that I can not
> explain.
> 
> I'm calling libmicrohttpd this way:
> 
> MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, 
> serveur_struct->opt->port, NULL, NULL, &ahc, serveur_struct, 
> MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) 131070 , 
> MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, MHD_OPTION_END);
> 
> 'ahc' function is the MHD_AccessHandlerCallback function.
> 
> I implemented only GET and POST commands. I'm using
> POST to send json data (no field at all) from a client 
> (libcurl). The connection is kept by libcurl and reused
> to make a lot of POST commands.
> 
> Everything just works fine. Except that over time the
> parameter 'upload_data_size' of MHD_AccessHandlerCallback
> function is getting smaller and smaller. For instance
> it can be as big as 16332 bytes at the beginning and 
> be as small as 1700 bytes 10 minutes later (I never saw
> it growing again). I do not understand this. 
> 
> Can someone explain it ? 
> 
> How do I tell libmicrohttpd not to lower this parameter ?
> 
> Thanks for any insights. 
> 
> Regards, Olivier.
> 
> The project is: https://github.com/dupgit/sauvegarde
> Use of libmicrohttpd is in this file (MHD_start_daemon
> at line 835):
> https://github.com/dupgit/sauvegarde/blob/master/serveur/serveur.c
> 
> 

Attachment: bufleak.diff
Description: Text Data

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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