Skip to content

Commit 21fa734

Browse files
committed
Fix run-tests worker startup timeout
1 parent b520b73 commit 21fa734

4 files changed

Lines changed: 76 additions & 15 deletions

File tree

php/BuildPhp/config/run-tests/run-tests-7.4.patch

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
continue;
5050
}
5151

52-
@@ -1336,12 +1337,280 @@
52+
@@ -1336,12 +1337,284 @@
5353
}
5454
if ($result_tests_file) {
5555
fwrite($result_tests_file, "$result\t$index\n");
@@ -58,6 +58,10 @@
5858
+ }
5959
+}
6060
+
61+
+if (!defined('BUILD_PHP_WORKER_STARTUP_TIMEOUT')) {
62+
+ define('BUILD_PHP_WORKER_STARTUP_TIMEOUT', 30);
63+
+}
64+
+
6165
+if (!function_exists('buildphp_worker_recovery_format_test_index')) {
6266
+ function buildphp_worker_recovery_has_object_junit()
6367
+ {
@@ -245,7 +249,7 @@
245249
+ return false;
246250
+ }
247251
+
248-
+ $workerSock = stream_socket_accept($listenSock, 5);
252+
+ $workerSock = stream_socket_accept($listenSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
249253
+ if ($workerSock === false) {
250254
+ proc_terminate($proc);
251255
+ return false;
@@ -260,7 +264,7 @@
260264
+ ]
261265
+ ])) . "\n";
262266
+
263-
+ stream_set_timeout($workerSock, 5);
267+
+ stream_set_timeout($workerSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
264268
+ if (fwrite($workerSock, $greeting) === false) {
265269
+ fclose($workerSock);
266270
+ proc_terminate($proc);
@@ -339,6 +343,12 @@
339343

340344
echo "=====================================================================\n";
341345
echo "========= WELCOME TO THE FUTURE: run-tests PARALLEL EDITION =========\n";
346+
@@ -1440,4 +1712,4 @@
347+
- $workerSock = stream_socket_accept($listenSock, 5);
348+
+ $workerSock = stream_socket_accept($listenSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
349+
if ($workerSock === FALSE) {
350+
kill_children($workerProcs);
351+
error("Failed to accept connection from worker $i");
342352
@@ -1450,10 +1719,6 @@
343353
"constants" => [
344354
"INIT_DIR" => INIT_DIR,
@@ -350,6 +360,12 @@
350360
]
351361
])) . "\n";
352362

363+
@@ -1460,4 +1725,4 @@
364+
- stream_set_timeout($workerSock, 5);
365+
+ stream_set_timeout($workerSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
366+
if (fwrite($workerSock, $greeting) === FALSE) {
367+
kill_children($workerProcs);
368+
error("Failed to send greeting to worker $i.");
353369
@@ -1496,6 +1761,15 @@
354370

355371
escape:
@@ -521,4 +537,3 @@
521537
+ $SUITE['files'] = array_replace($SUITE['files'], $suite['files']);
522538
}
523539
}
524-

php/BuildPhp/config/run-tests/run-tests-8.0.patch

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@
4949
continue;
5050
}
5151

52-
@@ -1385,6 +1386,273 @@
52+
@@ -1385,6 +1386,277 @@
5353
/** The heart of parallel testing.
5454
* @param string|array|null $redir_tested
5555
*/
56+
+if (!defined('BUILD_PHP_WORKER_STARTUP_TIMEOUT')) {
57+
+ define('BUILD_PHP_WORKER_STARTUP_TIMEOUT', 30);
58+
+}
59+
+
5660
+if (!function_exists('buildphp_worker_recovery_format_test_index')) {
5761
+ function buildphp_worker_recovery_has_object_junit()
5862
+ {
@@ -240,7 +244,7 @@
240244
+ return false;
241245
+ }
242246
+
243-
+ $workerSock = stream_socket_accept($listenSock, 5);
247+
+ $workerSock = stream_socket_accept($listenSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
244248
+ if ($workerSock === false) {
245249
+ proc_terminate($proc);
246250
+ return false;
@@ -255,7 +259,7 @@
255259
+ ]
256260
+ ])) . "\n";
257261
+
258-
+ stream_set_timeout($workerSock, 5);
262+
+ stream_set_timeout($workerSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
259263
+ if (fwrite($workerSock, $greeting) === false) {
260264
+ fclose($workerSock);
261265
+ proc_terminate($proc);
@@ -332,6 +336,12 @@
332336

333337
echo "=====================================================================\n";
334338
echo "========= WELCOME TO THE FUTURE: run-tests PARALLEL EDITION =========\n";
339+
@@ -1491,4 +1762,4 @@
340+
- $workerSock = stream_socket_accept($listenSock, 5);
341+
+ $workerSock = stream_socket_accept($listenSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
342+
if ($workerSock === false) {
343+
kill_children($workerProcs);
344+
error("Failed to accept connection from worker.");
335345
@@ -1500,10 +1768,6 @@
336346
"constants" => [
337347
"INIT_DIR" => INIT_DIR,
@@ -343,6 +353,12 @@
343353
]
344354
])) . "\n";
345355

356+
@@ -1510,4 +1771,4 @@
357+
- stream_set_timeout($workerSock, 5);
358+
+ stream_set_timeout($workerSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
359+
if (fwrite($workerSock, $greeting) === false) {
360+
kill_children($workerProcs);
361+
error("Failed to send greeting to worker.");
346362
@@ -1545,6 +1809,15 @@
347363

348364
escape:
@@ -514,4 +530,3 @@
514530
+ $SUITE['files'] = array_replace($SUITE['files'], $suite['files']);
515531
}
516532
}
517-

php/BuildPhp/config/run-tests/run-tests-8.1.patch

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
--- run-tests.php
22
+++ run-tests.php
3-
@@ -143,6 +143,275 @@
3+
@@ -143,6 +143,279 @@
44
* code that was previously found at the top level. It could and should be
55
* refactored to be smaller and more manageable.
66
*/
7+
+if (!defined('BUILD_PHP_WORKER_STARTUP_TIMEOUT')) {
8+
+ define('BUILD_PHP_WORKER_STARTUP_TIMEOUT', 30);
9+
+}
10+
+
711
+if (!function_exists('buildphp_worker_recovery_format_test_index')) {
812
+ function buildphp_worker_recovery_has_object_junit()
913
+ {
@@ -193,7 +197,7 @@
193197
+ return false;
194198
+ }
195199
+
196-
+ $workerSock = stream_socket_accept($listenSock, 5);
200+
+ $workerSock = stream_socket_accept($listenSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
197201
+ if ($workerSock === false) {
198202
+ proc_terminate($proc);
199203
+ return false;
@@ -208,7 +212,7 @@
208212
+ ]
209213
+ ])) . "\n";
210214
+
211-
+ stream_set_timeout($workerSock, 5);
215+
+ stream_set_timeout($workerSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
212216
+ if (fwrite($workerSock, $greeting) === false) {
213217
+ fclose($workerSock);
214218
+ proc_terminate($proc);
@@ -334,6 +338,12 @@
334338

335339
// Each test may specify a list of conflict keys. While a test that conflicts with
336340
// key K is running, no other test that conflicts with K may run. Conflict keys are
341+
@@ -1524,4 +1797,4 @@
342+
- $workerSock = stream_socket_accept($listenSock, 5);
343+
+ $workerSock = stream_socket_accept($listenSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
344+
if ($workerSock === false) {
345+
kill_children($workerProcs);
346+
error("Failed to accept connection from worker.");
337347
@@ -1533,10 +1803,6 @@
338348
"constants" => [
339349
"INIT_DIR" => INIT_DIR,
@@ -345,6 +355,12 @@
345355
]
346356
])) . "\n";
347357

358+
@@ -1543,4 +1809,4 @@
359+
- stream_set_timeout($workerSock, 5);
360+
+ stream_set_timeout($workerSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
361+
if (fwrite($workerSock, $greeting) === false) {
362+
kill_children($workerProcs);
363+
error("Failed to send greeting to worker.");
348364
@@ -1578,6 +1844,15 @@
349365

350366
escape:
@@ -508,4 +524,3 @@
508524
+ $dest['files'] = array_replace($dest['files'], $source['files']);
509525
}
510526
}
511-

php/BuildPhp/config/run-tests/run-tests-8.2-plus.patch

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
--- run-tests.php
22
+++ run-tests.php
3-
@@ -140,6 +140,288 @@
3+
@@ -140,6 +140,292 @@
44
* code that was previously found at the top level. It could and should be
55
* refactored to be smaller and more manageable.
66
*/
7+
+if (!defined('BUILD_PHP_WORKER_STARTUP_TIMEOUT')) {
8+
+ define('BUILD_PHP_WORKER_STARTUP_TIMEOUT', 30);
9+
+}
10+
+
711
+if (!function_exists('buildphp_worker_recovery_format_test_index')) {
812
+ function buildphp_worker_recovery_has_object_junit()
913
+ {
@@ -206,7 +210,7 @@
206210
+ return false;
207211
+ }
208212
+
209-
+ $workerSock = stream_socket_accept($listenSock, 5);
213+
+ $workerSock = stream_socket_accept($listenSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
210214
+ if ($workerSock === false) {
211215
+ proc_terminate($proc);
212216
+ return false;
@@ -221,7 +225,7 @@
221225
+ ]
222226
+ ])) . "\n";
223227
+
224-
+ stream_set_timeout($workerSock, 5);
228+
+ stream_set_timeout($workerSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
225229
+ if (fwrite($workerSock, $greeting) === false) {
226230
+ fclose($workerSock);
227231
+ proc_terminate($proc);
@@ -347,6 +351,18 @@
347351

348352
// Each test may specify a list of conflict keys. While a test that conflicts with
349353
// key K is running, no other test that conflicts with K may run. Conflict keys are
354+
@@ -1423,4 +1694,4 @@
355+
- $workerSock = stream_socket_accept($listenSock, 5);
356+
+ $workerSock = stream_socket_accept($listenSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
357+
if ($workerSock === false) {
358+
kill_children($workerProcs);
359+
error("Failed to accept connection from worker.");
360+
@@ -1438,4 +1709,4 @@
361+
- stream_set_timeout($workerSock, 5);
362+
+ stream_set_timeout($workerSock, BUILD_PHP_WORKER_STARTUP_TIMEOUT);
363+
if (fwrite($workerSock, $greeting) === false) {
364+
kill_children($workerProcs);
365+
error("Failed to send greeting to worker.");
350366
@@ -1486,6 +1756,15 @@
351367

352368
escape:

0 commit comments

Comments
 (0)