[php-src] PR #14790: Fix test race condition
| From: | arnaud-lb | Date: | Wed, 03 Jul 2024 14:25:53 +0000 |
| Subject: | [php-src] PR #14790: Fix test race condition | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-26993@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/14790
Author: arnaud-lb
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 https://github.com/php/php-src/pull/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 https://github.com/php/php-src/commit/2aae14c8a97d37239298b7c939c0cca5daeb4c9a).