Skip to content

fix: implement InvokeCallback.operationFail() for rocketmq-remoting 5.5.0 compatibility#335

Merged
lizhanhui merged 5 commits into
masterfrom
copilot/fix-failing-github-actions-job
Jul 22, 2026
Merged

fix: implement InvokeCallback.operationFail() for rocketmq-remoting 5.5.0 compatibility#335
lizhanhui merged 5 commits into
masterfrom
copilot/fix-failing-github-actions-job

Conversation

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

PR #334 upgraded rocketmq-remoting 5.1.0 → 5.5.0 alongside the fastjson2 migration. The 5.5.0 release added operationFail(Throwable) to InvokeCallback and NettyRemotingClient.invokeAsync() now calls it directly (bypassing operationComplete) when connections fail — null channel, inactive channel, connection timeout. DLedger's lambda callbacks only implemented operationComplete, so operationFail was a default no-op, leaving CompletableFutures permanently incomplete on any connection failure.

Impact: Leader election, heartbeat, vote, push, and snapshot operations would hang for 3 s before TimeoutException, causing cascading failures in 13 CI tests across LeaderElectorTest, AppendAndPushTest, BatchPushTest, CommitIndexTest, and SnapshotManagerTest.

Changes

  • DLedgerRpcNettyService — replace all 6 lambda InvokeCallback instances (heartBeat, vote, append, push, installSnapshot, leadershipTransfer) with anonymous classes that implement operationFail(), immediately completing the future with NETWORK_ERROR so callers can retry without waiting for the 3 s .get() timeout:
// Before — operationFail is a no-op; future never completes on connection failure
remotingClient.invokeAsync(addr, request, 3000, responseFuture -> {
    RemotingCommand responseCommand = responseFuture.getResponseCommand();
    if (responseCommand != null) { ... }
    else { future.complete(NETWORK_ERROR); }
});

// After — connection failures surface immediately
remotingClient.invokeAsync(addr, request, 3000, new InvokeCallback() {
    @Override
    public void operationComplete(ResponseFuture responseFuture) {
        RemotingCommand responseCommand = responseFuture.getResponseCommand();
        if (responseCommand != null) { ... }
        else { future.complete(NETWORK_ERROR); }
    }

    @Override
    public void operationFail(Throwable throwable) {
        future.complete(NETWORK_ERROR);  // unblocks caller immediately
    }
});

Copilot AI added 3 commits July 22, 2026 08:19
…0 compatibility

rocketmq-remoting 5.5.0 changed InvokeCallback semantics: operationFail()
is now called directly when connections fail (null channel, inactive channel,
connection timeout). DLedger's lambda callbacks only implemented
operationComplete(), using the default no-op operationFail().

This caused CompletableFutures to never complete when connections failed,
leading to TimeoutException after 3 seconds and test failures across
LeaderElectorTest, AppendAndPushTest, BatchPushTest, CommitIndexTest,
and SnapshotManagerTest.

Fix: replace all lambda InvokeCallback instances in DLedgerRpcNettyService
with anonymous classes that implement both operationComplete() and
operationFail(), immediately completing futures with NETWORK_ERROR on failure.
Copilot AI changed the title [WIP] Fix failing GitHub Actions job 'build' fix: implement InvokeCallback.operationFail() for rocketmq-remoting 5.5.0 compatibility Jul 22, 2026
Copilot AI requested a review from lizhanhui July 22, 2026 08:57
@lizhanhui
lizhanhui marked this pull request as ready for review July 22, 2026 10:38
@lizhanhui
lizhanhui merged commit 2834424 into master Jul 22, 2026
1 check passed
@lizhanhui
lizhanhui deleted the copilot/fix-failing-github-actions-job branch July 22, 2026 11:20
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.

2 participants