You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: closing a morpc backend leaves response-waiting Futures blocked #25945
rb.clean() only deletes entries from rb.mu.futures; it does not call Future.error. A Future that has already received its write completion therefore remains blocked in Get() until its caller-owned request context expires, even though the backend is definitively closed.
Impact
In-flight RPC calls do not fail promptly when a client/backend is closed.
Shutdown and cancellation can remain blocked until long business deadlines expire.
The backend loses the future from its tracking map without delivering a terminal result.
Reproduction
Using a real local morpc connection:
Let the server accept a request without replying.
Wait until the Future reports that the request was successfully written.
Call remoteBackend.Close().
Call Future.Get() with a 30-second request context.
The audit ran this sequence three times. In all 3/3 runs, Get() was still blocked after the backend and both read/write loops had stopped; it returned only after the test explicitly canceled the request context.
go test ./pkg/common/morpc \
-run '^TestAuditCloseBackendCompletesFutureAlreadyWaitingForResponse$' \
-count=3 -v
Expected behavior
Backend.Close() must complete every tracked Future with a closed/canceled backend error, including requests already written and waiting for a response.
GitHub main was checked before filing and still uses rb.clean() without notifying waiting futures.
Suggested direction
Before removing tracked futures during backend shutdown, notify them with a terminal backend-closed error. Keep future-map cleanup and notification ordering safe with respect to Future.Close and pool reuse.
同时覆盖关闭后的 stream、handle、channel 不被错误复用,以及移除 active stream 时不长期持有 backend mutex 的路径。
执行命令:
go test ./pkg/common/morpc \
-run '^(TestCloseBackendNotifiesWaitingFuture|TestClosedStreamHandleAndChannelAreNotReused|TestRemoveActiveStreamDoesNotHoldBackendMutexWhileUnlocking)$' \
-count=10
go test -race ./pkg/common/morpc \
-run '^TestCloseBackendNotifiesWaitingFuture$' \
-count=1
Activity
fix(morpc): terminate pending work during backend and stream close (#…
Ariznawlll commentedon Jul 22, 2026
已在最新
main上完成验证,结论:该问题已修复。测试版本
main50319026a69e45c3c190cb7a09e9c5fbdb7f6857e917fbfc5测试步骤
remoteBackend.Close(),模拟 backend 关闭。执行命令:
测试结果
-race模式通过,未发现数据竞争。因此,issue 描述的“关闭 backend 后等待响应的 Future 仍长期阻塞”在当前 main 上未再复现。
该场景依赖 morpc 内部 Future/stream/backend 生命周期,属于白盒并发测试,不适合转换为 motr SQL 黑盒用例;回归由 MatrixOne morpc UT 和 race 测试覆盖。
fix(morpc): terminate pending work during backend and stream close (m…
fix(morpc): terminate pending work during backend and stream close (m…
fix(morpc): terminate pending work during backend and stream close (m…