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

Avoid race condition for forked process in test suite #15

Merged
merged 1 commit into from
May 3, 2019

Conversation

clue
Copy link
Owner

@clue clue commented May 3, 2019

There's a very short race condition where the forked php process first
has to dup() the file descriptor specs before invoking exec() to
switch to the actual ssh child process. We don't need to wait for the
child process to be ready, but only for the forked process to close the
file descriptors. This happens ~80% of times on single core machines and
almost never on multi core systems, so simply wait 5ms (plenty of time!)
and retry again.

Builds on top of #7

There's a very short race condition where the forked php process first
has to `dup()` the file descriptor specs before invoking `exec()` to
switch to the actual `ssh` child process. We don't need to wait for the
child process to be ready, but only for the forked process to close the
file descriptors. This happens ~80% of times on single core machines and
almost never on multi core systems, so simply wait 5ms (plenty of time!)
and retry again.

Builds on top of clue#7
@clue clue added bug Something isn't working easy pick maintenance labels May 3, 2019
@clue clue added this to the v1.0.0 milestone May 3, 2019
@clue clue merged commit 58216c5 into clue:master May 3, 2019
@clue clue deleted the race branch May 3, 2019 14:27
clue added a commit to clue-labs/reactphp-ssh-proxy that referenced this pull request May 15, 2019
There's a very short race condition where the forked php process first
has to `dup()` the file descriptor specs before invoking `exec()` to
switch to the actual `ssh` child process. We don't need to wait for the
child process to be ready, but only for the forked process to close the
file descriptors. This happens ~80% of times on single core machines and
almost never on multi core systems, so simply wait 5ms (plenty of time!)
and retry again.

Builds on top of clue/reactphp-sqlite#15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working easy pick maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant