Details
Description
Sorry, have no reproducer at the moment, but the problem seems trivial.
Sometimes I see the next Qt warning in program output:
QIODevice::write (QTcpSocket): device not open
Call stack:
Qt6Core.dll!QDebug::~QDebug() Line 164 C++ Qt6Core.dll!checkWarnMessage(const QIODevice * device, const char * function, const char * what) Line 71 C++ Qt6Core.dll!QIODevice::write(const char * data, __int64 maxSize) Line 1642 C++ qschannelbackend.dll!QTlsPrivate::TlsCryptographSchannel::sendToken(void * token, unsigned long tokenLength, bool emitError) Line 723 C++ qschannelbackend.dll!QTlsPrivate::TlsCryptographSchannel::createContext() Line 1006 C++ qschannelbackend.dll!QTlsPrivate::TlsCryptographSchannel::continueHandshake() Line 1837 C++ [Inline Frame] Qt6Network.dll!QSslSocketPrivate::startClientEncryption() Line 2858 C++ Qt6Network.dll!QSslSocket::startClientEncryption() Line 1714 C++ Qt6Network.dll!QSslSocketPrivate::_q_connectedSlot() Line 2465 C++ Qt6Core.dll!doActivate<0>(QObject * sender, int signal_index, void * * argv) Line 4009 C++ Qt6Core.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 4053 C++ Qt6Network.dll!QAbstractSocketPrivate::_q_testConnection() Line 1086 C++ [Inline Frame] Qt6Network.dll!QNativeSocketEngine::connectionNotification() Line 597 C++ Qt6Network.dll!QWriteNotifier::event(QEvent * e) Line 1274 C++ Qt6Widgets.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3289 C++ Qt6Widgets.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3241 C++ Qt6Core.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1118 C++ Qt6Core.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message, unsigned __int64 wp, __int64 lp) Line 151 C++ user32.dll!UserCallWinProcCheckWow() Unknown user32.dll!DispatchMessageWorker() Unknown Qt6Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 533 C++ [Inline Frame] Qt6Core.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag>) Line 100 C++ Qt6Core.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 182 C++ Qt6Core.dll!QThread::exec() Line 578 C++ Qt6Core.dll!QThreadPrivate::start(void * arg) Line 292 C++ kernel32.dll!BaseThreadInitThunk() Unknown ntdll.dll!RtlUserThreadStart() Unknown
It seems like the code sometimes tries to write to an unopened (or closed?) socket, and this produces the warning on QIODevice::write(). At the same time there is an error handling code below, which should normally process such situations. So we could simply suppress this warning by adding an appropriate check to see if the socket is opened before writing to it.
Attachments
Issue Links
- relates to
-
QTBUG-129316 QHttp2ProtocolHandler::sendRST_STREAM() attempts to write to closed QIODevice
- Reported