Fix TLS write busy-spin on SSL_ERROR_WANT_READ
A TLS sendData() failing with SSL_ERROR_WANT_READ (mid-handshake application data, or a post-handshake session ticket exchange) has nothing to do with write-readiness, but resetSocket() kept re-arming EPOLLWRNORM anyway - an already-writable TCP socket fires that immediately, so the retry loop spun the CPU as fast as it could until the connection was eventually dropped, without ever reading the peer's first command. Confirmed via a 15GB+ debug log from one stuck connection. sendNeedsRead() lets Socket now tell the difference and wait for a real EPOLLIN instead of busy-retrying.
This commit is contained in:
1 parent
c3e8d70774
commit
2676aaf84c
6 files changed
+68
-1
No files matched your search
@@ -66,6 +66,10 @@ namespace core {
|
||||
return Socket::sendData(data, length);
|
||||
}
|
||||
|
||||
bool TCPSocket::sendNeedsRead() {
|
||||
return ctx && lastSendWantedRead;
|
||||
}
|
||||
|
||||
void TCPSocket::performTLSHandshake() {
|
||||
// registerSocket() makes this fd eligible for epoll dispatch to ANY
|
||||
// worker thread immediately. ioLock MUST be acquired BEFORE that
|
||||
|
||||
Reference in new issue
Block a user