nodece commented on code in PR #17017:
URL: https://github.com/apache/pulsar/pull/17017#discussion_r943056423


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java:
##########
@@ -411,6 +411,8 @@ public CompletableFuture<Void> closeAsync() {
             LOG.info("Closing PulsarService");
             state = State.Closing;
 
+            functionWorkerService.ifPresent(WorkerService::stop);

Review Comment:
   @RobertIndie 
   
   > What do you mean by cli code?
   
   PulsarBrokerStarter belongs to cli code, it is called by using the `pulsar 
broker` command.
   
   >  I see that the functionWorkerService is passed to the PulsarService by 
here:
   
   We support passing the functionWorkerService to PulsarService, but the 
function worker should be closed by PulsarService, not PulsarBrokerStarter, 
which is a component of PulsarService.
   
   Suppose we don't close the functionWorkerService when running the close 
method of PulsarService. In that case, the functionWorkerService will break the 
PulsarService running, because the functionWorkerService cannot request the 
broker service, then call the PulsarService shutdown method. So when close and 
shutdown methods run together, the shutdown method will break the close method, 
because the shutdown closes the metadata service session.
   
   See the following links:
   - 
https://github.com/apache/pulsar/blob/4d5ecba9394515e7dbf19fd01739c1e1dc90e5ec/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java#L1812
   - 
https://github.com/apache/pulsar/blob/4d5ecba9394515e7dbf19fd01739c1e1dc90e5ec/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java#L1703-L1707
   



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