View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001621 | libmicrohttpd | thread pool | public | 2010-11-18 01:30 | 2010-12-25 23:22 |
| Reporter | jaredc | Assigned To | Christian Grothoff | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 0.9.2 | ||||
| Summary | 0001621: Socket gets shutdown, but not closed, when peer closes connection | ||||
| Description | I am using THREAD_PER_CONNECTION. I ran a test where the peer closes the connection in the middle of a GET request. The socket never gets closed in this case, but it gets shutdown and read_closed set to true. I think the issue is that the state machine is meant to actually close the connection, but since error is returned from do_read(), checking of the state never occurs again. I think the solution is to simply change the return value in do_read() for this case, indicating that something has changed and allowing the state check to properly close the connection (and call final callbacks). I have submitted a very simple patch that does exactly this and resolves the issue. | ||||
| Tags | No tags attached. | ||||
| Attached Files | patch.diff (463 bytes)
Index: src/daemon/connection.c
===================================================================
--- src/daemon/connection.c (revision 13729)
+++ src/daemon/connection.c (working copy)
@@ -1456,7 +1456,7 @@
/* other side closed connection */
connection->read_closed = MHD_YES;
SHUTDOWN (connection->socket_fd, SHUT_RD);
- return MHD_NO;
+ return MHD_YES;
}
connection->read_buffer_offset += bytes_read;
return MHD_YES;
| ||||
|
|
Patched as suggested in SVN 13738. Note that I believe that the socket WILL be closed if you use timeouts for connections (which you should). But obviously that would be later than what would be desirable, so the patch is still good to have (but less critical then it may sound). |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2010-11-18 01:30 | jaredc | New Issue | |
| 2010-11-18 01:30 | jaredc | File Added: patch.diff | |
| 2010-11-18 22:57 | Christian Grothoff | Note Added: 0004175 | |
| 2010-11-18 22:57 | Christian Grothoff | Status | new => resolved |
| 2010-11-18 22:57 | Christian Grothoff | Resolution | open => fixed |
| 2010-11-18 22:57 | Christian Grothoff | Assigned To | => Christian Grothoff |
| 2010-12-25 23:22 | Christian Grothoff | Status | resolved => closed |
| 2013-05-06 12:53 | Christian Grothoff | Category | multi-threaded operation => libmicrohttpd multi-threaded operation |
| 2024-01-21 13:25 | Christian Grothoff | Category | libmicrohttpd multi-threaded operation => thread pool |