Repository navigation
fix: avoid remote lock stale bind hangs - #24232
Merged
mergify[bot] merged 3 commits intoApr 29, 2026
Merged
Conversation
Backport matrixorigin#24206 to main. Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR backports fixes for remote/forward lock hangs caused by broken response paths and stale remote lock bind tracking by switching response writes to bounded synchronous writes and tracking keepalives at bind granularity.
Changes:
- Use bounded synchronous response writes for remote/forward lock responses to avoid requesters hanging in
morpc.Future.Get(). - Track remote keepalive per (remote service + bind) and update orphan detection/cleanup accordingly.
- Add/adjust regression tests covering bounded response writes, stale-bind orphan cleanup, and multi-bind keepalive refresh.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/lockservice/waiter_events.go | Add bind-level heartbeat check during orphan detection using configured remote lock timeout. |
| pkg/lockservice/txn_test.go | Update newWaiterEvents call signature in tests. |
| pkg/lockservice/service_remote.go | Switch remote/forward lock response path to writeResponseWithDeadline; update remote keepalive tracking and remoteService attribution. |
| pkg/lockservice/service_forward_test.go | Assert forwarded txn records remote service and bind heartbeat presence. |
| pkg/lockservice/service.go | Add bind-level keepalive tracking to activeTxnHolder; implement bind heartbeat map + keying and safe-unlock checks. |
| pkg/lockservice/rpc_test.go | Add tests ensuring response writes use sync Write with deadlines. |
| pkg/lockservice/rpc.go | Introduce defaultRPCWriteTimeout; implement writeResponseWithDeadline and route writeResponse through it. |
| pkg/lockservice/orphan_txn_test.go | Add tests for missing bind heartbeat unlock behavior and multi-bind keepalive refresh; add canUnlockRemoteTxn unit tests. |
| pkg/lockservice/lock_table_local_test.go | Update newWaiterEvents call signature in tests. |
| pkg/lockservice/lock_table_keeper_test.go | Update newWaiterEvents call signature in tests. |
| pkg/lockservice/lock_table_keeper.go | Change remote keepalive to send heartbeats per bind (not per service). |
| pkg/common/morpc/server_test.go | Add tests for bounded ClientSession.Write, message release on queue-full, and write-loop failure handling. |
| pkg/common/morpc/server.go | Add server option to release dropped responses; make write loop complete/close futures on failures and release messages on non-delivery paths. |
| pkg/common/morpc/cfg.go | Wire new server option to provide response release callback to the server write loop. |
Co-authored-by: Copilot <[email protected]>
XuPeng-SH
approved these changes
Apr 29, 2026
Contributor
Merge Queue Status
This pull request spent 59 minutes 49 seconds in the queue, including 59 minutes 27 seconds running CI. Required conditions to merge
|
fengttt
pushed a commit
to fengttt/matrixone
that referenced
this pull request
May 7, 2026
This backports matrixorigin#24206 to `main`. The remote lock / forward lock response path could still leave the requester hung in `morpc.Future.Get()` after the owner had already taken the lock, and remote keepalive tracking at service granularity could leave stale remote holders behind after one bind was lost. This backport switches the remote lock result path to bounded synchronous writes, keeps the lock outcome separate from response write failures, tracks remote keepalive at bind granularity during orphan detection, and sends `KeepRemoteLock` heartbeats per bind so multiple remote tables on the same peer are all refreshed. Also included: - regression coverage for bounded response writes - stale-bind orphan cleanup coverage adapted to `main`'s current lockservice test helpers - multi-bind keepalive refresh coverage Approved by: @iamlinjunhong, @XuPeng-SH
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
This backports matrixorigin#24206 to `main`. The remote lock / forward lock response path could still leave the requester hung in `morpc.Future.Get()` after the owner had already taken the lock, and remote keepalive tracking at service granularity could leave stale remote holders behind after one bind was lost. This backport switches the remote lock result path to bounded synchronous writes, keeps the lock outcome separate from response write failures, tracks remote keepalive at bind granularity during orphan detection, and sends `KeepRemoteLock` heartbeats per bind so multiple remote tables on the same peer are all refreshed. Also included: - regression coverage for bounded response writes - stale-bind orphan cleanup coverage adapted to `main`'s current lockservice test helpers - multi-bind keepalive refresh coverage Approved by: @iamlinjunhong, @XuPeng-SH
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
This backports matrixorigin#24206 to `main`. The remote lock / forward lock response path could still leave the requester hung in `morpc.Future.Get()` after the owner had already taken the lock, and remote keepalive tracking at service granularity could leave stale remote holders behind after one bind was lost. This backport switches the remote lock result path to bounded synchronous writes, keeps the lock outcome separate from response write failures, tracks remote keepalive at bind granularity during orphan detection, and sends `KeepRemoteLock` heartbeats per bind so multiple remote tables on the same peer are all refreshed. Also included: - regression coverage for bounded response writes - stale-bind orphan cleanup coverage adapted to `main`'s current lockservice test helpers - multi-bind keepalive refresh coverage Approved by: @iamlinjunhong, @XuPeng-SH
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
This backports matrixorigin#24206 to `main`. The remote lock / forward lock response path could still leave the requester hung in `morpc.Future.Get()` after the owner had already taken the lock, and remote keepalive tracking at service granularity could leave stale remote holders behind after one bind was lost. This backport switches the remote lock result path to bounded synchronous writes, keeps the lock outcome separate from response write failures, tracks remote keepalive at bind granularity during orphan detection, and sends `KeepRemoteLock` heartbeats per bind so multiple remote tables on the same peer are all refreshed. Also included: - regression coverage for bounded response writes - stale-bind orphan cleanup coverage adapted to `main`'s current lockservice test helpers - multi-bind keepalive refresh coverage Approved by: @iamlinjunhong, @XuPeng-SH
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
fixes #24205
What this PR does / why we need it:
This backports #24206 to
main.The remote lock / forward lock response path could still leave the requester hung in
morpc.Future.Get()after the owner had already taken the lock, and remote keepalive tracking at service granularity could leave stale remote holders behind after one bind was lost.This backport switches the remote lock result path to bounded synchronous writes, keeps the lock outcome separate from response write failures, tracks remote keepalive at bind granularity during orphan detection, and sends
KeepRemoteLockheartbeats per bind so multiple remote tables on the same peer are all refreshed.Also included:
main's current lockservice test helpersValidation
go test ./pkg/common/morpc ./pkg/lockservice -count=1