From 3d747e292c014115b2f087f1718b054cdcc1771d Mon Sep 17 00:00:00 2001 From: Robin Gustafsson Date: Sun, 22 Mar 2020 15:25:48 +0100 Subject: [PATCH] Avoid deadlock in test when sharing process group The testSharedGet test spawns child processes and waits for them to exit. The main process will wait for all child processes in its own process group. While this usually works, the processes involved in the test case are not necessarily the only processes in their process group. Should PHPUnit itself be executing in a child process, its parent process will also be there, causing a deadlock. This change will move the main test process into its own process group before forking to avoid the aforementioned situation. --- tests/Filesystem/FilesystemTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Filesystem/FilesystemTest.php b/tests/Filesystem/FilesystemTest.php index 176434e944d4..943a989af93f 100755 --- a/tests/Filesystem/FilesystemTest.php +++ b/tests/Filesystem/FilesystemTest.php @@ -448,6 +448,8 @@ public function testSharedGet() $content = str_repeat('123456', 1000000); $result = 1; + posix_setpgid(0, 0); + for ($i = 1; $i <= 20; $i++) { $pid = pcntl_fork();