The two synchronized locks in Stamp.scala sometimes take too long to be grabbed (#1129)
Mitigation
Not sure about the root cause of the issue. But we can at least make lock more granular via using ConcurrentHashMap instead of synchronized.
As bonus this change addresses a potential race condition. When InitialStamps.source and InitialStamps.getAllSourceStamps is called concurrently, the access is not thread-safe. Such access pattern is probably very rare / never happens in practice, but nonetheless an improvement that it is addressed.
Issue
The two
synchronized
locks inStamp.scala
sometimes take too long to be grabbed (#1129)Mitigation
Not sure about the root cause of the issue. But we can at least make lock more granular via using
ConcurrentHashMap
instead ofsynchronized
.As bonus this change addresses a potential race condition. When
InitialStamps.source
andInitialStamps.getAllSourceStamps
is called concurrently, the access is not thread-safe. Such access pattern is probably very rare / never happens in practice, but nonetheless an improvement that it is addressed.