Skip to content

Socket.read(0) blocks caller (but not in MRI) #1637

@unclebilly

Description

@unclebilly

I found a discrepancy between how JRuby (1.7.12) and MRI (1.9.3, 2.1.1) read 0 bytes from a socket. Consider this example:

require 'socket'
socket = TCPSocket.new('127.0.0.1', 80)
socket.read(0)

In JRuby 1.7.12, this code blocks the caller.
In MRI 1.9.3 and 2.1.1, this code immediately returns an empty string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions