Skip to content

Conversation

@codelipenghui
Copy link
Contributor

Motivation

Fix NPE which introduced by #21798.

The issue was happened when upgrading the old version cluster to 3.3.0 or later version.
Withe the old version broker, the delayed delivery policy was persistent to the system topic without delayedDeliveryMaxDelayInMillis but the new version broker try to convert null to a long value.

 --- An unexpected error occurred in the server ---

Message: Cannot invoke "java.lang.Long.longValue()" because the return value of "org.apache.pulsar.common.policies.data.TopicPolicies.getDelayedDeliveryMaxDelayInMillis()" is null

Stacktrace:

java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because the return value of "org.apache.pulsar.common.policies.data.TopicPolicies.getDelayedDeliveryMaxDelayInMillis()" is null
	at org.apache.pulsar.broker.admin.impl.PersistentTopicsBase.lambda$internalGetDelayedDeliveryPolicies$103(PersistentTopicsBase.java:983)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.postFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)


Reason:
 --- An unexpected error occurred in the server ---

Message: Cannot invoke "java.lang.Long.longValue()" because the return value of "org.apache.pulsar.common.policies.data.TopicPolicies.getDelayedDeliveryMaxDelayInMillis()" is null

Stacktrace:

java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because the return value of "org.apache.pulsar.common.policies.data.TopicPolicies.getDelayedDeliveryMaxDelayInMillis()" is null
	at org.apache.pulsar.broker.admin.impl.PersistentTopicsBase.lambda$internalGetDelayedDeliveryPolicies$103(PersistentTopicsBase.java:983)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.postFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@codelipenghui
Copy link
Contributor Author

/pulsarbot run-failure-checks

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jul 15, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.30%. Comparing base (bbc6224) to head (6764c45).
⚠️ Report is 1311 commits behind head on master.

Files with missing lines Patch % Lines
...pulsar/broker/admin/impl/PersistentTopicsBase.java 80.00% 0 Missing and 1 partial ⚠️
...che/pulsar/common/policies/data/TopicPolicies.java 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24512      +/-   ##
============================================
+ Coverage     73.57%   74.30%   +0.73%     
- Complexity    32624    32871     +247     
============================================
  Files          1877     1868       -9     
  Lines        139502   145939    +6437     
  Branches      15299    16735    +1436     
============================================
+ Hits         102638   108447    +5809     
+ Misses        28908    28889      -19     
- Partials       7956     8603     +647     
Flag Coverage Δ
inttests 26.80% <0.00%> (+2.22%) ⬆️
systests 23.28% <0.00%> (-1.05%) ⬇️
unittests 73.79% <66.66%> (+0.94%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...pulsar/broker/admin/impl/PersistentTopicsBase.java 69.99% <80.00%> (+4.54%) ⬆️
...che/pulsar/common/policies/data/TopicPolicies.java 20.00% <0.00%> (-39.38%) ⬇️

... and 1091 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codelipenghui codelipenghui merged commit 63a2bd9 into apache:master Jul 15, 2025
69 of 79 checks passed
@codelipenghui codelipenghui deleted the penghui/fix-delayed-policy-npe branch July 15, 2025 06:08
codelipenghui added a commit that referenced this pull request Jul 15, 2025
codelipenghui added a commit that referenced this pull request Jul 15, 2025
priyanshu-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 22, 2025
)

(cherry picked from commit 63a2bd9)
(cherry picked from commit 3531028)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 24, 2025
)

(cherry picked from commit 63a2bd9)
(cherry picked from commit 3531028)
KannarFr pushed a commit to CleverCloud/pulsar that referenced this pull request Sep 22, 2025
walkinggo pushed a commit to walkinggo/pulsar that referenced this pull request Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants