Skip to content

Batch playback polling into single IPC call to fix WebKitGTK crash#141

Merged
willfish merged 1 commit intomasterfrom
batch-playback-status-ipc
Mar 9, 2026
Merged

Batch playback polling into single IPC call to fix WebKitGTK crash#141
willfish merged 1 commit intomasterfrom
batch-playback-status-ipc

Conversation

@willfish
Copy link
Copy Markdown
Owner

@willfish willfish commented Mar 9, 2026

Summary

  • Adds GetPlaybackStatus() method that returns all frequently-polled playback state in a single struct (state, position, duration, volume, title, artist, album, shuffle, repeat, radio mode/station/artwork)
  • Updates NowPlayingBar.svelte to call this single method instead of 10-13 individual PlayerService methods per poll cycle
  • Reduces Wails IPC traffic from ~60 messages/second to ~4 messages/second at the 250ms polling interval

Root cause

WebKitGTK 2.50.5 has a use-after-free bug in WTF::Vector<WebCore::FormDataElement>::~Vector() (offset 0x9b0a6f in libwebkitgtk-6.0.so). The rapid creation and destruction of ~60 IPC message objects per second triggers a race condition in WebKit's internal cleanup, causing a NULL dereference at addr=0x28 during the destructor.

Identified via crash log analysis from PR #140 which added /proc/self/maps to crash logs, allowing addr2line to pinpoint the exact function.

Test plan

  • go test -tags nocgo ./... passes
  • go vet -tags nocgo ./... passes
  • Frontend builds successfully (npm run build)
  • Verify playback controls still work (play/pause, seek, volume, shuffle, repeat)
  • Verify radio mode displays correctly (station name, artwork, LIVE indicator)
  • Run for extended period during radio playback to confirm crash no longer occurs

The frontend polled 10-13 individual PlayerService methods every 250ms,
creating ~60 Wails IPC messages/second through WebKit. This triggered a
use-after-free bug in WebKitGTK 2.50.5's FormDataElement destructor
(WTF::Vector<WebCore::FormDataElement>::~Vector at offset 0x9b0a6f).

Add GetPlaybackStatus() that returns all playback state in a single
struct, reducing IPC traffic from ~60 to ~4 messages/second.
@willfish willfish merged commit ef9524b into master Mar 9, 2026
5 checks passed
@willfish willfish deleted the batch-playback-status-ipc branch March 9, 2026 20:08
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.

1 participant