Skip to content

Fix test race condition #14790

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

Closed
wants to merge 1 commit into from
Closed

Conversation

arnaud-lb
Copy link
Member

There is a race condition in https://github.com/php/php-src/blob/ec277ce7fe1e7b7f98e270198826fc1432cdcb3d/ext/openssl/tests/gh13860.phpt: If the first fread($fp, 2); (line 36) is executed after fwrite($client, "xx");, the test hangs indefinitely in the loop: https://github.com/php/php-src/blob/ec277ce7fe1e7b7f98e270198826fc1432cdcb3d/ext/openssl/tests/gh13860.phpt#L39C1-L41C6

I've observed this on Alpine with a ZTS + ASAN build, in #13925, but adding a sleep() before the first fread() will also reproduce the issue.

Moving the phpt_wait() before fwrite() fixes the hang by ensuring that fread($fp, 2); executes before fwrite(). However I'm not sure this is still testing the right thing (although the test fails if I revert 2aae14c).

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

Good catch, the modified test should catch the issue as well. Note that the test also exists on lower versions.

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.

2 participants