Asthenia0412 opened a new pull request, #16505:
URL: https://github.com/apache/dubbo/pull/16505
## Summary
Fixes #13853
### Problem
In `NettyConnectionClient.ConnectionListener#operationComplete`, the failed
reconnection logic used `EventLoop.schedule` to schedule the reconnection task.
The reconnection attempt (`doConnect()`) blocks for up to the connect timeout
(default 3 seconds). If the server is unreachable, this loop repeats
indefinitely, occupying the EventLoop CPU and delaying all other channels
registered on the same EventLoop.
### Root Cause
`EventLoop.schedule(() -> { doConnect(); }, 1L, TimeUnit.SECONDS)` —
`doConnect()` contains
`connectingPromise.awaitUninterruptibly(getConnectTimeout(), ...)` which blocks
the EventLoop thread.
### Solution
Move the reconnect retry execution from the channel's `EventLoop` to an
independent `ScheduledExecutorService` (`connectivityExecutor`) provided by
`FrameworkExecutorRepository`. The EventLoop thread only handles the callback
completion and is not blocked by network reconnection work.
### Changes
1. Added `connectivityExecutor` field initialized from
`FrameworkExecutorRepository#getConnectivityScheduledExecutor()`
2. Replaced `future.channel().eventLoop().schedule(...)` with
`connectivityExecutor.schedule(...)`
3. Removed unused `EventLoop` import
### Author
yancy (Asthenia0412)
Closes #13853
--
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]