Skip to content

Commit 881d2d7

Browse files
craig[bot]rafiss
andcommitted
Merge #154916
154916: pgwire: lower the max repeated error count before closing a connection r=rafiss a=rafiss In 39067de (#71940) we added behavior to give up and close a network connection if a threshold of repeated errors was reached. It retried on errors since some network errors could be transient. It was retrying tens of thousands of times, which is excessive. We lower this to 256 now. This is motivated by a few tests that identifed the error handling logic in this tight loop being quite expensive. Retrying fewer times means that we'll reduce CPU usage during failure scenarios. fixes #153550 informs #153772 (comment) Release note: None Co-authored-by: Rafi Shamim <[email protected]>
2 parents 39b6044 + 5f562ad commit 881d2d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/sql/pgwire/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ func (s *Server) newConn(
10771077
// maxRepeatedErrorCount is the number of times an error can be received
10781078
// while reading from the network connection before the server decides to give
10791079
// up and abort the connection.
1080-
const maxRepeatedErrorCount = 1 << 15
1080+
const maxRepeatedErrorCount = 1 << 8
10811081

10821082
// serveImpl continuously reads from the network connection and pushes execution
10831083
// instructions into a sql.StmtBuf, from where they'll be processed by a command

0 commit comments

Comments
 (0)