Skip to content

fix(mpris): prevent event loop hang on app quit#22

Merged
flexiondotorg merged 1 commit intomainfrom
quit
Mar 23, 2026
Merged

fix(mpris): prevent event loop hang on app quit#22
flexiondotorg merged 1 commit intomainfrom
quit

Conversation

@flexiondotorg
Copy link
Copy Markdown
Member

The D-Bus bus.disconnect() method calls stream.end(), which only half-closes the underlying socket. This leaves the socket open with the event loop still holding a reference, blocking Node.js process exit.

Capture the stream via bus._connection.stream before disconnecting, then explicitly call stream.destroy() to force-close the socket and release the event loop handle, allowing clean process shutdown.

Checklist

  • I have performed a self-review of my code
  • I have tested my changes and confirmed there are no regressions

The D-Bus bus.disconnect() method calls stream.end(), which only
half-closes the underlying socket. This leaves the socket open with the
event loop still holding a reference, blocking Node.js process exit.

Capture the stream via bus._connection.stream before disconnecting, then
explicitly call stream.destroy() to force-close the socket and release
the event loop handle, allowing clean process shutdown.

Signed-off-by: Martin Wimpress <code@wimpress.io>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@flexiondotorg flexiondotorg merged commit badd8c3 into main Mar 23, 2026
10 checks passed
@flexiondotorg flexiondotorg deleted the quit branch March 23, 2026 01:09
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