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. -- With Best Regards, Vitaliy V. Tokarev
