I am facing a weird situation here. If for some reason I don't handle an exception thrown by my PHP function, the executor container will move to the exited docker state and will not process any other request.
If I manually restart the container it will start processing requests again.
Shouldn't it have the always restarting policy?
Summary
User is experiencing an error where the executor container is exiting and not processing requests when an exception is not handled in their PHP function. Manually restarting the container resolves the issue temporarily. The suggested solution is to ensure that the code does not throw an exception. The user also mentions getting a time out error or "could not resolve host" error when making another request after the exception is thrown. It is suggested to create a GitHub issue for further assistance. The user later identifies that the issue is caused by passing an empty string instead of an array to a method. The error message and stack trace are provided. The issue is with the container exiting
Lucas Reis
Rank 1: Thread
Jan 5, 2024, 05:13
One thing I noticed is that after several minutes it will create another container and then the requests will start to get processed again.
Drake
Jan 5, 2024, 05:17
What version of Appwrite?
Lucas Reis
Rank 2: Process
Jan 5, 2024, 14:55
1.4.13
Drake
Jan 5, 2024, 16:45
sooo the container shouldn't exit, even if your function throws an exception...can you try to check the runtime container logs?
Lucas Reis
Rank 2: Process
Jan 5, 2024, 20:02
here it is:
Preparing for start ... Starting ... Warning: foreach() argument must be of type array|object, null given in /usr/local/server/src/server.php on line 86 [2024-01-05 19:58:52 *9.0] ERROR php_swoole_server_rshutdown() (ERRNO 503): Fatal error: Uncaught TypeError: ValidateBody::__invoke(): Argument #1 ($body) must be of type array, string given, called in /usr/local/server/src/function/src/index.php on line 11 and defined in /usr/local/server/src/function/src/Actions/ValidateBody.php:4 Stack trace: #0 /usr/local/server/src/function/src/index.php(11): ValidateBody->__invoke('') #1 /usr/local/server/src/server.php(190): {closure}(Object(SSAWeb\AppwriteTestUtils\Context)) #2 /usr/local/server/src/server.php(199): {closure}() #3 @swoole/library/core/Coroutine/functions.php(43): {closure}() #4 [internal function]: Swoole\Coroutine\{closure}() } thrown in /usr/local/server/src/function/src/Actions/ValidateBody.php on line 4
Lucas Reis
Rank 2: Process
Jan 5, 2024, 20:04
it failed because the signature of the method is:
public function __invoke(array $body)
and it failed because I called it passing nothing in the body therefore it's empty and is not an array.
that's not how to coroutines work...can you create a github issue?
Lucas Reis
Rank 2: Process
Jan 5, 2024, 20:28
so when the exception is throw I got the following in console:
An internal curl error has occurred within the executor! Error Msg: Connection reset by peer\nError Code: 500
Lucas Reis
Rank 2: Process
Jan 5, 2024, 20:29
and if I make another request sometimes I will get a time out error and sometimes I get thw following: ```An internal curl error has occurred within the executor! Error Msg: Could not resolve host: 6598662f5ae7b\nError Code: 500
Drake
Jan 5, 2024, 20:29
well the crux of the problem is the exception causes the container to crash, but it shouldn't crash
Lucas Reis
Rank 2: Process
Jan 8, 2024, 04:08
do you have any idea of what I could do as a workaround? I was thinking about looking for a way to assign a global restart policy for those containers (not sure if it's doable)
Drake
Jan 8, 2024, 04:28
Maybe you can try to make sure your code doesn't throw an exception
Lucas Reis
Rank 2: Process
Jan 8, 2024, 05:46
I actually have a try catch inside my function but even Throwable does not seem to catch all errors in PHP