Container keeps terminating exactly 8 seconds after starting

vishalj99
HOBBY

4 months ago

Dear All,

I am new to deploying apps here, any advice would be welcome.

Ive tried adding tons of debugging logs but still after 8s everything just quits.

Starting Container

Jun 09 18:54:40

Checking frontend config...

Jun 09 18:54:40

Template exists: True

Jun 09 18:54:40

Config.js exists: False

Jun 09 18:54:40

Generating frontend/js/config.js from template...

Jun 09 18:54:40

Template content length: 197 chars

Jun 09 18:54:40

MAPBOX_ACCESS_TOKEN found: True

Jun 09 18:54:40

GOOGLE_MAPS_API_KEY found: True

Jun 09 18:54:40

Generated config.js (278 bytes)

Jun 09 18:54:40

First line of config.js: // Mapbox configuration - populated from environme...

Jun 09 18:54:40

Frontend config complete

Jun 09 18:54:40

Jun 09 18:54:40

=== VERIFYING DIRECTORY STRUCTURE ===

Jun 09 18:54:40

Current working directory: /app

Jun 09 18:54:40

frontend/ exists: True

Jun 09 18:54:40

frontend/js/ exists: True

Jun 09 18:54:40

frontend/js/config.js exists: True

Jun 09 18:54:40

JS files found: ['visualization.js', 'routing.js', 'app.js', 'map.js', 'config.js']

Jun 09 18:54:40

=== END DIRECTORY CHECK ===

Jun 09 18:54:40

Jun 09 18:54:40

Jun 09 18:54:40

Completing initialization...

Jun 09 18:54:40

Initializing Google Maps client...

Jun 09 18:54:40

Initialized Google Maps client

Jun 09 18:54:40

Google Maps initialization complete

Jun 09 18:54:40

Loading graphs...

Jun 09 18:54:40

Loaded TfL graph: 272 nodes, 314 edges

Jun 09 18:54:40

Loaded merged graph: 272 nodes, 36856 edges

Jun 09 18:54:40

Loaded 272 stations

Jun 09 18:54:40

Loading multi-layer routing graph from data/merged_multilayer_graph.pickle...

Jun 09 18:54:40

Loaded multi-layer graph: 366 nodes (272 unique stations), 66795 connections

Jun 09 18:54:40

Jun 09 18:54:40

Applying station access buffers to bike edges...

Jun 09 18:54:40

Applied buffers to 66312 bike edges

Jun 09 18:54:40

Average buffer: 9.0 minutes

Jun 09 18:54:40

Station access: 2.0 min, Train wait: 5.0 min

Jun 09 18:54:40

Initialized multi-layer router with data/merged_multilayer_graph.pickle

Jun 09 18:54:40

Graph loading complete

Jun 09 18:54:40

=== INITIALIZATION COMPLETE ===

Jun 09 18:54:40

Jun 09 18:54:40

[2025-06-09 17:54:34 +0000] [1] [INFO] Starting gunicorn 23.0.0

Jun 09 18:54:40

[2025-06-09 17:54:34 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)

Jun 09 18:54:40

[2025-06-09 17:54:34 +0000] [1] [INFO] Using worker: sync

Jun 09 18:54:40

[2025-06-09 17:54:34 +0000] [4] [INFO] Booting worker with pid: 4

Jun 09 18:54:40

=== APP.PY STARTING ===

Jun 09 18:54:40

1. Basic imports complete

Jun 09 18:54:40

2. Adding src to Python path...

Jun 09 18:54:40

3. Importing route_planner_multilayer...

Jun 09 18:54:40

Successfully imported MultiLayerBikeTransitRouter

Jun 09 18:54:40

3.5. Defining global variables...

Jun 09 18:54:40

3.6. Defining functions...

Jun 09 18:54:40

Flask app created

Jun 09 18:54:40

Jun 09 18:54:40

=== BROMPTON MAPS INITIALIZATION ===

Jun 09 18:54:40

Running on Railway: True

Jun 09 18:54:40

Railway Environment: production

Jun 09 18:54:40

Railway Service: bromptonMaps

Jun 09 18:54:40

Jun 09 18:54:40

=== CHECKING ENVIRONMENT VARIABLES ===

Jun 09 18:54:40

MAPBOX_ACCESS_TOKEN: ******** (length: 86)

Jun 09 18:54:40

GOOGLE_MAPS_API_KEY: ******** (length: 39)

Jun 09 18:54:40

PORT: **** (length: 4)

Jun 09 18:54:40

=== END ENVIRONMENT CHECK ===

Jun 09 18:54:40

Jun 09 18:54:40

Loading environment variables...

Jun 09 18:54:40

Skipping load_dotenv() on Railway (using Railway env vars)

Jun 09 19:04:22

Stopping Container

Jun 09 19:04:41

[2025-06-09 18:04:21 +0000] [1] [INFO] Handling signal: term

Jun 09 19:04:41

[2025-06-09 18:04:21 +0000] [4] [INFO] Worker exiting (pid: 4)

Solved$10 Bounty

4 Replies

4 months ago

Hi there

i think that railway will terminate your service without an error message(!) if it exceeds the allocated resources like RAM or CPU and seeing that you are on a free plan that sounds very likely to me. The thing is that the spike in usage wont show up in the metrics

consider upgrading to a hobby plan to see how it goes

however your app https://www.bromptonmaps.com/ seems to be running. Cool app btw.

did you figure out what was causing it?

alex


ns-rg
FREE

4 months ago

I’ve run into that termination issue myself while testing out a Minecraft server template which happened because of the free tier resource limits.


alexwebgr

Hi therei think that railway will terminate your service without an error message(!) if it exceeds the allocated resources like RAM or CPU and seeing that you are on a free plan that sounds very likely to me. The thing is that the spike in usage wont show up in the metricsconsider upgrading to a hobby plan to see how it goeshowever your app https://www.bromptonmaps.com/ seems to be running. Cool app btw.did you figure out what was causing it?alex

vishalj99
HOBBY

4 months ago

yep! it was loading the pickle file that defines the transport graph haha, creating a new skeleton app which just incrementally added the logic to get back to my app and found it crashed at that point! Now i do lazy loading so it loads the graph on the first request rather than having it pre loaded which caused the start up crash.


4 months ago

yeah! lazy loading is the way to go


Status changed to Open sarahkb125 4 months ago


Status changed to Solved sarahkb125 4 months ago


Container keeps terminating exactly 8 seconds after starting - Railway Help Station