From: Jocelyn Turcotte Date: Mon, 27 Jun 2016 14:12:39 +0000 (+0200) Subject: Fix a deadlock when shutting down during discovery (#4993) X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~1137^2~23 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=622017adcf3b1a914221acc0bb2c17e1429ea4c3;p=nextcloud-desktop.git Fix a deadlock when shutting down during discovery (#4993) Since the SyncEngine now quits and waits for the discovery thread, the main thread can enter a deadlock where the discovery thread waits for its directory result. Add a 2 seconds timer to the discovery thread wait condition to limit the deadlock time. --- diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index c85fe2d3c..52a454e9c 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -564,7 +564,7 @@ csync_vio_handle_t* DiscoveryJob::remote_vio_opendir_hook (const char *url, discoveryJob->_vioMutex.lock(); const QString qurl = QString::fromUtf8(url); emit discoveryJob->doOpendirSignal(qurl, directoryResult.data()); - discoveryJob->_vioWaitCondition.wait(&discoveryJob->_vioMutex, ULONG_MAX); // FIXME timeout? + discoveryJob->_vioWaitCondition.wait(&discoveryJob->_vioMutex, 30000); discoveryJob->_vioMutex.unlock(); qDebug() << discoveryJob << url << "...Returned from main thread";