SIGTERM on App Start with Elixir/Nostrum

dougalcorn
PRO

3 months ago

I'm deploying an elixir application that uses Nostrum to implement a discord bot. I have put in a ton of logging. There are 5 children processes in my main application GenServer. Four of them get started just fine. I have logging messages when the child processes are started. The Nostrum process never logs that it's starting. The supervisor logs after it thinks it has started all the children.

Almost immediately after that I get a log message saying:

Mar 17 10:30:59stingbatbot-ex 14:30:55.076 [notice] SIGTERM received - shutting down

Mar 17 10:31:01stingbatbot-ex Stopping Container

But then after that, I still get messages logged from a keep-alive process I have saying the application is still running.

I've been fighting this for two days and I have no idea what to do. Everything runs fine in local dev. I guess my next thing to try is moving to another hosting provider.

Solved

4 Replies

3 months ago

Hi, we only send a SIGTERM event when shutting down an old deploy and rolling out a new one. seems everything is running now, did you figure out the issue ?


Status changed to Awaiting User Response railway[bot] 3 months ago


dougalcorn
PRO

3 months ago

No, the app is "running", but the Nostrum threads/process aren't connecting to my consumer. I think it's actually connecting to Discord, but my consumer isn't processing any messages. I can run it locally in dev mode and it works as expected. I can run it locally in prod mode and it works as expected. I can't get it to work here on railway. Every time I deploy, I get my expected log messages except for the one where the consumer thread says, "Bot is ready." And then I immediately get a SIGTERM and a message about shutting down. The application appears to still be running even though it never responds to anything from Discord. I can't tell where the SIGTERM is coming from or what's shutting down or why the Nostrum consumer isn't starting.

I would love to get this solved, but I don't have anything else to try. I'm completely blocked. I'm going to see if it behaves the same way on fly.io.


Status changed to Awaiting Railway Response railway[bot] 3 months ago


railway[bot]

3 months ago

This thread has been escalated internally. We'll be in touch with you once we hear back from the team.

Status changed to In Progress railway[bot] 3 months ago


dougalcorn
PRO

3 months ago

If you speak elixir, here's a gist of my main application and the nostrum consumer: https://gist.github.com/dougalcorn/15f58ee123b83aa212fe6c295277d3a8


dougalcorn
PRO

3 months ago

No worries, I got the app running on gigalixir.


Status changed to Awaiting Railway Response railway[bot] 3 months ago


Status changed to Solved brody 3 months ago