Skip to content

CASSANDRA-21491: Prevent ClientMetrics NPE during internode reactivation#4923

Open
edwardconnect wants to merge 1 commit into
apache:trunkfrom
edwardconnect:edwardconnect/CASSANDRA-21491/trunk
Open

CASSANDRA-21491: Prevent ClientMetrics NPE during internode reactivation#4923
edwardconnect wants to merge 1 commit into
apache:trunkfrom
edwardconnect:edwardconnect/CASSANDRA-21491/trunk

Conversation

@edwardconnect

Copy link
Copy Markdown

Issue: CASSANDRA-21491

Problem

AbstractMessageHandler is shared by native-transport and internode connections, but its reserve-capacity reactivation path unconditionally updates ClientMetrics. Internode messaging starts before native transport initializes those metrics, so reactivating a throttled internode connection can throw a NullPointerException and terminate the connection.

Solution

Move paused-client metric accounting behind a no-op connection-reactivation hook in AbstractMessageHandler, and override the hook in CQLMessageHandler. This keeps the existing native-transport metric behavior while ensuring internode backpressure does not access client-only metrics.

Add a regression test that exercises internode reserve-capacity reactivation before ClientMetrics initialization. The test fails with the reported NullPointerException before the fix.

Tests

  • .build/sh/ai-ci-test org.apache.cassandra.net.AbstractMessageHandlerTest
  • .build/sh/ai-ci-test org.apache.cassandra.transport.RateLimitingTest
  • .build/sh/ai-build

Keep client-specific paused connection accounting in CQLMessageHandler so internode backpressure does not access ClientMetrics before native transport initialization.

Assisted-by: Codex:GPT-5
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.

1 participant