Technoboy- opened a new pull request, #21711:
URL: https://github.com/apache/pulsar/pull/21711

   
   Fixes #21501
   
   ### Motivation
   
   No need to `synchronized` the method `isLeader` in LeaderService
   
   See the deadlock stack :
   ```
   "pulsar-external-listener-44525-1":
        at 
org.apache.pulsar.functions.worker.FunctionMetaDataManager.giveupLeadership(FunctionMetaDataManager.java)
        - waiting to lock <0x0000100013535c90> (a 
org.apache.pulsar.functions.worker.FunctionMetaDataManager)
        at 
org.apache.pulsar.functions.worker.LeaderService.becameInactive(LeaderService.java:167)
        - locked <0x000010001344c6d8> (a 
org.apache.pulsar.functions.worker.LeaderService)
        at 
org.apache.pulsar.client.impl.ConsumerImpl.lambda$activeConsumerChanged$27(ConsumerImpl.java:1136)
        at 
org.apache.pulsar.client.impl.ConsumerImpl$$Lambda$2606/0x00007f854ce9cb10.run(Unknown
 Source)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker([email protected]/ThreadPoolExecutor.java:1136)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run([email protected]/ThreadPoolExecutor.java:635)
        at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run([email protected]/Thread.java:833)
   "pulsar-web-44514-6":
        at 
org.apache.pulsar.functions.worker.LeaderService.isLeader(LeaderService.java)
        - waiting to lock <0x000010001344c6d8> (a 
org.apache.pulsar.functions.worker.LeaderService)
        at 
org.apache.pulsar.functions.worker.SchedulerManager.scheduleInternal(SchedulerManager.java:200)
        at 
org.apache.pulsar.functions.worker.SchedulerManager.schedule(SchedulerManager.java:229)
        at 
org.apache.pulsar.functions.worker.FunctionMetaDataManager.updateFunctionOnLeader(FunctionMetaDataManager.java:251)
        - locked <0x0000100013535c90> (a 
org.apache.pulsar.functions.worker.FunctionMetaDataManager)
        at 
org.apache.pulsar.functions.worker.rest.api.ComponentImpl.internalProcessFunctionRequest(ComponentImpl.java:1775)
        at 
org.apache.pulsar.functions.worker.rest.api.ComponentImpl.updateRequest(ComponentImpl.java:996)
        at 
org.apache.pulsar.functions.worker.rest.api.FunctionsImpl.registerFunction(FunctionsImpl.java:222)
        at 
org.apache.pulsar.broker.admin.impl.FunctionsBase.registerFunction(FunctionsBase.java:196)
   ```
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   
   


-- 
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]

Reply via email to