[
https://issues.apache.org/jira/browse/RATIS-2321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18013501#comment-18013501
]
Tsz-wo Sze commented on RATIS-2321:
-----------------------------------
[~jt2594838], thanks for reporting the problem. Fortunately, the NPE was
caused by constructing a log message. Are you interested in submitting a pull
request?
> ServerState NPE when changing leader continuously
> -------------------------------------------------
>
> Key: RATIS-2321
> URL: https://issues.apache.org/jira/browse/RATIS-2321
> Project: Ratis
> Issue Type: Bug
> Components: server
> Affects Versions: 3.2.0
> Reporter: Tian Jiang
> Priority: Major
> Attachments: image-2025-08-12-16-52-21-717.png,
> image-2025-08-12-16-53-56-259.png
>
>
> Dear developers,
> I encountered an NPE when using Ratis. It says:
> !image-2025-08-12-16-52-21-717.png!
> The related code is here (at commit RATIS-2317. Move acquire
> PendingRequestPermit out of synchronized block in
> RaftServerImpl#appendTransaction. (#1275)):
> !image-2025-08-12-16-53-56-259.png!
> When the leader changes, the lasterNoLeaderTime is set to null.
> If the leader changes again, without being set to a null leader first, then
> the variable `previous` will be null, which triggers an NPE.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)