You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/01/31 00:55:55 UTC

[GitHub] merlimat opened a new pull request #1154: Fixed use of static synchronized in LoadManagerShared

merlimat opened a new pull request #1154: Fixed use of static synchronized in LoadManagerShared
URL: https://github.com/apache/incubator-pulsar/pull/1154
 
 
   ### Motivation
   
   This is an attempt to fix the issue in `ReplicatorTest` ( #1138 )  which is causing many CI builds to intermittently fail.
   
   The `LoadManagerShared` is synchronizing on a static method to reuse the a single hash set for cache purposes. I have seen a thread stuck on that during a repeated testing:
   
   ```
   "pulsar-2997-2" #6897 prio=5 os_prio=31 tid=0x00007fdd33898800 nid=0x6830f waiting for monitor entry [0x000070000bb07000]
      java.lang.Thread.State: BLOCKED (on object monitor)
   	at org.apache.pulsar.broker.loadbalance.impl.LoadManagerShared.applyNamespacePolicies(LoadManagerShared.java:90)
   	- waiting to lock <0x00000006c0bc1250> (a java.lang.Class for org.apache.pulsar.broker.loadbalance.impl.LoadManagerShared)
   	at org.apache.pulsar.broker.loadbalance.impl.ModularLoadManagerImpl.selectBrokerForAssignment(ModularLoadManagerImpl.java:705)
   	- locked <0x000000078cf4e308> (a java.util.HashSet)
   	at org.apache.pulsar.broker.loadbalance.impl.ModularLoadManagerWrapper.getLeastLoaded(ModularLoadManagerWrapper.java:68)
   	at org.apache.pulsar.broker.namespace.NamespaceService.getLeastLoadedFromLoadManager(NamespaceService.java:463)
   	at org.apache.pulsar.broker.namespace.NamespaceService.searchForCandidateBroker(NamespaceService.java:338)
   	at org.apache.pulsar.broker.namespace.NamespaceService.lambda$4(NamespaceService.java:301)
   	at org.apache.pulsar.broker.namespace.NamespaceService$$Lambda$113/1109341011.run(Unknown Source)
   	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
   	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
   	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
   	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
   	at java.lang.Thread.run(Thread.java:745)
   ```
   
   ### Modifications
   
   Made the sets thread local and removed the mutex.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services