# gpui_tokio: Use shutdown_background to avoid WASI panic on exit \(\#53904\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/101083e7f9c92c52464551d3f888dfa5894b44e8)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 101083e7f9c92c52464551d3f888dfa5894b44e8

Requested commit: 101083e7f9c92c52464551d3f888dfa5894b44e8

Commit: 101083e7f9c92c52464551d3f888dfa5894b44e8

Tree: f1b91486c286d96f6dc22d3de0474919b777999e

Author: Richard Feldman

Committer: GitHub

## Message

````
gpui_tokio: Use shutdown_background to avoid WASI panic on exit (#53904)

When the Tokio runtime is dropped during Zed shutdown, it drives all
spawned tasks to cancellation by polling them one last time. The
`wasmtime-wasi` crate wraps child task `JoinHandle`s in an
`AbortOnDropJoinHandle` whose `Future::poll` calls `.expect("child task
panicked")` on the join result — but Tokio can also return
`JoinError::Cancelled` (not just panics), causing the expect to panic
with:

```
child task panicked: JoinError::Cancelled(Id(45))
```

This showed up as Sentry issue ZED-69A (106 events, 85 users, 100%
Windows, stable channel).

The fix is to explicitly call `shutdown_background()` on the owned Tokio
runtime during `GlobalTokio::drop`, which immediately drops all spawned
tasks without polling them again, avoiding the wasmtime-wasi panic path
entirely.

Release Notes:

- Fixed a crash on exit caused by the Tokio runtime shutdown triggering
a panic in extension WASI tasks (Windows).
````

## Parents

- [da6ac6c55127bf0d2a7a88bf17cd4f0da8ee5f00](https://git.cafe/gitcafe/zed/commit/da6ac6c55127bf0d2a7a88bf17cd4f0da8ee5f00?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/101083e7f9c92c52464551d3f888dfa5894b44e8?format=markdown)
