BewareMyPower commented on code in PR #23349:
URL: https://github.com/apache/pulsar/pull/23349#discussion_r1777131823
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:
##########
@@ -679,11 +678,15 @@ private void handleEvent(String serviceUnit,
ServiceUnitStateData data) {
brokerId, serviceUnit, data, totalHandledRequests);
}
- if (channelState == Disabled) {
+ ServiceUnitState state = state(data);
+ if (channelState == Disabled && (data == null || !data.force())) {
Review Comment:
I applied the following patch on commit 8068f1d.
```diff
diff --git
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java
index 31c0e51f1d..f761eeb889 100644
---
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java
+++
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java
@@ -679,7 +679,7 @@ public class ServiceUnitStateChannelImpl implements
ServiceUnitStateChannel {
}
ServiceUnitState state = state(data);
- if (channelState == Disabled && (data == null || !data.force())) {
+ if (channelState == Disabled) {
final var request = getOwnerRequests.remove(serviceUnit);
if (request != null) {
request.completeExceptionally(new
BrokerServiceException.ServiceUnitNotReadyException(
@@ -1410,6 +1410,7 @@ public class ServiceUnitStateChannelImpl implements
ServiceUnitStateChannel {
if (data.state() == Free) {
futures.put(serviceUnit, handleFreeEvent(serviceUnit,
data));
} else if (data.state() == Owned &&
broker.equals(data.dstBroker())) {
+ log.info("[{}] bundle {} is still owned by this, data:
{}", broker, serviceUnit, data);
cleaned = false;
break;
}
```
Then the 2nd broker took 5 seconds to complete `disableBroker` and was stuck
at `unloadNamespaceBundlesGracefully`. Eventually it took 4 minutes to close.
```
"main" #1 prio=5 os_prio=31 cpu=4049.99ms elapsed=96.22s
tid=0x000000015b809800 nid=0x2903 waiting on condition [0x000000016db84000]
java.lang.Thread.State: TIMED_WAITING (parking)
at jdk.internal.misc.Unsafe.park([email protected]/Native Method)
- parking to wait for <0x000020002b6bed70> (a
java.util.concurrent.CompletableFuture$Signaller)
at
java.util.concurrent.locks.LockSupport.parkNanos([email protected]/LockSupport.java:252)
at
java.util.concurrent.CompletableFuture$Signaller.block([email protected]/CompletableFuture.java:1866)
at
java.util.concurrent.ForkJoinPool.unmanagedBlock([email protected]/ForkJoinPool.java:3463)
at
java.util.concurrent.ForkJoinPool.managedBlock([email protected]/ForkJoinPool.java:3434)
at
java.util.concurrent.CompletableFuture.timedGet([email protected]/CompletableFuture.java:1939)
at
java.util.concurrent.CompletableFuture.get([email protected]/CompletableFuture.java:2095)
at
org.apache.pulsar.broker.service.BrokerService.lambda$unloadNamespaceBundlesGracefully$28(BrokerService.java:974)
```
```
2024-09-26T21:54:17,373 - INFO - [main:BrokerService] - Unloading 3
namespace-bundles completed in 240.056 seconds
```
Here are the complete logs:
[failure-unload-too-long.log](https://github.com/user-attachments/files/17149790/failure-unload-too-long.log)
--
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]