Skip to content
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 from

Conversation

eam
Copy link
Contributor

@eam eam commented Jun 30, 2015

No description provided.

@eam
Copy link
Contributor Author

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
Copy link
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
Copy link
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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants