bajiaoshan opened a new issue, #16533: URL: https://github.com/apache/dubbo/issues/16533
## Environment - Apache Dubbo Java SDK, branch `3.3`, version `3.3.7-SNAPSHOT`. - Base commit: `843b98b3a1c70134e965ab04efc2de668238e0b2`. - Windows 11, Eclipse Temurin JDK 17.0.20.1, Maven 3.9.14. ## Reproduction Create a `DefaultFuture` with a channel, request and `ThreadlessExecutor`, then call `cancel(false)` twice. The first call removes the request from `FUTURES`; the second call throws `NullPointerException` in `shutdownExecutorIfNeeded()`. The same exception occurs when cancelling after a normal response or timeout notification has removed the request, or from a completion callback invoked by `DefaultFuture.received()`. ## Expected behavior Cancellation cleanup should be safe when the in-flight request has already been removed. Existing success or timeout outcomes should be preserved, the request/channel records should remain cleared, and a per-call `ThreadlessExecutor` should be shut down. ## Actual behavior `cancel()` passes the return value of `FUTURES.remove(id)` to `shutdownExecutorIfNeeded()`. That return value is null after a previous cancellation, response, or timeout. The helper dereferences it through `future.getExecutor()`. ```text java.lang.NullPointerException: Cannot invoke "org.apache.dubbo.remoting.exchange.support.DefaultFuture.getExecutor()" because "future" is null ``` ## Regression evidence Four deterministic regression tests cover repeated cancellation, cancellation after response, cancellation after timeout, and cancellation from a completion callback. All four reproduce the null dereference on the unmodified production code (three assertion failures and one exceptional completion). They require no external service or sleeps to arrange the scenarios. The proposed fix removes the request entry as before and performs executor cleanup using the owning future (`this`) rather than the nullable map removal result. All four tests then pass and verify that request/channel state is cleared, the executor is shut down, and existing response/timeout outcomes are retained. Existing issues and pull requests were searched for this cancellation/null-dereference problem. A fix and regression tests are ready to submit. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
