Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binder: ManagedClientTransport.Listener invocations are not properly synchronized #10917

Open
jdcormie opened this issue Feb 13, 2024 · 0 comments
Labels
Milestone

Comments

@jdcormie
Copy link
Member

Impls of ManagedClientTransport.Listener "do not need to be thread-safe so notifications must be properly synchronized externally." BinderClientTransport mostly seems to achieve this by holding its "this" lock, except for unregisterInbound() which makes a naked call to transportInUse(false).

The use of AtomicInteger numInUseStreams is questionable here too: an unregisterInbound() call could cause that counter to go to zero and that thread could decide to invoke transportInUse(false). Before it can do so, a newStream() call could cause numInUseStreams to go positive and that thread could decide to call transportInUse(true). These two threads would now race and if the false one wins, the Listener's idea of in use would become out of sync with reality.

@sergiitk sergiitk added this to the Next milestone Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants