mirror of https://github.com/sysown/proxysql
Errors and EOF returned by 'recv' are now properly handled, isolated
from the return value ('r') from the later and conditional 'SSL_read'.
Previously, a busy loop was possible in the following scenario:
1. A client connection was closed, leading to a return of 0 by 'recv',
and 'errno' to be set with 'EAGAIN'.
2. Error handling is performed taking into account a never performed
call to 'SSL_read' (as if this '0' was a result for this call).
3. The call to 'SSL_get_error' returns with 'SSL_ERROR_SYSCALL', as a
result of using this invalid param of '0' (which for 'SSL_read' would
mean non-retryable error), and the non-reset 'errno' would still be
'EAGAIN'.
4. This would create the illusion of an interrupted read. So a new read
is tried again, while in reality the socket is closed. This busy loop
will continue until 'POLLHUP' is received when we attempt to write
back to the client and a 'RST' is received as a response.
v2.x-client_ssl_busy_wait
parent
27e71d2972
commit
ccfca5a3f9
Loading…
Reference in new issue