Skip to content
Back

[SOLVED] Function executions need warmup

  • 0
  • Functions
  • Web
igrir
7 Aug, 2023, 22:49

Hm.. I didn't, but I did just started my computer from sleep

TL;DR
The user had an issue with function executions needing warm-up. A solution was provided to use keep-alive logic and change the function execution code to await. The user also had an issue with parallel requests, and a potential solution was to retry the function call if it returned an error message about a runtime already being created. Additionally, there was a mention of restarting Docker and checking logs for troubleshooting.
igrir
7 Aug, 2023, 22:51

I am thinking a workaround for this is when the executions failed and return the error with string "A runtime with the same ID is already being created. Attempt a execution soon" then I'll retry the call

igrir
7 Aug, 2023, 22:51

it's hacky, but I think it'll do 😂

Binyamin
7 Aug, 2023, 22:52

That can work But you can try is to run

TypeScript
docker rm -f 6494dc2f01d8060d6659-64cefbc7d4186d803f0d

That will remove the function container Then reload the infrastructure by running

TypeScript
docker compose down && docker compose up -d
Binyamin
7 Aug, 2023, 22:52

This may solve your problem

igrir
7 Aug, 2023, 22:56

I restarted the docker, looks like from 7 call it survived 5. the spinner ones failed to call the function

igrir
7 Aug, 2023, 22:57

and here's after I refreshed the page

Binyamin
7 Aug, 2023, 22:57

Are all those rows are requests to the same function?

igrir
7 Aug, 2023, 22:57

yes, each of those rows called the function

Binyamin
7 Aug, 2023, 23:01

Okay, So this could happened due to the fact Appwrite's calls itself. You may want to check the semi-solution provided in this issue https://github.com/appwrite/appwrite/issues/5629

Although it's a bit weird because in my case (Tried to replicate it) it didn't even pass the other requests.

igrir
7 Aug, 2023, 23:04

Oh right! That issue speaks what happened to me really well! I did call the function more than 3 times per second

igrir
7 Aug, 2023, 23:05

The solutions looks so strange 😂

Binyamin
7 Aug, 2023, 23:06

But it depends on the server strength, and yours (local) is pretty massive. Can you restart the docker Then run the page once to get the two infinity loaders, then run

TypeScript
docker logs appwrite
docker logs appwrite-executor

And share the results

igrir
7 Aug, 2023, 23:09

here's the results:

Binyamin
7 Aug, 2023, 23:23

What operation system you're using and how you've installed Docker

igrir
7 Aug, 2023, 23:25

for my local environment I am using Windows 11 (specifically it's version 22H2, build 22622.290). I installed docker by Docker Desktop for Windows

Binyamin
7 Aug, 2023, 23:29

Okay, I was able to recreate the error

Binyamin
7 Aug, 2023, 23:32

It goes like this If you're executing the function for the cold boot ( as any function is being shutdown after defined time) then it won't be able to handle more the X number of parallel requests.

The solution would be

igrir
7 Aug, 2023, 23:36

Oooh! Cool! so I can entered the cron job with */30 * * * * right? I'll definitely use it. I also already implemented the loop in my client side to recall the code maximum of 5 times everytime it returned failed status with 500ms delay, and it looks like kinda work. Not quite beautiful, but it works ❤️

igrir
7 Aug, 2023, 23:36

Thank you @Binyamin !

Binyamin
7 Aug, 2023, 23:37

<:appwritefire:823999000330895380>

joeyouss
8 Aug, 2023, 10:05

Hi @igrir , if this is fixed, shall I close this?

igrir
8 Aug, 2023, 10:06

I think it's somehow fixed. The one I made with looping client is not quite effective, but maybe the keep alive logic one will. Yes, you can close this, thanks @joeyouss !

joeyouss
8 Aug, 2023, 10:06

that was quickkk, thanks!

joeyouss
8 Aug, 2023, 10:06

[SOLVED] Function executions need warmup

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