SI-6488: Fix for race with open I/O fds #1522

Merged
merged 1 commit into from Oct 31, 2012

Conversation

Projects
None yet
3 participants

Unless the I/O threads for error and output are closed prior to Process.destroy() there is a potential race condition that ends in the I/O threads raising an IOException.

Added test case and resubmitted against 2.10.x

CLA also signed and confirmed.

Supersedes #1484 which may now be closed.

...as usual works for me fails in CI. Pointers on a reliable way to get the current scala runtime and the path to the compiled Test object would be welcome from a test would be much appreciated.

Member

jsuereth commented Oct 24, 2012

You can't make any assumptions about what is available on the path in this test, sorry. We run on both windows + linux, and the current test will break many environments.

I think the best you can do is try the test, but not fail if the command is not found.

Can't I assume we have a scala runtime and the compiled test itself? This test really only requires those and the correct path to those.
My assumption was that with those I could ensure that this test did work in a portable way, not relying on anything in the environment.

Test case revised as suggested by @jsuereth. How do I provoke another CI run?

@jsuereth jsuereth commented on the diff Oct 25, 2012

test/files/run/t6488.scala
@@ -0,0 +1,11 @@
+import sys.process._
+object Test {
+ // Program that prints "Success" if the command was successfully run then destroyed
+ // It will silently pass if the command "/bin/ls" does not exist
+ // It will fail due to the uncatchable exception in t6488 race condition
@jsuereth

jsuereth Oct 25, 2012

Member

Awesome comment!

Member

jsuereth commented Oct 25, 2012

So, this LGTM. Any chance I can get you to git rebase -i and mark all but the first commit as 'fixup' so we get one solid commit? The intermediate broken commits can mess up our tooling.

THANKS MUCH for the patch. good work!

Ready to go with the rebase. Anything else you need from me? or shall I start looking for more bugs? ;-)

Member

jsuereth commented Oct 31, 2012

Yeah, lgtm

@jsuereth jsuereth added a commit that referenced this pull request Oct 31, 2012

@jsuereth jsuereth Merge pull request #1522 from possiblywrong/2.10.x
SI-6488: Fix for race with open I/O fds
1f9124b

@jsuereth jsuereth merged commit 1f9124b into scala:2.10.x Oct 31, 2012

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