Possible regression in QtNetwork in 4.8.0 since Qt 4.7.4?

  • Some time ago we switched our development branch to the use of stable Qt 4.8.0 release and gained some flowing problems with QtNetwork.

    Our Qt-based application is currently using custom SOAP library that works over QNetworkAccessManager and connects to the Apache Tomcat server application over HTTP using POST requests. By default all the HTTP requests sent through the QNAM are supplied with Keep-Alive header that tells the server application not to close the open TCP connection after serving the HTTP response so it could be used once again for the other requests.

    The key difference was introduced to Qt 4.8.0 with commit f085092a48966a81315a021367086eb69c02e6a6 (we've found it using git bisect on Qt). It changes the implementation of HTTP to the use of threaded connections through the QHttpThreadDelegate private class. Server application disconnects the open TCP session after 20 seconds of non-use and sends the TCP packet with FIN ACK flag.

    Qt 4.7.4 replies with FIN ACK answer packet and closes the open TCP socket, so the next request serving though the same QNAM uses newly opened socket and it goes just fine. Qt 4.8 since the previously mentioned commit changes this behavior. It doesn't close the connection and doesn't reply with FIN ACK packet (which is right IMO). Instead of that Qt sends the ACK packet and leaves the socket in the opened state.

    We couldn't provide a test on it because the behavior of the next request sent through the same QNAM differs and we couldn't track the reason of this. In a simple test app it POSTs the request through the same connection, receives the RST reply from server and re-sends the request using the different connection. But in our app it recieves the SIGPIPE POSIX signal when trying to write to the socket and the request finishes with QNetworkReply::UnknownNetworkError.

    I believe that that behavior (and the reaction to the FIN packet) is quite wrong but I couldn't fix this by myself. Could anyone share any ideas on that?

  • Please open a bug report on "Jira":https://bugreports.qt-project.org - that's the right place to make the devs in charge of QNAM spot the error. They do not necessarily read the forums. Thanks!

  • Did you ever post a bug report for this? I'm having the same problem. Works fine in Qt 4.7.4, but in Qt 4.8.1 Qt client never sends the FIN ACK and I get SIGPIPE writing to the half closed socket on the next POST or PUT.

  • Try switching to Qt 4.8.3. It fixed this problem (and a bunch of other bothering bugs) for us. I've never posted this to bugtracker because I couldn't reproduce this behavior in a separate test application.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.