mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Fix coroutine starvation: scale pools to coroutine count, serialize SMTP workers
Two CI failure causes: - Connection pools are sized for HTTP-server worker counts and came out at 1 per worker process; 8 consume coroutines exhausted them (Pool 'cache_redis_main' is empty). Floor the pool size at _APP_WORKER_MAX_COROUTINES. - The mails and messaging workers disable the Swoole TCP hook at runtime to work around the TLS handshake crash (swoole-src#4909, #7914). The flag is process-global, so after the first job every blocking Redis pop freezes the coroutine scheduler and deliveries arrive minutes late. Both workers stay at 1 coroutine, matching pre-coroutine behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
b53268a4dd
commit
4baaa7d93f
2 files changed
+6
-2
No files matched your search
@@ -254,6 +254,10 @@ $register->set('pools', function () {
|
||||
$workerCount = intval(System::getEnv('_APP_CPU_NUM', swoole_cpu_num())) * intval(System::getEnv('_APP_WORKER_PER_CORE', 6));
|
||||
$poolSize = max(1, (int)($instanceConnections / $workerCount));
|
||||
|
||||
// Queue workers consume jobs concurrently with coroutines; each in-flight
|
||||
// job may hold a connection, so pools must cover the coroutine count.
|
||||
$poolSize = max($poolSize, (int) System::getEnv('_APP_WORKER_MAX_COROUTINES', 1));
|
||||
|
||||
foreach ($connections as $key => $connection) {
|
||||
$type = $connection['type'];
|
||||
$multiple = $connection['multiple'];
|
||||
|
||||
+2
-2
@@ -800,7 +800,7 @@ services:
|
||||
environment:
|
||||
- _APP_ENV
|
||||
- _APP_WORKERS_NUM=1
|
||||
- _APP_WORKER_MAX_COROUTINES=8
|
||||
- _APP_WORKER_MAX_COROUTINES=1
|
||||
- _APP_WORKER_PER_CORE
|
||||
- _APP_POOL_ADAPTER
|
||||
- _APP_OPENSSL_KEY_V1
|
||||
@@ -843,7 +843,7 @@ services:
|
||||
environment:
|
||||
- _APP_ENV
|
||||
- _APP_WORKERS_NUM=1
|
||||
- _APP_WORKER_MAX_COROUTINES=8
|
||||
- _APP_WORKER_MAX_COROUTINES=1
|
||||
- _APP_WORKER_PER_CORE
|
||||
- _APP_POOL_ADAPTER
|
||||
- _APP_OPENSSL_KEY_V1
|
||||
|
||||
Reference in new issue
Block a user