mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-09 02:47:29 +02:00
fix(pglite): resend a request the backend produced no output for
Three times during a scan on a real library, a new pool connection's first query got no bytes back at all, which the previous commit turned from a hang into an error. A run always emits at least a completion, so no output means the packet was not run; the bridge now hands it over again (twice at most) and logs it.
This commit is contained in:
parent
ba16ab4158
commit
f4effde18e
1 changed files with 11 additions and 0 deletions
|
|
@ -512,6 +512,7 @@ func (pg *PGlite) forwardWire(packet []byte, outFile string) ([][]byte, error) {
|
|||
_, _ = pg.fnUseWire.Call(ctx, api.EncodeI32(1))
|
||||
}
|
||||
var replies [][]byte
|
||||
resends := 0
|
||||
for range maxTicks {
|
||||
producedBefore := pg.collectReply(outFile, &replies)
|
||||
t0 := time.Now()
|
||||
|
|
@ -544,6 +545,16 @@ func (pg *PGlite) forwardWire(packet []byte, outFile string) ([][]byte, error) {
|
|||
}
|
||||
producedAfter := pg.collectReply(outFile, &replies)
|
||||
if !producedBefore && !producedAfter {
|
||||
// No output at all means the backend did not run the packet (a run always emits at
|
||||
// least a completion); seen right after handshakes. Hand it over again, twice at most.
|
||||
if len(packet) > 0 && len(replies) == 0 && resends < 2 {
|
||||
resends++
|
||||
fmt.Fprintf(pg.cfg.Stderr, "# bridge: empty reply to %s; resending (%d)\n", wireTags(packet), resends)
|
||||
if err := pg.send(packet, strings.TrimSuffix(outFile, ".out")); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
if endsWithReadyForQuery(replies) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue