[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] MHD_AccessHandlerCallback calls
From: |
Olivier Delhomme |
Subject: |
Re: [libmicrohttpd] MHD_AccessHandlerCallback calls |
Date: |
Sun, 25 Oct 2015 22:11:10 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi Christian,
On Sun, Oct 25, 2015 at 03:35:21PM +0100, Christian Grothoff wrote:
> 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).
Thanks a lot for your answer and your patch. I tried by using latest
SVN (36570) and it seems to solve the problem I experienced.
> (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
In fact, my client is waiting the answer of the server and should
not perform any request before receiving the response that is sent
by MHD_queue_response once the server is finished with the POST...
The problem is solved because it does not shrink the buffer anymore.
I observe that the buffer size (upload_buffer_size) has different
values. For instance here are those values at the end of a POST request:
16372, 6312, 10060, 16372, 16372, 16372, 5973, 10399, 16372, 10988, 0
10060+6312 = 16372
5973+10399 = 16372
> needs to massively pipeline POSTs to trigger it, which explains nicely
> why only you noticed...).
:-)
Thanks a lot,
Regards,
Olivier.
> 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
> >
> >
>
> Index: src/microhttpd/connection.c
> ===================================================================
> --- src/microhttpd/connection.c (revision 36565)
> +++ src/microhttpd/connection.c (working copy)
> @@ -2555,7 +2555,7 @@
> connection->read_buffer
> = MHD_pool_reset (connection->pool,
> connection->read_buffer,
> - connection->read_buffer_size);
> + connection->read_buffer_offset);
> }
> connection->client_aware = MHD_NO;
> connection->client_context = NULL;
>
--
"Quand la vérité n'est pas libre, la liberté n'est pas vraie."
[Jacques Prévert]