Skip to content

utils: resolve vsock deadlock and remove IsConnected_Unguarded workaround#2686

Draft
sferrogoo wants to merge 1 commit into
google:mainfrom
sferrogoo:vsock_deadlock_fix
Draft

utils: resolve vsock deadlock and remove IsConnected_Unguarded workaround#2686
sferrogoo wants to merge 1 commit into
google:mainfrom
sferrogoo:vsock_deadlock_fix

Conversation

@sferrogoo

Copy link
Copy Markdown
Contributor

This change introduces a state_mutex_ in VsockConnection to safely synchronize access to the underlying file descriptor (fd_).

The previous implementation used read_mutex_ and write_mutex_ to protect IsConnected() and Disconnect(), which created a circular lock dependency when these methods were called from within a Read() or Write() operation.

By using a dedicated state_mutex_ to protect the FD state, we can now safely check connectivity and perform I/O without risk of deadlock.

Bug: b/345285391
Test: verified with high-frequency stress test

…ound

This change introduces a state_mutex_ in VsockConnection to safely
synchronize access to the underlying file descriptor (fd_).

The previous implementation used read_mutex_ and write_mutex_ to
protect IsConnected() and Disconnect(), which created a circular
lock dependency when these methods were called from within a Read()
or Write() operation.

By using a dedicated state_mutex_ to protect the FD state, we can
now safely check connectivity and perform I/O without risk of
deadlock.

Bug: b/345285391
Test: verified with high-frequency stress test
@sferrogoo sferrogoo force-pushed the vsock_deadlock_fix branch from 4b01120 to 8a08243 Compare June 9, 2026 18:41
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