3434import io .questdb .cairo .SqlJitMode ;
3535import io .questdb .cairo .TableUtils ;
3636import io .questdb .cairo .sql .SqlExecutionCircuitBreakerConfiguration ;
37+ import io .questdb .cutlass .auth .AuthUtils ;
3738import io .questdb .cutlass .http .HttpContextConfiguration ;
3839import io .questdb .cutlass .http .HttpFullFatServerConfiguration ;
3940import io .questdb .cutlass .http .HttpServerConfiguration ;
@@ -139,6 +140,7 @@ public class PropServerConfiguration implements ServerConfiguration {
139140 public static final long COMMIT_INTERVAL_DEFAULT = 2000 ;
140141 public static final String CONFIG_DIRECTORY = "conf" ;
141142 public static final String DB_DIRECTORY = "db" ;
143+ public static final int MIN_TCP_ILP_BUF_SIZE = AuthUtils .CHALLENGE_LEN + 1 ;
142144 public static final String TMP_DIRECTORY = "tmp" ;
143145 private static final String ILP_PROTO_SUPPORT_VERSIONS = "[1,2]" ;
144146 private static final String ILP_PROTO_SUPPORT_VERSIONS_NAME = "line.proto.support.versions" ;
@@ -223,6 +225,7 @@ public class PropServerConfiguration implements ServerConfiguration {
223225 private final PropHttpConcurrentCacheConfiguration httpMinConcurrentCacheConfiguration = new PropHttpConcurrentCacheConfiguration ();
224226 private final PropHttpContextConfiguration httpMinContextConfiguration ;
225227 private final boolean httpMinServerEnabled ;
228+ private final long httpNetAcceptLoopTimeout ;
226229 private final boolean httpNetConnectionHint ;
227230 private final String httpPassword ;
228231 private final boolean httpPessimisticHealthCheckEnabled ;
@@ -535,6 +538,7 @@ public class PropServerConfiguration implements ServerConfiguration {
535538 private short floatDefaultColumnType ;
536539 private int httpMinBindIPv4Address ;
537540 private int httpMinBindPort ;
541+ private long httpMinNetAcceptLoopTimeout ;
538542 private boolean httpMinNetConnectionHint ;
539543 private int httpMinNetConnectionLimit ;
540544 private long httpMinNetConnectionQueueTimeout ;
@@ -576,6 +580,7 @@ public class PropServerConfiguration implements ServerConfiguration {
576580 private long lineTcpMaintenanceInterval ;
577581 private int lineTcpMaxMeasurementSize ;
578582 private long lineTcpMaxRecvBufferSize ;
583+ private long lineTcpNetAcceptLoopTimeout ;
579584 private int lineTcpNetBindIPv4Address ;
580585 private int lineTcpNetBindPort ;
581586 private long lineTcpNetConnectionHeartbeatInterval ;
@@ -616,6 +621,7 @@ public class PropServerConfiguration implements ServerConfiguration {
616621 private int pgNamedStatementCacheCapacity ;
617622 private int pgNamedStatementLimit ;
618623 private int pgNamesStatementPoolCapacity ;
624+ private long pgNetAcceptLoopTimeout ;
619625 private int pgNetBindIPv4Address ;
620626 private int pgNetBindPort ;
621627 private boolean pgNetConnectionHint ;
@@ -942,6 +948,7 @@ public PropServerConfiguration(
942948 httpMinBindPort = p ;
943949 });
944950
951+ this .httpMinNetAcceptLoopTimeout = getMillis (properties , env , PropertyKey .HTTP_MIN_NET_ACCEPT_LOOP_TIMEOUT , 500 );
945952 this .httpMinNetConnectionLimit = getInt (properties , env , PropertyKey .HTTP_MIN_NET_CONNECTION_LIMIT , 64 );
946953
947954 // deprecated
@@ -1062,6 +1069,8 @@ public PropServerConfiguration(
10621069 boolean httpServerCookiesEnabled = getBoolean (properties , env , PropertyKey .HTTP_SERVER_KEEP_ALIVE , true );
10631070 boolean httpReadOnlySecurityContext = getBoolean (properties , env , PropertyKey .HTTP_SECURITY_READONLY , false );
10641071
1072+ this .httpNetAcceptLoopTimeout = getMillis (properties , env , PropertyKey .HTTP_NET_ACCEPT_LOOP_TIMEOUT , 500 );
1073+
10651074 // maintain deprecated property name for the time being
10661075 this .httpNetConnectionLimit = getInt (properties , env , PropertyKey .HTTP_NET_ACTIVE_CONNECTION_LIMIT , 256 );
10671076 this .httpNetConnectionLimit = getInt (properties , env , PropertyKey .HTTP_NET_CONNECTION_LIMIT , httpNetConnectionLimit );
@@ -1227,6 +1236,8 @@ public PropServerConfiguration(
12271236 pgNetBindPort = p ;
12281237 });
12291238
1239+ this .pgNetAcceptLoopTimeout = getMillis (properties , env , PropertyKey .PG_NET_ACCEPT_LOOP_TIMEOUT , 500 );
1240+
12301241 // deprecated
12311242 this .pgNetIdleConnectionTimeout = getMillis (properties , env , PropertyKey .PG_NET_IDLE_TIMEOUT , 300_000 );
12321243 this .pgNetIdleConnectionTimeout = getMillis (properties , env , PropertyKey .PG_NET_CONNECTION_TIMEOUT , this .pgNetIdleConnectionTimeout );
@@ -1502,7 +1513,7 @@ public PropServerConfiguration(
15021513 this .telemetryDisableCompletely = getBoolean (properties , env , PropertyKey .TELEMETRY_DISABLE_COMPLETELY , false );
15031514 this .telemetryQueueCapacity = Numbers .ceilPow2 (getInt (properties , env , PropertyKey .TELEMETRY_QUEUE_CAPACITY , 512 ));
15041515 this .telemetryHideTables = getBoolean (properties , env , PropertyKey .TELEMETRY_HIDE_TABLES , true );
1505- this .telemetryDbSizeEstimateTimeout = getLong (properties , env , PropertyKey .TELEMETRY_DB_SIZE_ESTIMATE_TIMEOUT , Timestamps .SECOND_MILLIS );
1516+ this .telemetryDbSizeEstimateTimeout = getMillis (properties , env , PropertyKey .TELEMETRY_DB_SIZE_ESTIMATE_TIMEOUT , Timestamps .SECOND_MILLIS );
15061517 this .o3PartitionPurgeListCapacity = getInt (properties , env , PropertyKey .CAIRO_O3_PARTITION_PURGE_LIST_INITIAL_CAPACITY , 1 );
15071518 this .ioURingEnabled = getBoolean (properties , env , PropertyKey .CAIRO_IO_URING_ENABLED , true );
15081519 this .cairoMaxCrashFiles = getInt (properties , env , PropertyKey .CAIRO_MAX_CRASH_FILES , 100 );
@@ -1546,6 +1557,8 @@ public PropServerConfiguration(
15461557 lineTcpNetBindPort = p ;
15471558 });
15481559
1560+ this .lineTcpNetAcceptLoopTimeout = getMillis (properties , env , PropertyKey .LINE_TCP_NET_ACCEPT_LOOP_TIMEOUT , 500 );
1561+
15491562 // deprecated
15501563 this .lineTcpNetConnectionTimeout = getMillis (properties , env , PropertyKey .LINE_TCP_NET_IDLE_TIMEOUT , 0 );
15511564 this .lineTcpNetConnectionTimeout = getMillis (properties , env , PropertyKey .LINE_TCP_NET_CONNECTION_TIMEOUT , this .lineTcpNetConnectionTimeout );
@@ -1570,6 +1583,11 @@ public PropServerConfiguration(
15701583 if (lineTcpRecvBufferSize > lineTcpMaxRecvBufferSize ) {
15711584 lineTcpMaxRecvBufferSize = lineTcpRecvBufferSize ;
15721585 }
1586+ if (lineTcpRecvBufferSize < MIN_TCP_ILP_BUF_SIZE ) {
1587+ throw new ServerConfigurationException (
1588+ "TCP ILP buffer size is too small, should be at least " + MIN_TCP_ILP_BUF_SIZE + ", ["
1589+ + PropertyKey .LINE_TCP_RECV_BUFFER_SIZE .getPropertyPath () + "=" + lineTcpRecvBufferSize + ']' );
1590+ }
15731591
15741592 this .lineTcpWriterQueueCapacity = getQueueCapacity (properties , env , PropertyKey .LINE_TCP_WRITER_QUEUE_CAPACITY , 128 );
15751593 this .lineTcpWriterWorkerCount = getInt (properties , env , PropertyKey .LINE_TCP_WRITER_WORKER_COUNT , 0 );
@@ -3965,6 +3983,12 @@ public int getRows() {
39653983 }
39663984
39673985 public class PropHttpMinServerConfiguration implements HttpServerConfiguration {
3986+
3987+ @ Override
3988+ public long getAcceptLoopTimeout () {
3989+ return httpMinNetAcceptLoopTimeout ;
3990+ }
3991+
39683992 @ Override
39693993 public int getBindIPv4Address () {
39703994 return httpMinBindIPv4Address ;
@@ -4153,6 +4177,11 @@ public int workerPoolPriority() {
41534177
41544178 public class PropHttpServerConfiguration implements HttpFullFatServerConfiguration {
41554179
4180+ @ Override
4181+ public long getAcceptLoopTimeout () {
4182+ return httpNetAcceptLoopTimeout ;
4183+ }
4184+
41564185 @ Override
41574186 public int getBindIPv4Address () {
41584187 return httpNetBindIPv4Address ;
@@ -4579,6 +4608,12 @@ public boolean haltOnError() {
45794608 }
45804609
45814610 private class PropLineTcpReceiverConfiguration implements LineTcpReceiverConfiguration {
4611+
4612+ @ Override
4613+ public long getAcceptLoopTimeout () {
4614+ return lineTcpNetAcceptLoopTimeout ;
4615+ }
4616+
45824617 @ Override
45834618 public String getAuthDB () {
45844619 return lineTcpAuthDB ;
@@ -5077,6 +5112,11 @@ public int getRows() {
50775112
50785113 private class PropPGWireConfiguration implements PGWireConfiguration {
50795114
5115+ @ Override
5116+ public long getAcceptLoopTimeout () {
5117+ return pgNetAcceptLoopTimeout ;
5118+ }
5119+
50805120 @ Override
50815121 public int getBinParamCountCapacity () {
50825122 return pgBinaryParamsCapacity ;
0 commit comments