Skip to content

fix: Deadlock in Electron >= v40#35

Merged
timfish merged 1 commit into
mainfrom
timfish/fix/electron-deadlock
May 13, 2026
Merged

fix: Deadlock in Electron >= v40#35
timfish merged 1 commit into
mainfrom
timfish/fix/electron-deadlock

Conversation

@timfish
Copy link
Copy Markdown
Collaborator

@timfish timfish commented May 13, 2026

See the deadlock analysis here: #34 (comment)

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9e90661. Configure here.

Comment thread bindings/cpu_profiler.cc
// CPU tickers
void MeasurementsTicker::cpu_callback() {
uv_cpu_info_t *cpu = nullptr;
uv_cpu_info_t *cpu = &cpu_stats;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix may be ineffective; uv_cpu_info overwrites pointer

Medium Severity

The uv_cpu_info API takes a uv_cpu_info_t** and unconditionally overwrites *cpu_infos with a pointer to newly allocated memory. This means initializing cpu to &cpu_stats vs nullptr has no effect — uv_cpu_info will still allocate, overwrite cpu, and the cpu_stats member is never read from or written to. If, however, some Electron-patched uv_cpu_info does skip allocation when *cpu_infos is non-null, then cpu would remain pointing at the single-element member cpu_stats, causing an out-of-bounds read in the loop (when count > 1) and uv_free_cpu_info would attempt to free() a class member variable — both undefined behavior.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9e90661. Configure here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this locally with Electron and it does seem to fix the issue

@timfish timfish requested a review from JonasBa May 13, 2026 12:26
@timfish timfish changed the title fix: Deadlock in Electron v40-42 fix: Deadlock in Electron >= v40 May 13, 2026
@timfish timfish merged commit ad14f0c into main May 13, 2026
81 checks passed
@timfish timfish deleted the timfish/fix/electron-deadlock branch May 13, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2.3.0 deadlocks in Electron >= v40

2 participants