R
Railway9mo ago
Dayblox

Scale to Zero: ELIFECYCLE  Command failed.

Just tried out the new Scale to Zero feature, appears to work well but upon sleeping the app logged ELIFECYCLE  Command failed. which showed the deploy as crashed.
Solution:
I'll have the fix merged on Monday 🙂
Jump to solution
23 Replies
Percy
Percy9mo ago
Project ID: 11bc459c-c00e-41c9-b774-5feb910b2982
Dayblox
Dayblox9mo ago
11bc459c-c00e-41c9-b774-5feb910b2982
JustJake
JustJake9mo ago
Hmm. What kind of application?
Dayblox
Dayblox9mo ago
Websocket server using ws You can checkout the code here https://github.com/dayblox/plot
GitHub
GitHub - dayblox/plot: WebSocket chatrooms server
WebSocket chatrooms server. Contribute to dayblox/plot development by creating an account on GitHub.
Dayblox
Dayblox9mo ago
(It is a template which you should be able to deploy and test)
JustJake
JustJake9mo ago
Hmm. I wonder if it expects you to terminate the streams gracefully (aka handle the kill) or it errors?
Dayblox
Dayblox9mo ago
Maybe, I'll try things out tomorrow, it's late I'll keep you updated Thanks for your time!
JustJake
JustJake9mo ago
Of course and please do! This is why it's PB; there might be stuff like this that we can fix 😄
Dayblox
Dayblox9mo ago
Happy to contribute 👌
Mig
Mig9mo ago
Hey, thanks for reporting this @Dayblox. I'll try to reproduce the issue. It is interesting that it sleeps correctly but then crashes on start. The sleep and awake code are just stop and start commands without any severe signals like sigkill so the container does have time to shut down. It seems to be some issue related to node_modules maybe from what I've searched so far.
Brody
Brody9mo ago
spun up a test app, after 30 minutes the sigterm signal was sent and the app was given 3 seconds before being force killed, same thing happens when a container is removed because a new deployment went live, restarts also get a sigterm, but they get 15 seconds to clean up before being force killed
Mig
Mig9mo ago
I can reproduce this locally so that's good. I've noticed even just restarting the container (no application sleep code) causes it to crash on next boot. The reason the dashboard is showing container crashed is because when the sleep code stops the container it exits with a non-zero exit code. I think the sleep code shouldn't trigger this reaction on the dashboard though because when you receive traffic, the container will be started like normal so it's basically just a docker event that shouldn't have been shown. I'll fix that but just know everything was still working, the UI was just confusing. btw, I think the plot code should also handle termination signals better. For example, when I just run the application without any docker container it exits with a non-zero exit code. I also get the ELIFECYCLE  Command failed. error.
PORT=5555 pnpm start

> plot@1.0.0 start /Users/mig/Projects/plot
> node dist

^C ELIFECYCLE  Command failed.


echo $?
130
PORT=5555 pnpm start

> plot@1.0.0 start /Users/mig/Projects/plot
> node dist

^C ELIFECYCLE  Command failed.


echo $?
130
Dayblox
Dayblox9mo ago
Agreed on both counts! My code should handle graceful termination and the dashboard should not show a crashed state in the case of Scale to Zero error codes Thanks again for the reactivity and hard work 👌 Just realized you said you would fix it, cool!
Solution
Mig
Mig9mo ago
I'll have the fix merged on Monday 🙂
Dayblox
Dayblox9mo ago
How do I mark the topic as solved in here?
Dayblox
Dayblox9mo ago
Oh just saw the option
Brody
Brody9mo ago
for future reference, open the context menu for the message you'd like to mark as the solution -> apps -> mark solution
Dayblox
Dayblox9mo ago
Is there a way for us to see and follow the issues?
Brody
Brody9mo ago
mig will probably just come back here and tell us what's up
Mig
Mig9mo ago
I got a PR up for it. Will be merging it today and i'll report back here salute
JustJake
JustJake9mo ago
He merged it 30 minutes ago (If y’all wanna check)
Dayblox
Dayblox9mo ago
I'll check later today, thanks! It's working fine now, thanks @Mig !
Mig
Mig9mo ago
great! thanks for reporting this, very valid feedback that improved the product 🙂