Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][broker] Fix NPE after publishing a tombstone to the service unit channel #22859

Merged

Commits on Jun 6, 2024

  1. [fix][broker] Fix NPE after publishing a tombstone to the service uni…

    …t channel
    
    ### Motivation
    
    NPE will happen in `UnloadManager#handleEvent` after
    apache#22743. It's because the `Init`
    state is always associated with a null `ServiceUnitStateData`.
    
    ```
    java.lang.NullPointerException: Cannot invoke "org.apache.pulsar.broker.loadbalance.extensions.channel.ServiceUnitStateData.force()" because "data" is null
            at org.apache.pulsar.broker.loadbalance.extensions.manager.UnloadManager.handleEvent(UnloadManager.java:204) ~[classes/:?]
            at org.apache.pulsar.broker.loadbalance.extensions.channel.StateChangeListeners.lambda$notify$3(StateChangeListeners.java:74) ~[classes/:?]
            at java.base/java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:807) ~[?:?]
            at org.apache.pulsar.broker.loadbalance.extensions.channel.StateChangeListeners.notify(StateChangeListeners.java:72) ~[classes/:?]
            at org.apache.pulsar.broker.loadbalance.extensions.channel.ServiceUnitStateChannelImpl.handleInitEvent(ServiceUnitStateChannelImpl.java:902) ~[classes/:?]
            at org.apache.pulsar.broker.loadbalance.extensions.channel.ServiceUnitStateChannelImpl.handle(ServiceUnitStateChannelImpl.java:715) ~[classes/:?]
    ```
    
    ### Modifications
    
    In `UnloadManager#handleEvent`, assume `data` is null and call
    `complete` directly. Fix `UnloadManagerTest`, which passes a non-null
    `ServiceUnitStateData` and `Init` to `handleEvent`.
    BewareMyPower committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    9a30a17 View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2024

  1. Fix checkstyle check

    BewareMyPower committed Jun 7, 2024
    Configuration menu
    Copy the full SHA
    f7b77a4 View commit details
    Browse the repository at this point in the history