freeznet opened a new issue, #15057:
URL: https://github.com/apache/pulsar/issues/15057

   **Describe the bug**
   
   When no functions worker been elected as the leader, the `getLeader` returns 
`null` and causes NPE in LeaderService. See detailed exception below:
   
   ```
   2022-04-01T02:37:14.765131433+0530,"2022-03-31T21:07:14,765 
[pulsar-external-listener-60-1] WARN  
org.apache.pulsar.functions.worker.MembershipManager - Failed to determine 
leader in functions cluster"
   2022-04-01T02:37:14.765607510+0530,"2022-03-31T21:07:14,765 
[pulsar-external-listener-60-1] ERROR 
org.apache.pulsar.functions.worker.LeaderService - Encountered error when 
initializing to become leader"
   2022-04-01T02:37:14.765617598+0530,java.lang.NullPointerException: null
   2022-04-01T02:37:14.765624387+0530,  at 
org.apache.pulsar.functions.worker.LeaderService.lambda$becameActive$0(LeaderService.java:106)
 ~[org.apache.pulsar-pulsar-functions-worker-2.8.1.jar:2.8.1]
   2022-04-01T02:37:14.765629194+0530,  at 
org.apache.pulsar.functions.worker.WorkerUtils.createExclusiveProducerWithRetry(WorkerUtils.java:360)
 ~[org.apache.pulsar-pulsar-functions-worker-2.8.1.jar:2.8.1]
   2022-04-01T02:37:14.765634177+0530,  at 
org.apache.pulsar.functions.worker.FunctionMetaDataManager.acquireExclusiveWrite(FunctionMetaDataManager.java:282)
 ~[org.apache.pulsar-pulsar-functions-worker-2.8.1.jar:2.8.1]
   2022-04-01T02:37:14.765637906+0530,  at 
org.apache.pulsar.functions.worker.LeaderService.becameActive(LeaderService.java:111)
 ~[org.apache.pulsar-pulsar-functions-worker-2.8.1.jar:2.8.1]
   2022-04-01T02:37:14.765641519+0530,  at 
org.apache.pulsar.client.impl.ConsumerImpl.lambda$activeConsumerChanged$20(ConsumerImpl.java:977)
 ~[org.apache.pulsar-pulsar-client-original-2.8.1.jar:2.8.1]
   2022-04-01T02:37:14.765645530+0530,  at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
[?:1.8.0_302]
   2022-04-01T02:37:14.765649625+0530,  at 
java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_302]
   2022-04-01T02:37:14.765660901+0530,  at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
 [?:1.8.0_302]
   2022-04-01T02:37:14.765665183+0530,  at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
 [?:1.8.0_302]
   2022-04-01T02:37:14.765668877+0530,  at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
[?:1.8.0_302]
   2022-04-01T02:37:14.765672360+0530,  at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
[?:1.8.0_302]
   2022-04-01T02:37:14.765681045+0530,  at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 [io.netty-netty-common-4.1.72.Final.jar:4.1.72.Final]
   2022-04-01T02:37:14.765685263+0530,  at 
java.lang.Thread.run(Thread.java:748) [?:1.8.0_302]
   2022-04-01T02:37:14.765750041+0530,"2022-03-31T21:07:14,765 
[pulsar-external-listener-60-1] ERROR 
org.apache.pulsar.functions.worker.ErrorNotifierShutdownServiceImpl - 
Encountered fatal error. Shutting down."
   2022-04-01T02:37:14.765757608+0530,java.lang.NullPointerException: null
   2022-04-01T02:37:14.765761356+0530,  at 
org.apache.pulsar.functions.worker.LeaderService.lambda$becameActive$0(LeaderService.java:106)
 ~[org.apache.pulsar-pulsar-functions-worker-2.8.1.jar:2.8.1]
   2022-04-01T02:37:14.765764983+0530,  at 
org.apache.pulsar.functions.worker.WorkerUtils.createExclusiveProducerWithRetry(WorkerUtils.java:360)
 ~[org.apache.pulsar-pulsar-functions-worker-2.8.1.jar:2.8.1]
   2022-04-01T02:37:14.765769256+0530,  at 
org.apache.pulsar.functions.worker.FunctionMetaDataManager.acquireExclusiveWrite(FunctionMetaDataManager.java:282)
 ~[org.apache.pulsar-pulsar-functions-worker-2.8.1.jar:2.8.1]
   2022-04-01T02:37:14.765772839+0530,  at 
org.apache.pulsar.functions.worker.LeaderService.becameActive(LeaderService.java:111)
 ~[org.apache.pulsar-pulsar-functions-worker-2.8.1.jar:2.8.1]
   2022-04-01T02:37:14.765776505+0530,  at 
org.apache.pulsar.client.impl.ConsumerImpl.lambda$activeConsumerChanged$20(ConsumerImpl.java:977)
 ~[org.apache.pulsar-pulsar-client-original-2.8.1.jar:2.8.1]
   2022-04-01T02:37:14.765780771+0530,  at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
[?:1.8.0_302]
   2022-04-01T02:37:14.765784397+0530,  at 
java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_302]
   2022-04-01T02:37:14.765788139+0530,  at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
 [?:1.8.0_302]
   2022-04-01T02:37:14.765791954+0530,  at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
 [?:1.8.0_302]
   2022-04-01T02:37:14.765795955+0530,  at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
[?:1.8.0_302]
   2022-04-01T02:37:14.765799473+0530,  at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
[?:1.8.0_302]
   2022-04-01T02:37:14.765802879+0530,  at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 [io.netty-netty-common-4.1.72.Final.jar:4.1.72.Final]
   2022-04-01T02:37:14.765813497+0530,  at 
java.lang.Thread.run(Thread.java:748) [?:1.8.0_302]
   2022-04-01T02:37:14.769133988+0530,"2022-03-31T21:07:14,769 
[pulsar-external-listener-60-1] INFO  
org.apache.zookeeper.ClientCnxnSocketNetty - channel is told closing"
   ```
   
   


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