jsr107 / RI

Reference Implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RICache#removeAll(Set) will inevitably deadlock

alexsnaps opened this issue · comments

(haven't looked any closer, but putAll(Map) probably suffers from the same issue)

Has there is no ordering over how multiple threads will acquire the locks, these code will deadlock in a multithreaded environment.

e.g.:
Thread A iterates over K1, locks it, then tries to lock K2
Thread B iterates over K2, locks it, then tries to lock K1 (held by Thread A, that waits for the lock on K2, held by this thread)

We deliberately did not write multi-threading (or performance) tests in the TCK. The RI is not meant to be production code but to simply be a minimal implementation for the test coverage.

If you want to add a test and the change to the RI for this then happy to add it.

Closing.