Skip to content
How can a Pro operator verify a process’s exit code, OOM result, and finish time after replacement, restart, or stop?
nexpilot333
OP

2 days ago

We’re evaluating Railway Pro for an always-on service with one replica and a persistent volume. Before deployment, we need to know what shutdown evidence an operator can retrieve for the outgoing process in each of three cases:

  1. A new deployment replaces the running deployment.
  2. An operator restarts the current deployment without replacing it.
  3. An operator stops the service with no successor.

For each case, which supported read-only API query, CLI command, or export provides the outgoing deployment ID, a replica or execution ID that identifies the outgoing process instance, PID 1’s numeric exit code, an explicit OOM-killed true/false value, and the UTC timestamp when PID 1 actually finished?

Please give the field paths and a redacted example for each operation. If a field is unavailable, please identify it explicitly. For an ordinary restart, how do we distinguish the outgoing process from the new one if the deployment ID stays the same? If the relevant field is completedAt, what event does that timestamp represent?

Awaiting User Response

3 Replies

Railway
BOT

2 days ago

The deployment-level signal we can confirm is the deployment's status, which you can read with the public API or with railway deployment list --json. A deployment shows Completed when the running process exits with code 0, and Crashed when the process exits with a non-zero code and the restart policy's retries are used up. For an ordinary restart, we can confirm that the same deployment is relaunched from the exact image of the original build. You can trigger it with the public deploymentRestart(id) mutation.

We can't confirm that any supported API query, CLI command or export returns the other fields you listed, for any of the three cases. That covers a per-replica or per-execution ID for the outgoing process, PID 1's numeric exit code, an explicit OOM-killed true/false value, and a UTC timestamp for when PID 1 finished. Because of that, we can't give field paths, redacted examples or a definition of a completedAt field. We also can't point to a supported way to tell the outgoing process apart from its replacement after a restart that keeps the same deployment ID.

If your evaluation depends on these fields, please run all three cases (replace, restart, stop) in a separate test project and check what the API and CLI actually return before you rely on them.


Status changed to Awaiting User Response Railway • 2 days ago


nexpilot333
OP

7 hours ago

Thank you for confirming that an ordinary restart reuses the original image. Could a Railway engineer confirm what a Pro workspace operator can retrieve about the outgoing process when a deployment is replaced, restarted, or stopped?

For each operation, we need to know whether we can retrieve (1) an ID distinguishing the outgoing process instance, (2) PID 1’s numeric exit code, (3) an explicit OOM-killed true/false value, and (4) the UTC time PID 1 finished. If a field is available, please point us to the supported field or command. If it is unavailable to operators, an explicit confirmation is sufficient. If completedAt is relevant, what event does it timestamp?


Status changed to Awaiting Railway Response Railway • about 7 hours ago


Railway
BOT

12 minutes ago

For a stop, the public deployment(id) query is the closest record we can point to. deploymentStop only starts the shutdown, so poll deployment(id) until deploymentStopped is true, replicaStatus.running is 0, and every instance that was running reports STOPPED. An instance is recorded as STOPPED only after its container is confirmed stopped. If a container fails to stop, that instance stays RUNNING.

For an ordinary restart, deploymentRestart restarts the same containers under the same deployment. It doesn't create a new deployment, so nothing new appears at the deployment level that separates the outgoing process from its replacement. The deployment's instance IDs help with the stop check above, but we can't confirm they separate the process before a restart from the one after it. For a replacement, the outgoing deployment keeps its own ID and moves to REMOVING and then REMOVED.

For all three operations, we can't point you to a supported API field, CLI command or export that gives PID 1's numeric exit code, an explicit OOM-killed true/false value, or the UTC time PID 1 exited. We also can't confirm that any completedAt value represents process exit, so please don't treat it as that timestamp. At the deployment level, the only exit-related signals we can confirm are the statuses: COMPLETED when the app exits with code 0, and CRASHED when it crashes.


Status changed to Awaiting User Response Railway • 12 minutes ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...