aswinshakil opened a new pull request, #5751:
URL: https://github.com/apache/ozone/pull/5751
## What changes were proposed in this pull request?
When accessing the snapshot cache, Multiple threads fall into a deadlock
between ConcurrentHashMap(`dbMap`) and SynchronizedSet(`pendingEvictionList`).
### Scenario:
1. `dbMap.compute()` holds the ConcurrentHashMap lock while trying to hold
the lock for `pendingEvictionList` Set.
2. `cleanup()` method holds the lock for `pendingEvictionList` Set while
trying to hold the lock for the ConcurrentHashMap (`dbMap`).
```
"snapshot-diff-job-thread-id-8":
waiting to lock monitor 0x00007fa7964788d8 (object 0x00000006d658eed0, a
java.util.Collections$SynchronizedSet),
which is held by "KeyDeletingService#0"
"KeyDeletingService#0":
waiting to lock monitor 0x0000000000e99e68 (object 0x00000006db6bcba8, a
java.util.concurrent.ConcurrentHashMap$Node),
which is held by "SstFilteringService#0"
"SstFilteringService#0":
waiting to lock monitor 0x00007fa7964788d8 (object 0x00000006d658eed0, a
java.util.Collections$SynchronizedSet),
which is held by "KeyDeletingService#0"
```
One way to avoid this is to follow lock ordering. `dbMap.compute()` is
removed so that we never get lock in the 1st order.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-9871
## How was this patch tested?
Existing Test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]