hashicorp/yamux

When MaxStreamWindowSize is larger than initialStreamWindow, should lead to short read

wllenyj opened this issue · 1 comments

OpenStream call sendWindowUpdate, then sendWindowUpdate will sync window from client to server.
incrSendWindow and wirte will happen race. if incrSendWindow first run it is ok, else will lead sendWindow is not the same value to recvWindow, will out of sync.

// session_test.go
func TestSendData_Large(t *testing.T) {
    cfg := testConf()
    cfg.MaxStreamWindowSize = 4 * 1024 
    // ...
}
// const.go
const (
    // initialStreamWindow is the initial stream window size
    initialStreamWindow uint32 = 1 * 1024
)
=== RUN   TestSendData_Large
--- FAIL: TestSendData_Large (5.00s)
        session_test.go:415: short read: 1024
        session_test.go:441: err: stream reset
panic: timeout [recovered]
        panic: timeout

if MaxStreamWindowSize is not used for like this issue, please close.