@@ -94,6 +94,15 @@ var logVerboseSessionAuth = settings.RegisterBoolSetting(
9494 false ,
9595 settings .WithPublic )
9696
97+ var maxRepeatedErrorCount = settings .RegisterIntSetting (
98+ settings .ApplicationLevel ,
99+ "sql.pgwire.max_repeated_error_count" ,
100+ "the maximum number of times an error can be received while reading from a " +
101+ "network connection before the server aborts the connection" ,
102+ 1 << 15 , // 32768
103+ settings .PositiveInt ,
104+ )
105+
97106const (
98107 // ErrSSLRequired is returned when a client attempts to connect to a
99108 // secure server in cleartext.
@@ -1072,11 +1081,6 @@ func (s *Server) newConn(
10721081 return c
10731082}
10741083
1075- // maxRepeatedErrorCount is the number of times an error can be received
1076- // while reading from the network connection before the server decides to give
1077- // up and abort the connection.
1078- const maxRepeatedErrorCount = 1 << 15
1079-
10801084// serveImpl continuously reads from the network connection and pushes execution
10811085// instructions into a sql.StmtBuf, from where they'll be processed by a command
10821086// "processor" goroutine (a connExecutor).
@@ -1448,7 +1452,7 @@ func (s *Server) serveImpl(
14481452 // 3. we reached an arbitrary threshold of repeated errors.
14491453 if netutil .IsClosedConnection (err ) ||
14501454 errors .Is (err , context .Canceled ) ||
1451- repeatedErrorCount > maxRepeatedErrorCount {
1455+ repeatedErrorCount > int ( maxRepeatedErrorCount . Get ( & s . execCfg . Settings . SV )) {
14521456 break
14531457 }
14541458 } else {
0 commit comments