You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "DomGarguilo (via GitHub)" <gi...@apache.org> on 2024/10/08 18:28:09 UTC

[PR] Make EventCounter thread safe [accumulo]

DomGarguilo opened a new pull request, #4959:
URL: https://github.com/apache/accumulo/pull/4959

   Fixes #4956
   
   The stack track included in the ticket indicates that a ConcurrentmodificationException occurred in Monitor.EventCounter:
   ```
   java.util.ConcurrentmodificationException
   at java.util.HashMap$HashIterator.nextNode(HashMap.java:1511)
   at java.util.HashMap$HashIterator.next(HashMap.java:1544)
   at java.util.HashMap$HashIterator.next(HashMap.java:1542)
   at org.apache.accumulo.monitor.Monitor$EventCounter.calculateRate(monitor.java:23)
   at org.apache.accumulo.monitor.Monitor.getLookupRate(Monitor.java:977)
   at org.apache.accumulo.monitor.rest.tservers.TabletServerInformation.updateTabletServerInfo(TabletServerinformation.java:162)
   at org.apache.accumulo.monitor.rest.tservers.TabletServerInformation.(TabletServerInformation:101)
   at org.apache.accumulo.monitor.rest.tservers.TabletServer.(TabletServer.java:43)
   at org.apache.accumulo.monitor.rest.tservers.TabletServerResource.getTserverSummary(TabletServerResource.java:88)
   ```
   This PR adds synchronization to several methods in the `EventCounter` class to avoid this from happening again.
   
   Another approach that would probably work would be to make the 3 collections in this class thread safe by making the HashMaps into ConcurrentHashMaps and the HashSet into a `Collections.synchronizedSet(new HashSet<>())`. That would function just fine in the current code as far as I can tell but if we would ever need to iterate over the `synchronizedSet`, we would need to use a `synchronize` block anyways so i figured just making the methods themselves synchronized would future proof and fix the current issue too.


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make EventCounter thread safe [accumulo]

Posted by "DomGarguilo (via GitHub)" <gi...@apache.org>.
DomGarguilo merged PR #4959:
URL: https://github.com/apache/accumulo/pull/4959


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org