QtNetwork multiple concurrent upload data corruption bug
NahidAkbar last edited by
Versions observed: 4.8, 5.0, ...
OS: Linux/Ububtu 12.04
Libraries linked to: Qt5Network, Qt5Core.
I have a setup where I upload several hundred small files (size around 512kb-2mb) to a local webserver in parallel. When I say parallel, I mean multiple QNetworkRequest/Reply objects. It's a simple QtCoreApplication running a simple event loop and does not use any threading code. I am uploading through post requests. I think this only happens when I have more than one or two parallel connections. I usually limit the number of parallel connections to 4 as it doesn't seem to run more than six connections anyway. But if I let in about 10-20 connections at once, it seems to make this occur faster.
What basically happens is, after about 16 kb, only for some of the requests, it starts to repeat the start of the packet. I can easily tell because those are preety much json files and I can see the elements at the top repeating. I am using a QFile as the QIODevide in my request. I've tried caching the data in a QBuffer and using that. Same result.
It is very non-deterministic. If I ran 100 uploads, I would only observe this in say 15 of the requests. I have retry mechanisms in my software and when the same request is retried, it succeeds. And this is very very rare when only using say two connections. Starts to happen quicker when more when more parallel connections are used.
It is not a fault of the web-server. We've stress tested it with thousands of parallel uploading connections. And we've confirmed with wireshark that it is indeed the data that comes out of the qt network stack that goes corrupted.
Would be nice if this was fixed for future versions of Qt. Or maybe I am not enabling some setting or something that makes this bug report stupid. I can't share our proprietery code but I am willing to patch together some snippets to help reproduce this is that helps.
amccarthy last edited by
I suggest you report this in the Qt bug tracking system. https://bugreports.qt-project.org/