Skip to content

Fix NPE in ServerGrpcChannelBackoffResetHandler#18139

Open
timothy-e wants to merge 7 commits intoapache:masterfrom
timothy-e:timothye-null-check-in-backoffresethandler
Open

Fix NPE in ServerGrpcChannelBackoffResetHandler#18139
timothy-e wants to merge 7 commits intoapache:masterfrom
timothy-e:timothye-null-check-in-backoffresethandler

Conversation

@timothy-e
Copy link
Copy Markdown
Contributor

@timothy-e timothy-e commented Apr 8, 2026

Pinot integration tests failed flakily with

java.lang.NullPointerException
	at org.apache.pinot.server.starter.helix.ServerGrpcChannelBackoffResetHandler.onInstanceConfigChange(ServerGrpcChannelBackoffResetHandler.java:90)
	at org.apache.helix.manager.zk.CallbackHandler.invoke(CallbackHandler.java:362)
	at org.apache.helix.manager.zk.CallbackHandler.reset(CallbackHandler.java:772)
	at org.apache.helix.manager.zk.ZKHelixManager.resetHandlers(ZKHelixManager.java:1195)
	at org.apache.helix.manager.zk.ZKHelixManager$1.run(ZKHelixManager.java:931)

getPathChanged can return null when the notification type is FINALIZE. This was originally present in the PR that introduced this file, but removed because it was accidentally viewed as redundant.

Also, add a defensive null check before using the pathChanged, since it isn't guaranteed that pathChanged will be non-null.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 63.13%. Comparing base (52554ab) to head (65132dd).
⚠️ Report is 18 commits behind head on master.

Files with missing lines Patch % Lines
...er/helix/ServerGrpcChannelBackoffResetHandler.java 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18139      +/-   ##
============================================
- Coverage     64.01%   63.13%   -0.88%     
+ Complexity     1617     1616       -1     
============================================
  Files          3192     3213      +21     
  Lines        193936   195733    +1797     
  Branches      29937    30242     +305     
============================================
- Hits         124140   123584     -556     
- Misses        59990    62275    +2285     
- Partials       9806     9874      +68     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-11 63.11% <66.66%> (-0.85%) ⬇️
java-21 63.09% <66.66%> (-0.90%) ⬇️
temurin 63.13% <66.66%> (-0.88%) ⬇️
unittests 63.13% <66.66%> (-0.88%) ⬇️
unittests1 55.34% <ø> (-0.54%) ⬇️
unittests2 34.79% <66.66%> (+0.39%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

// Both require a full scan to rebuild _shuttingDownServers from the current cluster state.
NotificationContext.Type type = context.getType();
if (type == NotificationContext.Type.INIT || context.getIsChildChange()) {
String pathChanged = context.getPathChanged();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should dig deeper. Do you see a code path in Helix that can result in null pathChanges?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the bug and when it was introduced. Updated PR description and the change.

@timothy-e timothy-e marked this pull request as ready for review April 10, 2026 20:53
Copy link
Copy Markdown
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch on the root cause

if (type == NotificationContext.Type.INIT || context.getIsChildChange()) {
handleFullScan();
} else {
} else if (type == NotificationContext.Type.CALLBACK) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some comments about why we need this check to prevent someone accidentally removing it again

Comment on lines +90 to +93
if (pathChanged == null) {
// Shouldn't happen, but be defensive.
return;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means missing a callback. Suggest not making it defensive. I don't think this can happen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants