mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-11-07 11:03:41 +01:00
The shipped nginx is statically linked. At a worker's graceful exit, exit() runs the global destructors, which deregister the binary's unwind tables (__deregister_frame_info_bases), while the thread pool's threads are still unwinding out of pthread_exit(): ngx_thread_pool_destroy() waits for each thread's flag, set just before pthread_exit(), not for the thread. A thread that finds no frame info aborts (uw_init_context_1 -> abort). A core from the test MAIN shows both stacks; nginx's error.log called it 'worker process ... exited on signal 6', about one reload in eleven (9 in 100 under traffic). The pool did no work anyway: max_queue=0 refused every task, so aio threads never ran. Both nginx.conf files drop thread_pool and aio threads; segments still go out by sendfile.
27 lines
1.2 KiB
PHP
27 lines
1.2 KiB
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* No nginx thread pool. The shipped nginx is statically linked: at a
|
|
* worker's graceful exit, exit() runs the global destructors, which
|
|
* deregister the binary's unwind tables (__deregister_frame_info_bases),
|
|
* while the pool's threads are still unwinding out of pthread_exit()
|
|
* (ngx_thread_pool_destroy() waits for each thread's flag, set just before
|
|
* pthread_exit(), not for the thread). A thread that finds no frame info
|
|
* aborts: signal 6 in "worker process is shutting down", about one reload
|
|
* in eleven on the test MAIN (a core shows the two stacks). The pool did no
|
|
* work anyway: max_queue=0 refused every task.
|
|
*/
|
|
final class NginxNoThreadPoolTest extends TestCase {
|
|
public function testNoThreadPoolOrThreadedAio(): void {
|
|
$rRoot = dirname(__DIR__, 2);
|
|
foreach (['src/bin/nginx/conf/nginx.conf', 'lb_configs/nginx.conf'] as $rFile) {
|
|
$rConf = (string) file_get_contents($rRoot . '/' . $rFile);
|
|
$this->assertDoesNotMatchRegularExpression('/^\s*thread_pool\b/m', $rConf, $rFile);
|
|
$this->assertDoesNotMatchRegularExpression('/^\s*aio\s+threads\b/m', $rConf, $rFile);
|
|
$this->assertMatchesRegularExpression('/^\s*sendfile on;$/m', $rConf, $rFile . ': segments still go out by sendfile');
|
|
}
|
|
}
|
|
}
|