From a547f55f2fea2d8d0a7c0a3af436e538fd0e0be8 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 15 May 2023 19:30:27 +0800 Subject: [PATCH] Fix deadlock when using putmultifilejob with rate limits enabled Signed-off-by: Claudio Cambra --- src/libsync/putmultifilejob.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libsync/putmultifilejob.cpp b/src/libsync/putmultifilejob.cpp index f3740a17c..05edda06a 100644 --- a/src/libsync/putmultifilejob.cpp +++ b/src/libsync/putmultifilejob.cpp @@ -44,6 +44,13 @@ void PutMultiFileJob::start() QNetworkRequest req; for(const auto &oneDevice : _devices) { + // Our rate limits in UploadDevice::readData will cause an application freeze if used here. + // QHttpMultiPart's internal QHttpMultiPartIODevice::readData will loop over and over trying + // to read data from our UploadDevice while there is data left to be read; this will cause + // a deadlock as we will never have a chance to progress the data read + oneDevice._device->setChoked(false); + oneDevice._device->setBandwidthLimited(false); + auto onePart = QHttpPart{}; onePart.setBodyDevice(oneDevice._device.get()); -- 2.30.2