Skip to content

Conversation

@ejona86
Copy link
Member

@ejona86 ejona86 commented Nov 10, 2025

If a resource has dependencies that also use SharedResourceHolder, and its close() blocks waiting for processing on another thread, then the threads could become deadlocked on the SharedResourceHolder lock. Our answer should be "don't block," but it's also good to avoid calling arbitrary code with a lock held.

create() is still called with the lock held, but that seems less likely to do work on another thread, and it is harder to avoid the lock. close() is very easy to call without the lock.

See d50098f and b/458736211

If a resource has dependencies that also use SharedResourceHolder, and
its close() blocks waiting for processing on another thread, then the
threads could become deadlocked on the SharedResourceHolder lock. Our
answer should be "don't block," but it's also good to avoid calling
arbitrary code with a lock held.

create() is still called with the lock held, but that seems less likely
to do work on another thread, and it is harder to avoid the lock.
close() is very easy to call without the lock.

See d50098f and b/458736211
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 participants