Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-84617

QHttpServer crashes when disconnected from client before finishing reply

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.14.2
    • Network: HTTP
    • None
    • % sw_vers
      ProductName: Mac OS X
      ProductVersion: 10.15.3
      BuildVersion: 19D76
    • macOS

    Description

      Test case

      void tst_QHttpServer::disconnectedInEventLoop()
      {
          httpserver.route("/event-loop/", [] () {
              QEventLoop loop;
              QTimer::singleShot(1000, &loop, &QEventLoop::quit);
              loop.exec();
              return QHttpServerResponse::StatusCode::Ok;
          });
      
          const QUrl requestUrl(urlBase.arg("/event-loop/"));
          auto reply = networkAccessManager.get(QNetworkRequest(requestUrl));
          QTimer::singleShot(500, reply, &QNetworkReply::abort); // cancel connection
          QEventLoop loop;
          connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
          loop.exec();
          reply->deleteLater();
      }
      

      Config: Using QtTest library 5.14.2, Qt 5.14.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 10.0.0 (clang-1000.11.45.5) (Apple))
      PASS : tst_QHttpServer::initTestCase()
      QFATAL : tst_QHttpServer::disconnectedInEventLoop() Received signal 11
      Function time: 1008ms Total time: 1011ms
      FAIL! : tst_QHttpServer::disconnectedInEventLoop() Received a fatal error.
      Loc: [Unknown file(0)]
      Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 1011ms

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mikhailsvetkin Mikhail Svetkin
            tasuku.suzuki Tasuku Suzuki
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes