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

[Process] Fix potential race condition #17276

Merged
merged 1 commit into from Jan 6, 2016

Conversation

nicolas-grekas
Copy link
Member

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

As seen at https://travis-ci.org/symfony/symfony/jobs/100448880#L2768, ProcessTest::testRunProcessWithTimeout can create an infinite blocking situation.
I found two potential code paths that could be subject to a race condition. This fixes them.

$timeout = 0.1;
$process = $this->getProcess(self::$phpBin.' -r "sleep(1);"');
$process->setTimeout($timeout);
$process = $this->getProcess(self::$phpBin.' -r "sleep(30);"');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fixes a transient test

@nicolas-grekas nicolas-grekas force-pushed the fix-race branch 17 times, most recently from bcf4ad3 to 1768a92 Compare January 6, 2016 09:06
@nicolas-grekas
Copy link
Member Author

Looks good, I triggered a bunch of builds without any failure so far

@stof
Copy link
Member

stof commented Jan 6, 2016

looks good to me. 👍

@romainneutron
Copy link
Contributor

LGTM 👍

@nicolas-grekas nicolas-grekas merged commit b114a85 into symfony:2.3 Jan 6, 2016
nicolas-grekas added a commit that referenced this pull request Jan 6, 2016
This PR was merged into the 2.3 branch.

Discussion
----------

[Process] Fix potential race condition

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

As seen at https://travis-ci.org/symfony/symfony/jobs/100448880#L2768, ProcessTest::testRunProcessWithTimeout can create an infinite blocking situation.
I found two potential code paths that could be subject to a race condition. This fixes them.

Commits
-------

b114a85 [Process] Fix potential race condition
@nicolas-grekas nicolas-grekas deleted the fix-race branch January 6, 2016 09:58
This was referenced Jan 14, 2016
@fabpot fabpot mentioned this pull request Jan 14, 2016
@fabpot fabpot mentioned this pull request Feb 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants