Encountered a random restart after using V2 runtime for a while
I was just randomly checking my deployment logs when I noticed a 'restart' out of nowhere. I checked sentry and there had been no errors, and I also checked my dev logs and the last command that was ran was at 7:02 PM (GMT+2) and that was just me running the ping command. I'm not sure if this is related to the runtime but it's the first ever time I've noticed it happen.
Solution:Jump to solution
I think that I can pretty much rule out that this is a railway issue. I'm 99% willing to bet it's bun because I just had a crash right now after running a command that gets some stats from bun
61 Replies
Project ID:
f8f1d4b6-1530-4b65-a444-67b8c86c5fca
f8f1d4b6-1530-4b65-a444-67b8c86c5fca
!t
New reply sent from Help Station thread:
This thread has been escalated to the Railway team.You're seeing this because this thread has been automatically linked to the Help Station thread.
does this service have a volume?
No
The only service I have that has a volume is the db
I can also provide my sentry logs if that's neccessary
my bad anyway, i didn't notice the v2 runtime specific logs until after I asked
These are the last sentry logs. Nothing crashed and it wouldn't make sense if it did because the last command was just
!ping
and it was 2 hours ago@cody Can I push changes to github or should I not touch anything for now? I need to update my
bun.lockb
file because I forgot to update it in the last push
Did i rlly ping myself
Ok dyslexia thanks
CC. @Brody, this was meant for uyou can go ahead and push the changes, your app comes first
Alright, tho the 'backup' is up and running rn so it's not as important
I'm gonna watch the logs and see if any more restarts happen
New reply sent from Help Station thread:
This is bun right? I wouldn't be surprised if it just crashed outta nowhere for some reasonYou're seeing this because this thread has been automatically linked to the Help Station thread.
Yes, though this has never happened before, and I only noticed it happening after switching to the v2 runtime
I just realized that was Jake commenting, lol
yeah the bridge should really show the usernames
So far so good, I haven't seen anything restart randomly
I think that's just lucky, as far as I know they haven't looked into anything
I wonder if they do keep track of things like exit code so they could tell you if this was your app exiting or an issue on their side
That'd be nice if they did, because It would mean something is wrong when it shouldn't be
unfortunately there's nothing I can do here, we would have to wait to hear back from a team member
I ran it locally for like an hour and it didn't exit
I suspect it may be something related to bun and the lockb file. It hasn't happened ever since I updated that
Jake also said it could be a bun thing
It's a possibility so I can't rule anything out for now. For all I know it has nothing to do with the v2 runtime
it's very possible it is a bun thing
Just that the timing could've been wrong and it seemed like v2 was the issue π₯²
it was a fair assumption, but we can't rule out either until it's looked into further
Yeah
Hey @Brody. This is a little offtopic but I wanted to know if there's a way to view the docker configuration railway automatically comes up with. I'm having issues with my Dockerfile again and I'm really lost
not really, that's kinda abstracted away, but what issues are you having?
backing up what cooper said -
https://x.com/bunjavascript/status/1805019607058768321
My dockerfile uses the latest version of bun, which would be 1.1.16, so I don't think that's the issue. It hasn't happened again, though yesterday I went back to the v1 runtime just to be safe
Also speaking of the dockerfile, I'm trying to go back to my old architecture, which means compiling the typescript code first and then running it (dist folder), so bun doesn't eat away my ram, and the issue is that I simply don't know how to do that since railway used to manage it for me. I tried like 20 different setups and ultimately each of them either failed either on build or on deployment π«
have you checked out buns docs on their recommendations for running in production?
Yeah, I'm currently trying to build one based off of their example. I tried doing so yesterday (cough at 2am) but that didn't turn out well
If I'm understanding docker docs and the guide correctly then it shouldn't be much work
https://bun.sh/docs/bundler/executables#deploying-to-production
in their example, the build command generates a
myapp
executable that should be well executedI run multiple bun apps on Railway and haven't noticed random restarts AFAIK, but one thing you could do is have your app capture SIGnals and output to console when one happens (something like "Received signal..."), so that you can determine if Railway is sending signals to your app to kill it
oh that's a great idea
and on that note, capturing signals will only work if your app is executed directly, running an npm command to then start your app will cause the signals to be lost
I like capturing SIGINT (local Ctrl+C) and SIGTERM (sent by Railway on sleep/restart/etc)
yeah that's true, I ended up doing a shell script to orchestrate my app start (the ones with things like database migration) and the shell script captures signals and outputs to console
but also follow buns guide I linked, multiple people have reported it has saved them memory
I used to do this too, but I removed it in the commit I made a month ago. I thought that It'd be to since I've never gotten any unexpected restarts or anything else that might lead to the app getting killed/crashing. I guess I can re implement it again but it hasn't happened again since I made this post and talked about it in #π€ο½chit-chat
I'm not concerned about saving memory that much, but I'd prefer it to run on 130mb on idle compared to the 250 it's running rn
Locally it runs on 200 but for some reason on railway it's 250
well, once again dockerfile didn't work, wohoo
dockerfiles always work, when written correctly π
Well yeah. Mine works like 75%, then it just crashes saying it can't find dist
Should I open another thread to get a little help with it
I don't know too much about bun but sure!
It's the same as npm, has practically no difference. My issue is just with paths and everything as I don't understand how docker works. #Errors with Dockerfile
On a side note
This happened
i think its safe to say that this is your app crashing
Yeah but these only happen on railway, not locally, which Is what makes me feel it has something to do with railway
And this is on the v2 runtime. In more than half a year of using the platform this has never happened lol
could be an issue with the new version of bun
have you implemented signal catching yet?
can you console log the
HOSTNAME
variable for me too?No, I'm finding it difficult to balance work and development, and I've also been pretty sick lately π
get well soon π
I can do that, yeah
You do have a point. I've only noticed "weird" things when using bun
I might make a separate branch that uses node to deploy on railway and see if that fixes it
please do
Bun is still relatively new so I understand it has its issues as well
because at this point it really is looking like an issue with your application (bun)
Bun seems like it's more trouble than it's worth lol
at this point, I agree
I'll have to change my dockerfile which will probably drive me nuts like the previous time. God forbid I'm doing that alone, I'll ask my friend for help π₯²
dockerfiles are fun when you get the hang of them
far better than dealing with nixpacks
True
I should probably install docker desktop so I can stop making 20 commits every time I update my file
I've been "testing" the changes on railway, and I realize that doing so was just causing me more problems
docker desktop - that's a good idea
Solution
I think that I can pretty much rule out that this is a railway issue. I'm 99% willing to bet it's bun because I just had a crash right now after running a command that gets some stats from bun
It happened without any context and this has never happened on node. It does happen a few times when I run locally as well
I spent quite a bit testing different scenarios and sure enough it just died
It's going back to node tomorrow, I don't want more random crashes and restarts
moving back to node is for the best
Yeah I'm not gonna bother with bun anymore lol. Maybe in the future when it gets a lot better and stable but definitely not for now
sounds good to me