From: Shijin Kong Date: Mon, 26 Oct 2015 17:15:45 +0000 (-0700) Subject: return read error on non EAGAIN errno X-Git-Tag: deprecate-dynamic-initializer~298 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=209397bd28c1ecd569a0dae144d4729e79041a35;p=folly.git return read error on non EAGAIN errno Summary: Tested over weekend with D2571554. There was no EXC_RESOURCE/CPU crash when read errrors were returned on ENOTCONN. EAGAIN seems innocent as the spin detector was disabled on testing group. Patch folly. I can add #ifdef __APPLE__ around the errno checking code but this should be good practice for non apple code as well. I will remove debugging code in fbios master in another diff. Reviewed By: djwatson Differential Revision: D2580819 fb-gh-sync-id: 9162a3deba01af8b07cd2b336d7da3da040c67a9 --- diff --git a/folly/io/async/AsyncSSLSocket.cpp b/folly/io/async/AsyncSSLSocket.cpp index 9ca8e8e5..e34df564 100644 --- a/folly/io/async/AsyncSSLSocket.cpp +++ b/folly/io/async/AsyncSSLSocket.cpp @@ -1164,7 +1164,11 @@ AsyncSSLSocket::performRead(void** buf, size_t* buflen, size_t* offset) { int error = SSL_get_error(ssl_, bytes); if (error == SSL_ERROR_WANT_READ) { // The caller will register for read event if not already. - return READ_BLOCKING; + if (errno == EWOULDBLOCK || errno == EAGAIN) { + return READ_BLOCKING; + } else { + return READ_ERROR; + } } else if (error == SSL_ERROR_WANT_WRITE) { // TODO: Even though we are attempting to read data, SSL_read() may // need to write data if renegotiation is being performed. We currently