apache / apache/rocketmq

Auto-switch HA readers do not handle unknown state ordinals safely

Open
#10,853 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
3d 1h
Merged PRs (30d)
27

Description

### Description

The auto-switch HA server indexes HAConnectionState.values directly with the state ordinal read from the peer. An unknown ordinal throws ArrayIndexOutOfBoundsException in the read path. The HA client has the same unsafe lookup while reporting a mismatched master state.

### Expected behavior

Decode ordinals through a bounds-checked helper. Reject an unknown slave state and log an unknown master state without throwing from enum array access.

Contributor guide

Open the contributing guide

Research direction

Start in the auto-switch HA server read path and the HA client path that reports a mismatched master state, locating the direct HAConnectionState.values lookups described in the issue. Trace how peer ordinals are decoded, then verify that unknown slave states are rejected and unknown master states are logged without an enum-array exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.