# Restarting an environment's runtime

> Makes one environment of an application drop what it holds in memory — its sessions, the model they were built from and the caches on them — and build it again, without a redeploy and without restarting a pod. Every node serving the environment does it, the control plane's and each runtime of its zone. The answer says which version serves, and who asked, when and why is recorded. It is for the day something is wrong in memory and a deploy would change more than you want.

<!-- id: zones-restarting-an-environments-runtime · area: zones · stability: preview · html: https://osysharp.com/reference/zones/restarting-an-environments-runtime/ -->

## Summary        {#summary}

Restarting an environment's runtime makes every node that serves it forget what it holds for the application and build it again
from the version it serves now. **Nothing is redeployed** — the same version serves before and after — and **no pod is restarted**:
the application's sessions, its model and the caches built on them are dropped, and the next request of each page builds them
afresh, a little slower than usual once.

## Signature      {#signature}

```console
osyrin app restart <app> --env <environment> --reason <text> [--json]
```

## Description    {#description}

- `app` is the application's slug (`--app` works too). `--env` is the environment's slug, like `production`. `--reason` is required:
  it is recorded with who asked and when.
- **Who may:** the application's Owners and Admins, the Owners and Admins of its organization, and the platform's operators — the
  same people who may restore its data. A Developer or a plain member of the organization is refused, and someone who cannot see
  the application is told it is not there.
- **What serves afterwards** is in the answer: the version the environment serves, which is the version it served before. A
  deploy that is still moving the environment is not interrupted.
- **Every node.** The control plane's own nodes drop the application at once. A zone's runtimes hold no registry and hear no bus:
  they take a snapshot from their zone's agent, and a restart moves one number in it, so each runtime of the zone drops the
  application the next time it takes the snapshot, a few seconds later.
- **The application, not one environment's sessions alone.** A node's cache is keyed by application, so another environment of the
  same application on the same node builds again as well — one cold request each. What is recorded, and counted, is the one environment's.
- **Nothing else changes:** no data, no secret, no pod, no deployment. A session that was still loading when the restart ran
  answers the request that built it and is not kept, so the next request builds again from what is now current.
- **The Platform page** of the application has the same control: open the environment's row and press **Restart runtime**. It asks
  why before it does anything.
- **For machines:** the same operation is `POST /api/rest/v1/applications/restart-runtime` with
  `{"applicationSlug": "...", "environmentSlug": "...", "reason": "..."}`, answering `{"result": {"application", "environment",
  "version", "generation", "message"}}`. Admin's MCP catalogs only read, so there is no MCP tool for it.

Use it before reaching for anything else when a page keeps rendering an old build or a route is stale after a deploy has
converged. It is not a fix for a crash or an out-of-memory runtime — those are an operator's (`osycloud zone restart-runtime`).
**Never `kubectl` for this** — an application's team has no cluster access, and an agent must not use it.

## Examples       {#examples}

```console
osyrin app restart billing --env production --reason "its pages stayed on the old build after the deploy"
```

```console
osyrin app restart billing --env sandbox --reason "a stale route" --json
```

## See also       {#see-also}

- [Deploying an application to a cloud platform — the zone builds it](https://osysharp.com/reference/zones/deploying-an-application/) — what a deploy does to an environment
- [Upgrading an application to a newer platform release](https://osysharp.com/reference/zones/upgrading-an-application/) — moving an environment to a newer platform release
- [An organization's environments](https://osysharp.com/reference/zones/environments-of-an-organization/) — what an environment is
