go/internal/jsonrpc2_v2
Bryan C. Mills 3e8da475a3 internal/jsonrpc2_v2: initiate shutdown when the Writer breaks
Prior to this CL we already shut down a jsonrpc2_v2.Conn when its
Reader breaks, which we expect to be the common shutdown path.
However, with certain kinds of connections (notably those over
stdin+stdout), it is possible for the Writer side to fail while
the Reader remains working.

If the Writer has failed, we have no way to return the required
Response messages for incoming calls, nor to write new Request
messages of our own. Since we have no way to return a response,
we will now mark those incoming calls as canceled.

However, even if the Writer has failed we may still be able to read
the responses for any outgoing calls that are already in flight. When
our in-flight calls complete, we could in theory even continue to
process Notification messages from the Reader; however, those are
unlikely to be useful with half the connection broken. It seems more
helpful — and less surprising — to go ahead and shut down the
connection completely when it becomes idle.

Updates golang/go#46520.
Updates golang/go#49387.

Change-Id: I713f172ca7031f4211da321560fe7eae57960a48
Reviewed-on: https://go-review.googlesource.com/c/tools/+/446315
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-10-31 20:24:21 +00:00
..
conn.go internal/jsonrpc2_v2: initiate shutdown when the Writer breaks 2022-10-31 20:24:21 +00:00
frame.go internal/jsonrpc2*: remove usage of golang.org/x/xerrors 2022-04-20 16:10:40 +00:00
jsonrpc2.go internal/jsonrpc2_v2: add Func convenience wrappers for the Binder and Preempter interfaces 2022-10-18 21:38:33 +00:00
jsonrpc2_test.go internal/jsonrpc2_v2: rename Serve to NewServer and eliminate its error return 2022-10-31 15:32:39 +00:00
messages.go internal/jsonrpc2*: remove usage of golang.org/x/xerrors 2022-04-20 16:10:40 +00:00
net.go internal/jsonrpc2_v2: rework Connection concurrency 2022-10-31 15:02:00 +00:00
serve.go internal/jsonrpc2_v2: rename Serve to NewServer and eliminate its error return 2022-10-31 15:32:39 +00:00
serve_go116.go internal/jsonrpc2_v2: rework Connection concurrency 2022-10-31 15:02:00 +00:00
serve_pre116.go internal/jsonrpc2_v2: rework Connection concurrency 2022-10-31 15:02:00 +00:00
serve_test.go internal/jsonrpc2_v2: rename Serve to NewServer and eliminate its error return 2022-10-31 15:32:39 +00:00
wire.go internal/jsonrpc2_v2: rework concurrency in idleListener 2022-10-17 20:15:04 +00:00
wire_test.go