RockteMQ-AI commented on issue #10748:
URL: https://github.com/apache/rocketmq/issues/10748#issuecomment-5156109569

   **Fix Spec — v1**
   
   A detailed fix specification has been generated for this issue.
   
   ### Summary
   
   **Root Cause:** In `ProxyChannel.writeAndFlush()`, the `switch` `default` 
branch (lines 113–114) only executes `break`, leaving the `processFuture` 
(`CompletableFuture`) permanently incomplete. The returned `ChannelFuture` 
never resolves.
   
   **Fix (1 production change + 1 test):**
   
   1. **`ProxyChannel.java`** — Replace the empty `default: break;` with:
      ```java
      default:
          processFuture.completeExceptionally(
              new UnsupportedOperationException(
                  "Unsupported request code: " + command.getCode()));
          break;
      ```
      This triggers the existing `exceptionally` handler at line 127, which 
calls `promise.setFailure()`, resolving the `ChannelFuture` immediately and 
releasing semaphore permits.
   
   2. **`ProxyChannelTest.java`** — Add `testWriteAndFlushUnsupportedCode()` 
that asserts:
      - The returned `ChannelFuture` is done immediately (`isDone() == true`)
      - It is not successful (`isSuccess() == false`)
      - The root cause is `UnsupportedOperationException` containing the 
unsupported code value
   
   **No other files need changing.** The `catch (Throwable t)` block, the 
`thenAccept`/`exceptionally` wiring, and both concrete subclasses 
(`RemotingChannel`, `GrpcClientChannel`) are all correct.
   
   ### Edge Cases Covered
   - `null` msg → NPE caught by existing `catch` block
   - Non-`RemotingCommand` msg → routes to `processOtherMessage` as before
   - Unsupported code with null extFields → harmless wasted `HashMap` allocation
   
   ### Verification
   ```
   mvn -pl proxy test -Dtest=ProxyChannelTest#testWriteAndFlushUnsupportedCode 
-q
   mvn -pl proxy test -q  # full regression
   ```
   
   ---
   Reply `/approve` to proceed with PR generation · `/revise <feedback>` to 
request changes · `/reject` to decline
   
   *Automated fix proposal by github-manager-bot*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to