Container dying after start

2 years ago

First: I am trying to start a server written in rust with env_logger. Railway does not recognize the log format. In the docs https://docs.railway.app/guides/logs#command-line a example of rust env_logging is used. Is this example not supported anymore?

Second: The container dies/gets stopped and sends a SIGTERMN to actix-web. What could be the reason that my container dies?

Thanks for all the help

19 Replies

2 years ago

Logs sent to stderr will be regarded as an error even if you have INFO text in the message, I would recommend logging info type messages to stdout or use JSON structured logging with a level attribute.

Railway will not send any kind of sigterm signal to your app if it logs to stderr.


2 years ago

Okay, thanks. I did not notice that logs end up in stderr. The reason for container stopping is still a mistery.


2 years ago

A Stopping Container message does not necessarily mean Railway has stopped your container, it is just a general message when the container is stopping, for example if your app exited.


2 years ago

I have to try some different settings, but switching to legacy runtime does not work either. Probably the container uses to much memory or resources and stops itself. I would not expect that from rust :)


2 years ago

I still can't figure out why the container dies. The app does not terminate early. The container stops before the app exits. Am I over the resource limit? Could the os (alpine) die because of os errors? Locally the docker container runs flawlessly.


2 years ago

I still can't figure out why the container dies. The app does not terminate early. The container stops before the app exits. Am I over the resource limit? Could the os (alpine) die because of os errors? Locally the docker container runs flawlessly.

I have removed everything except for the web server and the container still dies. The alpine image is very lightweight and should no run into resource limits? Any idea why railway terminates my container after a healthy healthcheck? Thanks


2 years ago

Any idea why railway terminates my container

As mentioned that message does not necessarily mean Railway stopped the container.

Try catching sigterm.


2 years ago

Ok, thanks. I try that.


2 years ago

I now handle sigterm and do not stop my app. But railway just kills my container. So I am still out of luck. Do you have any other idea?


2 years ago

But railway just kills my container.

Again, that message does not necessarily mean Railway stopped the container.

Please add better logging so you can narrow down why your app is exiting.


2 years ago

I think I have added logs to every possible route the app could be terminating. It does not even terminate, its still running. But if the container dies, i dont get any other logs. Here is my repo main file that handles all errors https://github.com/byCrookie/github-stats/blob/main/src/main.rs Everything should have a log statement. The app does not have a chance to even log, the container dies first.


2 years ago

What do your memory metrics look like?


2 years ago

Locally the memory of my container shows On railway it shows


2 years ago

If you aren't able to narrow down the issue with just logs, I'd say you need to start the process of elimination, start with a barebones actix app and then start adding more and more of your code to it until your app exits.


2 years ago

I have removed everything except for the web server and the container still dies. The alpine image is very lightweight and should no run into resource limits? Any idea why railway terminates my container after a healthy healthcheck? Thanks

Ok, I will. Have already tried once. Thanks, tho.

For clarification. You can't see why the container terminates? Locally I would have more options to debug docker itself.


2 years ago

That kind of granular feedback is not provided to the user at this time, but currently all signs are pointing to this being your app that's exiting.


2 years ago

I have tried using the most barebone implementation of actix-web using a dockerfile. The container still dies. I am out of ideas.

https://github.com/byCrookie/test-railway/blob/main/src/main.rs


2 years ago

There's an actix template on the template marketplace, start with that instead.


2 years ago

I still have not really an idea why the container dies. I fixed it tho by using rusttsl instead of openssl (default for reqwest create on linux) for requests.

Using a public domain now works, but private networking does not. Probably not supported by actix. This is a different issue and i will create a new thread if necessary.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...