From: Tanaka Akira Date: 2013-09-08T07:01:19+09:00 Subject: [ruby-core:57064] Re: [ruby-trunk - Bug #8875] Select is not usable with SSLSocket 2013/9/8 headius (Charles Nutter) : > In JRuby, my first fix was to make IO.select aware of SSLSocket's native buffers by adding a method to query if SSLSocket had buffered data itself. This adds the socket to the list of pending read streams and does not attempt to do a blocking select on it. This fixes the simple issue of sysread/sysread_nonblock reading more data than requested and potentially draining the stream and allows select to work correctly. I think the right fix is that application uses read_nonblock before select. See the document of IO#read_nonblock and OpenSSL::Buffering#read_nonblock. I wrote this problem in [ruby-core:38681]. > However, the buffering issue is harder to fix. I believe buffering.rb needs to go away entirely, or at least needs to not buffer data on its own. OpenSSL::Buffering#gets may be difficult to implement efficiently without buffering. -- Tanaka Akira