aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/flatrpc
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-07-11 11:43:41 +0200
committerAleksandr Nogikh <nogikh@google.com>2024-07-11 10:39:33 +0000
commitbaf24fbe840b2b9fd49636f49fd6fa42f39290b9 (patch)
tree84d4b385c05fc24bf66c3fd73f359ae4e65d8239 /pkg/flatrpc
parenteba8394c4eea3a25682631625fea564acc0c0356 (diff)
pkg/rpcserver: debug executor stalls
In some cases, the executor seems to be mysteriously silent when we were awaiting a reply. During pkg/runtest tests, give it 1 minute to prepare a reply, then try to request the current state and abort the connection.
Diffstat (limited to 'pkg/flatrpc')
-rw-r--r--pkg/flatrpc/conn.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/pkg/flatrpc/conn.go b/pkg/flatrpc/conn.go
index 9d8d1ce59..56afdfca4 100644
--- a/pkg/flatrpc/conn.go
+++ b/pkg/flatrpc/conn.go
@@ -109,14 +109,16 @@ func Send[T sendMsg](c *Conn, msg T) error {
return nil
}
+type RecvType[T any] interface {
+ UnPack() *T
+ flatbuffers.FlatBuffer
+}
+
// Recv receives an RPC message.
// The type T is supposed to be a pointer to a normal flatbuffers type (not ending with T, e.g. *ConnectRequestRaw).
// Receiving should be done from a single goroutine, the received message is valid
// only until the next Recv call (messages share the same underlying receive buffer).
-func Recv[Raw interface {
- UnPack() *T
- flatbuffers.FlatBuffer
-}, T any](c *Conn) (res *T, err0 error) {
+func Recv[Raw RecvType[T], T any](c *Conn) (res *T, err0 error) {
defer func() {
if err1 := recover(); err1 != nil {
if err2, ok := err1.(error); ok {