This is an automated email from the ASF dual-hosted git repository.
git-hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new 4729a71b4 fix(test): treat ECONNRESET as graceful in SimpleTCPProxy
(#3574)
4729a71b4 is described below
commit 4729a71b470da5236c384a7266946d786d38268b
Author: nhancdt2602 <[email protected]>
AuthorDate: Mon Aug 3 19:02:17 2026 +0700
fix(test): treat ECONNRESET as graceful in SimpleTCPProxy (#3574)
Fixes #3515.
This treats ECONNRESET the same as io.EOF in SimpleTCPProxy's copy loop
as both are expected outcomes of an intentional teardown.
---
tests/gocase/util/client.go | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests/gocase/util/client.go b/tests/gocase/util/client.go
index 49a4e929a..e1761cb28 100644
--- a/tests/gocase/util/client.go
+++ b/tests/gocase/util/client.go
@@ -28,6 +28,7 @@ import (
"regexp"
"strings"
"sync/atomic"
+ "syscall"
"testing"
"time"
@@ -104,14 +105,17 @@ func SimpleTCPProxy(ctx context.Context, t testing.TB, to
string, slowdown bool)
}
n, err := src.Read(buffer)
if err != nil {
- if errors.Is(err, io.EOF) {
+ // ECONNRESET can happen
instead of io.EOF when the peer closes
+ // the connection abortively
(e.g. with unread data still
+ // buffered), which is expected
during intentional teardown.
+ if errors.Is(err, io.EOF) ||
errors.Is(err, syscall.ECONNRESET) {
break COPY_LOOP
}
return err
}
_, err = dest.Write(buffer[:n])
if err != nil {
- if errors.Is(err, io.EOF) {
+ if errors.Is(err, io.EOF) ||
errors.Is(err, syscall.ECONNRESET) {
break COPY_LOOP
}
return err