From: Stephan Bosch Date: Tue, 13 Sep 2016 20:54:02 +0000 (+0200) Subject: lib-http: client: Fixed hang occurring when nested ioloops are used in response callb... X-Git-Tag: 2.3.0.rc1~3025 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1c9f4c14e9c17abcc2813ae977274e40b6579973;p=thirdparty%2Fdovecot%2Fcore.git lib-http: client: Fixed hang occurring when nested ioloops are used in response callbacks. To prevent missing disconnect events, i_stream_read() is called once a change in ioloop is detected. However, if something was actually read into the stream, the input handler was never called. So, a response could linger in the stream buffer, without being handled, thereby causing the connection to hang indefinitely. An additional input event could end the hang, but sometimes this doesn't happen before the request times out. This problem was seen in test-http-payload once in about 10 invocations. Obox uses nested ioloops, to this applies there. --- diff --git a/src/lib-http/http-client-connection.c b/src/lib-http/http-client-connection.c index b24964a2ff..05a866a61f 100644 --- a/src/lib-http/http-client-connection.c +++ b/src/lib-http/http-client-connection.c @@ -282,6 +282,10 @@ int http_client_connection_check_ready(struct http_client_connection *conn) "EOF")); return -1; } + + /* we may have read some data */ + if (i_stream_get_data_size(conn->conn.input) > 0) + i_stream_set_input_pending(conn->conn.input, TRUE); } return 1; }