Details
-
Bug
-
Resolution: Cannot Reproduce
-
Not Evaluated
-
None
-
5.11.3, 5.11
-
None
-
Windows 10, OpenSSL 1.0.2k
Description
My app is a download manager. It supports both HTTP(HTTPS) and Torrents.
For Torrents support I use LibTorrent library. This library uses OpenSSL.
Now, the case. If I start HTTPS download and torrent at the same time, I'll get a crash with the following stack trace (sorry, I have no debug symbols for OpenSSL currently):
Qt5Core.dll!QBasicMutex::unlockInternal() Line 619 C++ libeay32.dll!00007ffe0f9b2180() Unknown libeay32.dll!00007ffe0fa1e478() Unknown ssleay32.dll!00007ffe17a05d26() Unknown downloadsbt.dll!libtorrent::aux::session_impl::session_impl(class boost::asio::io_service &,struct libtorrent::settings_pack const &) C++ downloadsbt.dll!boost::make_shared<struct libtorrent::aux::session_impl,class boost::reference_wrapper<class boost::asio::io_service> const ,class boost::reference_wrapper<struct libtorrent::settings_pack const > const >(class boost::reference_wrapper<class boost::asio::io_service> const &&,class boost::reference_wrapper<struct libtorrent::settings_pack const > const &&) C++ downloadsbt.dll!libtorrent::session::start(int,struct libtorrent::settings_pack const &,class boost::asio::io_service *) C++ downloadsbt.dll!libtorrent::session::session(struct libtorrent::settings_pack const &,int) C++ downloadsbt.dll!std::make_shared<class libtorrent::session,struct libtorrent::settings_pack &,int>(struct libtorrent::settings_pack &,int &&) C++ downloadsbt.dll!QtLtSession::QtLtSession(class QSharedPointer<class QtLtNac> const &,class QObject *) C++ downloadsbt.dll!QSharedPointer<class QtLtSession>::create<class QSharedPointer<class QtLtNac> &>(class QSharedPointer<class QtLtNac> &) C++ downloadsbt.dll!qtMakeShared<class QtLtSession,class QSharedPointer<class QtLtNac> &>(class QSharedPointer<class QtLtNac> &) C++ downloadsbt.dll!QtLtSessionManager::createSession(void) C++ downloadsbt.dll!QtLtSessionManager::emitSessionReference(void) C++ Qt5Core.dll!QObject::event(QEvent * e) Line 1251 C++ Qt5Widgets.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3714 C++ Qt5Widgets.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3676 C++ Qt5Core.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1048 C++ Qt5Core.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1745 C++ Qt5Core.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message, unsigned __int64 wp, __int64 lp) Line 239 C++ user32.dll!UserCallWinProcCheckWow() Unknown user32.dll!DispatchMessageWorker() Unknown Qt5Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 630 C++ Qt5Core.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 214 C++ Qt5Core.dll!QThread::exec() Line 522 C++ Qt5Core.dll!QThreadPrivate::start(void * arg) Line 380 C++ kernel32.dll!BaseThreadInitThunk() Unknown ntdll.dll!RtlUserThreadStart() Unknown
I.e. LibTorrent uses some OpenSSL functions in its initialization. And somehow those OpenSSL functions calls some Qt's callback, which tries to unlock a mutex which is not locked by the thread (obviously).
The issue is NOT happening if I start HTTPS download when LibTorrent is already initialized.