New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isOpen()/close() is racy. Simply close and ignore EBADF. #3093

Closed
wants to merge 1 commit into
base: jruby-1_7
from

Conversation

Projects
None yet
2 participants
@eam
Contributor

eam commented Jun 30, 2015

No description provided.

@eam

This comment has been minimized.

Show comment
Hide comment
@eam

eam Jun 30, 2015

Contributor

This fixes a race which can be hit within a few thousand iterations of:

loop do |i|
  IO.popen4('echo', 'hi') { |_, _, out, _| out.read }
end

I believe the descriptor is occasionally closed between the test of isOpen() and the close(), triggering the exception.

Contributor

eam commented Jun 30, 2015

This fixes a race which can be hit within a few thousand iterations of:

loop do |i|
  IO.popen4('echo', 'hi') { |_, _, out, _| out.read }
end

I believe the descriptor is occasionally closed between the test of isOpen() and the close(), triggering the exception.

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Jul 2, 2015

Member

I might feel better if we did both, actually, to avoid unnecessarily raising an error that gets ignored. The failed race would then be the only case that raises.

Member

headius commented Jul 2, 2015

I might feel better if we did both, actually, to avoid unnecessarily raising an error that gets ignored. The failed race would then be the only case that raises.

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Jul 2, 2015

Member

Thanks!

Member

headius commented Jul 2, 2015

Thanks!

@headius headius closed this Jul 2, 2015

@headius headius added this to the JRuby 1.7.21 milestone Jul 2, 2015

@headius headius added the core label Jul 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment