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

QNAM hangs if net request is made after going offline

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.5.0
    • None
    • Linux
    •  I2c2d348637f72b2a908b438a66aa543a878de1e5

    Description

      This comes from ubuntu, but effect other platforms, including Linux desktop.

      https://bugs.launchpad.net/ubuntu/+source/qtbase-opensource-src/+bug/1470700

      If QNAM is created and then device/machine goes offline, request will hang.

      If QNAM is created when offline, request will report error. If device goes online, request will succeed. If the device goes offline, the request will not return an error and seem to hang.

      Using this code:

      QCoreApplication app(argc, argv);
      QNetworkAccessManager mgr;

      QUrl url(argv[1]);
      for (; {
      qDebug() << "Starting request" << mgr.networkAccessible();
      auto reply = mgr.get(QNetworkRequest(url));
      QObject::connect(reply, &QNetworkReply::finished, [&]()

      { qWarning() << "Error state:" << reply->error() << reply->errorString(); printf("%s\n", reply->readAll().constData()); reply->deleteLater(); app.quit(); }

      );
      app.exec();
      qDebug() << "Done. Sleeping 5 seconds";
      sleep(5);
      }

      Attachments

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

        Activity

          People

            lpotter Lorn Potter
            lpotter Lorn Potter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes