panic: rpc error: code = Internal desc = SendMsg called after CloseSend
sgielen opened this issue · 2 comments
sgielen commented
Last client on an Orchestream indicates they have no more open handles:
Jun 19 22:58:48 bulbasaur discovery[20081]: 22:58:48.804918 orchestrate.go:193: Orchestrate{5577006791947779410} [P@rufs.hashru.nl] HaveOpenHandles: true
Jun 19 22:58:48 bulbasaur discovery[20081]: 22:58:48.805360 orchestrate.go:193: Orchestrate{5577006791947779410} [P@rufs.hashru.nl] HaveOpenHandles: false
Therefore, at 22:59:48 the Orchestream should close. A client, but not P@rufs.hashru.nl, panics:
22:59:47.362010 transfer.go:157: Klikspaan{5577006791947779410}: have: [{0 1939261608}]; want: []; ahead: []; downloading: []
panic: rpc error: code = Internal desc = SendMsg called after CloseSend
goroutine 67655 [running]:
github.com/sgielen/rufs/client/transfer/orchestream.(*Stream).writer(0xc0001e2a00, 0x4bf0198, 0xc00081d140)
/Users/sjors/Projecten/rufs/client/transfer/orchestream/orchestream.go:143 +0x5fb
created by github.com/sgielen/rufs/client/transfer/orchestream.New
/Users/sjors/Projecten/rufs/client/transfer/orchestream/orchestream.go:53 +0x389
exit status 2
Jille commented
I think the discovery server disconnected, that caused us to call CloseSend (https://github.com/sgielen/rufs/blob/master/client/transfer/orchestream/orchestream.go#L79). However, the writer thread assumes it'll get io.EOF when writing on a closed stream (https://github.com/sgielen/rufs/blob/master/client/transfer/orchestream/orchestream.go#L143). Which is apparently a false assumption.