OxBat commented on PR #587: URL: https://github.com/apache/logging-log4cxx/pull/587#issuecomment-3811351339
Thanks for the review @swebb2066. Actually, that specific line confirms the blocking behavior. In the APR API, the third argument to `apr_socket_opt_set` acts as an on/off toggle (1 enables, 0 disables). Setting `APR_SO_NONBLOCK` to `0` **disables** non-blocking mode, explicitly forcing the socket into **BLOCKING** mode. ```cpp // src/main/cpp/aprserversocket.cpp // apr_socket_opt_set(socket, option, 1=ON, 0=OFF) status = apr_socket_opt_set(newSocket, APR_SO_NONBLOCK, 0); // This makes it BLOCKING ``` Because the socket is blocking, the application hang scenario is confirmed: 1. **Buffer Saturation:** The slow or stalled client connection stops reading, filling the TCP Send Buffer. 2. **Thread Block:** The `write()` call hits the full buffer. Since the socket is blocking (NonBlock=0), the OS puts the thread to sleep waiting for space. 3. **Application Hang:** As `TelnetAppender::append` holds the `_priv->mutex` (line 241), this single sleeping thread prevents any other thread from logging, causing the application to stall. The proposed fix introduces a write timeout to prevent indefinite blocking, allowing unresponsive clients to be dropped and keeping the application responsive. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
