mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-26 15:44:20 +00:00
Co-Authored-By: Eric Holk <eric@zed.dev> In app drop we had been calling `.close()` on the executors. This caused problems with the BackgroundExecutor on Linux because it raced with concurrent work: If task A was running and about to poll task B, the poll to task B would panic with "Task polled after completion". This didn't really matter (because the app was shutting down anyway) but inflated our panic metrics on Linux. It turns out that the call to `.close()` is not needed. It was added to prevent foreground tasks being scheduled after the app was dropped; but on all platforms the App run method does not return until after the ForegroundExecutor is stopped (so no further tasks will run anyway). The background case is more interesting. In test code it didn't matter (the background executor is simulated on the main thread so tests can't leak tasks); in app code it also didn't really make a difference. When `fn main` returns (which it does immediately after the app is dropped) all the background threads will be cancelled anyway. Further confounding debugging, it turns out that the App does not get dropped on macOS and Windows due to a reference cycle; so this was only happening on Linux where the app quit callback is dropped instead of retained after being called. (Fix in #50985) Release Notes: - N/A --------- Co-authored-by: Eric Holk <eric@zed.dev> |
||
|---|---|---|
| .. | ||
| examples/hello_web | ||
| src | ||
| Cargo.toml | ||
| LICENSE-APACHE | ||