go/internal/jsonrpc2_v2
Bryan C. Mills bd04e329ae internal/jsonrpc2_v2: eliminate a potential Accept/Dial race in TestIdleTimeout
The only explanation I can think of for the failure in
https://go.dev/issue/49387#issuecomment-1303979877 is that maybe the
idle timeout started as soon as conn1 was closed, without waiting for
conn2 to be closed. That might be possible if the connection returned
by Dial was still in the server's accept queue, but never actually
accepted.

To eliminate that possibility, we can send an RPC on that connection
and wait for a response, as we already do with conn1. Since the conn1
RPC succeeded, we know that the connection is non-idle, conn2 should
be accepted, and the request on conn2 should succeed unconditionally.

Fixes golang/go#49387 (hopefully for real this time).

Change-Id: Ie3e74f91d322223d82c000fdf1f3a0ed08afd20d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/448096
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2022-11-09 14:00:02 +00:00
..
conn.go internal/jsonrpc2_v2: fix a potential deadlock when (*Conn).Close is invoked during Bind 2022-11-09 13:57:32 +00:00
frame.go internal/jsonrpc2_v2: initiate shutdown when the Writer breaks 2022-11-02 21:32:11 +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: eliminate a potential Accept/Dial race in TestIdleTimeout 2022-11-09 14:00:02 +00:00
wire.go internal/jsonrpc2_v2: rework concurrency in idleListener 2022-10-17 20:15:04 +00:00
wire_test.go