I'm having rather peculiar problem with my Qt application. The application communicates with another application through REST API. Calls are made by functions that will either return the response or empty value if timeout happens.
Code
Qt Code:
  1. QNetworkReply* reply = nam_.post(request, jsonBytes);
  2. connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
  3. QTimer::singleShot(TIMEOUT, &loop, SLOT(quit())); //timeout
  4. QTimer::singleShot(TIMEOUT, this, SLOT(sayHello())); //timeout
  5.  
  6. DBG << "pv Loop begin";
  7. loop.exec();
  8. DBG << "pv Loop end";
  9. QByteArray response = reply->readAll();
  10. return bytesToVariantMap(response);
To copy to clipboard, switch view to plain text mode 
In single try this works. However when multiple threads are running and calls are made in rapid succession problems occur: loop.exec() never exits and sayHello() is never executed. It seems as if the whole event system becomes unpredictable. Oddly enough adding delay before loop.exec seems to reduce the problem.
Qt Code:
  1. QThread::msleep(300); //Without this delay, loop.exec might deadlock (WTF...)
  2. loop.exec();
To copy to clipboard, switch view to plain text mode 

I tried this in both Qt 5.4 and 5.5