Back

Error Msg: Could not resolve host: 65977b4bc3ce - exited container

  • 0
  • Self Hosted
  • Functions
Lucas Reis
5 Jan, 2024, 03:55

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?

TL;DR
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
5 Jan, 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
5 Jan, 2024, 05:17

What version of Appwrite?

Lucas Reis
5 Jan, 2024, 14:55

1.4.13

Drake
5 Jan, 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
5 Jan, 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
5 Jan, 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.

Lucas Reis
5 Jan, 2024, 20:04

the container

Drake
5 Jan, 2024, 20:22

FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting.

Drake
5 Jan, 2024, 20:24

weird...it still shouldn't exit...

Drake
5 Jan, 2024, 20:27

nvm...lol

Drake
5 Jan, 2024, 20:28

that's not how to coroutines work...can you create a github issue?

Lucas Reis
5 Jan, 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
5 Jan, 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
5 Jan, 2024, 20:29

well the crux of the problem is the exception causes the container to crash, but it shouldn't crash

Lucas Reis
8 Jan, 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
8 Jan, 2024, 04:28

Maybe you can try to make sure your code doesn't throw an exception

Lucas Reis
8 Jan, 2024, 05:46

I actually have a try catch inside my function but even Throwable does not seem to catch all errors in PHP

Drake
8 Jan, 2024, 05:49

Maybe something in your catch is throwing again?

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