Skip to content
Back

Realtime Begin a bit flaky

  • 0
  • Self Hosted
  • Realtime
Noss
28 Jun, 2024, 15:48

I am currently testing around with realtime. I setup a second server with Dragonfly instead of Redis and I am now performance and stress testing a bit. But doing so the main Appwrite server gets kind of overwelmed even though the Dragonfly Server is kind of chilling its life. Furthermore the Realtime container is screaming errors in my face like:

TypeScript
Fatal error: Uncaught Swoole\Error: Socket#115 has already been bound to another coroutine#3, reading of the same socket in coroutine#8 at the same time is not allowed in /usr/src/code/app/init.php:861
Stack trace:
#0 /usr/src/code/app/init.php(861): PDO->__construct('mysql:host=mari...', 'user', Object(SensitiveParameterValue), Array)
#1 @swoole/library/core/Database/PDOProxy.php(33): {closure}()
#2 /usr/src/code/app/init.php(860): Swoole\Database\PDOProxy->__construct(Object(Closure))
#3 /usr/src/code/app/init.php(888): {closure}()
#4 /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php(189): {closure}()
#5 /usr/src/code/app/realtime.php(90): Utopia\Pools\Pool->pop()
#6 /usr/src/code/app/realtime.php(456): getProjectDB(Object(Utopia\Database\Document))
#7 [internal function]: {closure}(70136, Object(Appwrite\Utopia\Request))
#8 /usr/src/code/vendor/utopia-php/websocket/src/WebSocket/Adapter/Swoole.php(93): call_user_func(Object(Closure), 70136, Object(Swoole\Http\Request))
#9 [internal function]: Utopia\WebSocket\Adapter\Swoole->Utopia\WebSocket\Adapter\{closure}(Object(Swoole\WebSocket\Server), Object(Swoole\Http\Request))
#10 {main}
  thrown in /usr/src/code/app/init.php on line 861

Sometimes:

TypeScript
[Error] Message: Missing or unknown project ID
Connection open (user: 71435)
[Error] File: /usr/src/code/app/realtime.php
[Error] Line: 445
Pub/sub connection established (worker: 0)
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception

or:

TypeScript
[2024-06-28 15:44:11 $7.0]      WARNING Server::check_worker_exit_status(): worker(pid=11585, id=21) abnormal exit, status=255, signal=0
Connection open (user: 71827)
Connection open (user: 71590)
[Error] Message: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.
[Error] Message: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.
[Error] Message: Missing or unknown project ID
TL;DR
Developers encountering various error messages in Realtime container such as pool size issues, abnormal worker exits, unbuffered queries, and unknown project IDs. The issue might be related to conflicting coroutines or missing project identifier. Check socket bindings, handle unbuffered queries properly, and ensure all project IDs are valid in the code. Additionally, consider reporting bugs to Swoole developers for potential fixes.
Noss
28 Jun, 2024, 15:48

or

TypeScript
[Error] Type: Exception
[Error] Type: Exception
Connection open (user: 70481)
[Error] Type: Exception
[Error] Type: Exception
[Error] Type: Exception
Connection open (user: 70475)
[Error] Type: Exception
Connection open (user: 70474)
[Error] Type: Exception
Connection open (user: 71636)
[Error] File: @swoole/library/core/Database/PDOStatementProxy.php
[Error] File: @swoole/library/core/Database/PDOStatementProxy.php
[Error] File: /usr/src/code/app/realtime.php
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
Noss
28 Jun, 2024, 15:49

or

TypeScript
Connection open (user: 71994)
[2024-06-28 15:44:11 $7.0]      WARNING Server::check_worker_exit_status(): worker(pid=11619, id=11) abnormal exit, status=0, signal=11
A bug occurred in Swoole-v5.1.2, please report it.
The Swoole developers probably don't know about it,
and unless you report it, chances are it won't be fixed.
You can read How to report a bug doc before submitting any bug reports:
>> https://github.com/swoole/swoole-src/blob/master/.github/ISSUE.md
Please do not send bug reports in the mailing list or personal letters.
The issue page is also suitable to submit feature requests.

OS: Linux 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
GCC_VERSION: 13.2.1 20231014
OPENSSL_VERSION: OpenSSL 3.1.4 24 Oct 2023
PHP_VERSION : 8.3.3
Noss
28 Jun, 2024, 15:49

or

TypeScript
Noss
28 Jun, 2024, 15:50

big red blocks of:

TypeScript
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] Message: Pool 'cache_redis_main' is empty (size 10)
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
Connection open (user: 72346)
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
[Error] Line: 174
[Error] Line: 174
[Error] Line: 174
[Error] Line: 174
[Error] Line: 174
[Error] Line: 174
[Error] Line: 174
[Error] Line: 174
[Error] Line: 174

xD

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more