My QT-based single-threaded console app running on Linux parses JSON strings using Boost, and it works fine ordinarily, except when receiving very large chunks of JSON. I have a piece of valid JSON around 160kb in size (!) and when I attempt to parse it, the call to Boost's JSON parser never returns. I've left it a considerable time. If I subsequently break in using the debugger, my app is idly sitting in its message loop, as though nothing happened. The call throws no exceptions. There's nothing noteworthy about the JSON except for its large size - it's well-formed and entirely composed of ASCII characters.
How can execution simply "give up" and return to the QT message loop?
void IncomingRequestHandler::OnRequest(const QString& message) { try { std::stringstream ss; ss << message.toStdString(); boost::property_tree::ptree requestObject; cout << "Before read_json" << endl; // Gets here boost::property_tree::json_parser::read_json(ss, requestObject); cout << "After read_json" << endl; // Never gets here // ... Some other code ... } catch (const boost::property_tree::json_parser::json_parser_error& e) { cout << "Invalid JSON" << endl; // Never gets here } catch (const std::runtime_error& e) { cout << "Invalid JSON" << endl; // Never gets here } catch (...) { cout << "Invalid JSON" << endl; // Never gets here } }