Skip to content

Fix hang detection crash when foreground stats are missing - #58464

Merged
Anthony-Eid merged 3 commits into
mainfrom
anthony/fr-58-zed-8xd-main-thread-should-be-in-all-statistics
Jun 3, 2026
Merged

Fix hang detection crash when foreground stats are missing#58464
Anthony-Eid merged 3 commits into
mainfrom
anthony/fr-58-zed-8xd-main-thread-should-be-in-all-statistics

Conversation

@Anthony-Eid

Copy link
Copy Markdown
Contributor

Register the foreground thread with the GPUI profiler before starting hang detection, so foreground task statistics are available when the hang detection thread samples profiler data.

cc: @yara-blue I choose to leave the expect statements because it seems like an invariant that we should uphold. Let me know if you would rather have early returns and telemetry if they're hit

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Closes FR-58

Release Notes:

  • Fixed a crash in hang detection when foreground thread statistics were missing.

Register the foreground thread with the GPUI profiler before starting
hang detection, so foreground task statistics are available when the
hang detection thread samples profiler data.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 3, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Jun 3, 2026
Co-authored-by: Yara <git@yara.blue>
@Anthony-Eid
Anthony-Eid enabled auto-merge June 3, 2026 21:49
@Anthony-Eid
Anthony-Eid added this pull request to the merge queue Jun 3, 2026
Merged via the queue into main with commit b76e0bc Jun 3, 2026
32 checks passed
@Anthony-Eid
Anthony-Eid deleted the anthony/fr-58-zed-8xd-main-thread-should-be-in-all-statistics branch June 3, 2026 22:01
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 8, 2026
…tries#58464)

Register the foreground thread with the GPUI profiler before starting
hang detection, so foreground task statistics are available when the
hang detection thread samples profiler data.

cc: @yara-blue I choose to leave the expect statements because it seems
like an invariant that we should uphold. Let me know if you would rather
have early returns and telemetry if they're hit

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes FR-58

Release Notes:

- Fixed a crash in hang detection when foreground thread statistics were
missing.

---------

Co-authored-by: Yara <git@yara.blue>
@Anthony-Eid

Copy link
Copy Markdown
Contributor Author

/cherry-pick preview

zed-zippy Bot added a commit that referenced this pull request Jun 8, 2026
…cherry-pick to preview) (#58850)

Cherry-pick of #58464 to preview

----
Register the foreground thread with the GPUI profiler before starting
hang detection, so foreground task statistics are available when the
hang detection thread samples profiler data.

cc: @yara-blue I choose to leave the expect statements because it seems
like an invariant that we should uphold. Let me know if you would rather
have early returns and telemetry if they're hit

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX

checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes FR-58

Release Notes:

- Fixed a crash in hang detection when foreground thread statistics were
missing.

---------

Co-authored-by: Yara <git@yara.blue>

Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
Co-authored-by: Yara <git@yara.blue>
This was referenced Jun 18, 2026
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
…tries#58464)

Register the foreground thread with the GPUI profiler before starting
hang detection, so foreground task statistics are available when the
hang detection thread samples profiler data.

cc: @yara-blue I choose to leave the expect statements because it seems
like an invariant that we should uphold. Let me know if you would rather
have early returns and telemetry if they're hit

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes FR-58

Release Notes:

- Fixed a crash in hang detection when foreground thread statistics were
missing.

---------

Co-authored-by: Yara <git@yara.blue>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…tries#58464) (cherry-pick to preview) (zed-industries#58850)

Cherry-pick of zed-industries#58464 to preview

----
Register the foreground thread with the GPUI profiler before starting
hang detection, so foreground task statistics are available when the
hang detection thread samples profiler data.

cc: @yara-blue I choose to leave the expect statements because it seems
like an invariant that we should uphold. Let me know if you would rather
have early returns and telemetry if they're hit

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX

checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes FR-58

Release Notes:

- Fixed a crash in hang detection when foreground thread statistics were
missing.

---------

Co-authored-by: Yara <git@yara.blue>

Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
Co-authored-by: Yara <git@yara.blue>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…tries#58464)

Register the foreground thread with the GPUI profiler before starting
hang detection, so foreground task statistics are available when the
hang detection thread samples profiler data.

cc: @yara-blue I choose to leave the expect statements because it seems
like an invariant that we should uphold. Let me know if you would rather
have early returns and telemetry if they're hit

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes FR-58

Release Notes:

- Fixed a crash in hang detection when foreground thread statistics were
missing.

---------

Co-authored-by: Yara <git@yara.blue>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants