You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a HTTPSClientSession, sendRequest and receiveResponse. Move app to background and move it back to foreground a few minutes later. Then the underlying socket will be invalid and read function fall into infinite loop.
Expect Behavior
read function return error when socket is invalid.
intSecureSocketImpl::receiveBytes(void* buffer, int length, int flags)
{
poco_assert (_pSocket->initialized());
poco_check_ptr (_pSSL);
int rc;
if (_needHandshake)
{
rc = completeHandshake();
if (rc == 1)
verifyPeerCertificate();
else
return rc;
}
do
{
rc = SSL_read(_pSSL, buffer, length);
}
while (mustRetry(rc));
if (rc <= 0)
{
returnhandleError(rc);
}
return rc;
}
when socket is invalid, SSL_read return -1, but mustRetry always return true, so receiveBytes fall into infinite loop. This is because poll always return true when socket is invalid(platform specific).
@obiltschnig just revert f7ba58c ? Note that it was committed to fix the #1160 . Perhaps setting SSL_MODE_ENABLE_PARTIAL_WRITE would have helped with that one?
@zhufan did you verify that removing said commit makes the problem go away?
Environment
IOS
Current Behavior
Create a HTTPSClientSession, sendRequest and receiveResponse. Move app to background and move it back to foreground a few minutes later. Then the underlying socket will be invalid and read function fall into infinite loop.
Expect Behavior
read function return error when socket is invalid.
Reason
poco/NetSSL_OpenSSL/src/SecureSocketImpl.cpp
Lines 312 to 336 in de61f00
when socket is invalid, SSL_read return -1, but mustRetry always return true, so receiveBytes fall into infinite loop. This is because poll always return true when socket is invalid(platform specific).
poco/NetSSL_OpenSSL/src/SecureSocketImpl.cpp
Lines 437 to 445 in de61f00
Possible Solution
SSL_MODE_AUTO_RETRY is set by poco:
poco/NetSSL_OpenSSL/src/Context.cpp
Line 181 in de61f00
and socket is blocking, there is no need to retry when SSL_read return error, reference: https://www.openssl.org/docs/man1.1.1/man3/SSL_read.html
revert f7ba58c can fix it.
The text was updated successfully, but these errors were encountered: