libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] [PATCH]: MHD_connection_update_event_loop_info sends


From: Evgeny Grin
Subject: Re: [libmicrohttpd] [PATCH]: MHD_connection_update_event_loop_info sends INTERNAL_ERROR for suspended connections
Date: Fri, 17 Mar 2017 10:03:29 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 17.03.2017 5:42, Vitaliy T wrote:
> Inside of MHD_connection_handle_read () src/microhttpd/connection.c is
> missing check against of the return value for the
> try_grow_read_buffer() call. It's just ignored. And now without a fear
> I may say that the INTERNAL_ERROR will be send for a connection that
> was resumed and then suspended again (probably few times).
> 
> Here is the log of the server:
> 
> +0300 2017-03-17 05:31:34.254320 * Connection from 127.0.0.1 port
> 47824                 [33/49728]
> +0300 2017-03-17 05:31:34.261671 * Connection from 127.0.0.1 port 48848
> +0300 2017-03-17 05:31:34.272435 ! 127.0.0.1 port 47824: suspend
> +0300 2017-03-17 05:31:34.279515 ! 127.0.0.1 port 46800: uploaded `big2'
> +0300 2017-03-17 05:31:34.280380 ! 127.0.0.1 port 47824: resumed
> +0300 2017-03-17 05:31:34.280917 ! 127.0.0.1 port 48848: uploading `big3'
> +0300 2017-03-17 05:31:34.281012 * Connection 127.0.0.1 port 46800 closed: OK
> does not fit #2:
>   pool: 0x0x14206d50
>   pool->pos: 66565
>   asize: 67376
>   pool->end: 130976
> FAIL: try_grow_read_buffer
> FAIL: MHD_connection_handle_read
>   127.0.0.1 port 47824
> +0300 2017-03-17 05:31:34.281732 ! 127.0.0.1 port 47824: suspend
> does not fit #2:
>   pool: 0x0x14206d50
>   pool->pos: 66565
>   asize: 67376
>   pool->end: 130976
> FAIL: try_grow_read_buffer
> ERROR: 127.0.0.1 port 47824
> Error processing request (HTTP response code is 500
> (`<html><head><title>Internal server error</ti
> tle></head><body>Some programmer needs to study the manual more
> carefully.</body></html>')). Closi
> ng connection.
> +0300 2017-03-17 05:31:34.378595 ! 127.0.0.1 port 48848: uploaded `big3'
> +0300 2017-03-17 05:31:34.384555 ! 127.0.0.1 port 47824: resumed
> +0300 2017-03-17 05:31:34.384716 * Connection 127.0.0.1 port 48848 closed: OK
> +0300 2017-03-17 05:31:34.384857 * Connection 127.0.0.1 port 47824 closed: OK
> 
> As we can see the connection 127.0.0.1 port 47824 was suspended,
> resumed and then again suspended.
> 
> The server was run in epoll mode with 1 thread.
> DEFAULT_HTTPD_CONNECTION_MEMORY_LIMIT = 128k
> DEFAULT_HTTPD_CONNECTION_MEMORY_INCREMENT = 4k
> Both suspend & resume operations are called from DH.
> 
> Hope, it will help.

To get the full picture, could you also monitor value pointed by
'upload_data_size' before and after your MHD_AccessHandlerCallback is
called?

Please note that even if you suspend connection, you must process at
least some data (preferably - all data) and decrement value of
'upload_data_size'.

-- 
Best Wishes,
Evgeny Grin



reply via email to

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