fix(server): report a yamux stream that could not be opened - #6843
Conversation
Failing to open the stream was logged and then dropped: Dial fell through to its success return, handing the caller a nil connection with a nil error. The first write against it panics, which turns a device whose session is shutting down into a crashed request rather than a failed one.
|
Claude finished @otavio's task in 1m 38s —— View job Code Review CompleteReviewed 2 files across code quality, security, testing, language patterns, and architecture — no new issues found. The code looks good as-is. The fix at The regression test is deterministic — To request another review round, comment |
What
Manager.Dialnow returns the error when opening a yamux stream fails, instead of logging it and returning a nil connection with a nil error.Why
The V2 branch logged the failed
session.Open()and then fell through to the shared success return:connis a nil*yamux.Streamboxed in anet.Conn, so the interface is non-nil and the caller'serr != nilcheck passes. The first method call against it panics. A session that is shutting down — the ordinary case when a device drops while a request is in flight — becomes a crashed request rather than a failed one.Found while investigating #6777; unrelated to that fix and based on master, so the two can merge in either order.
Testing
The new test stores a closed yamux session in the manager and asserts
Dialreports the failure. Without the fix it returns(nil, TransportVersion2, nil)and the assertions on the error and the version both fail.