Skip to content

Commit ac54ab8

Browse files
committed
fix(config): remove sentinel conversions, use reference.conf defaults
Remove incorrect if(==sentinel)→default conversions from Args.java that were added during refactoring. These break user configs that explicitly set the sentinel value (e.g. minEffectiveConnection=0 in system-test). Now reference.conf provides the actual default values directly: - rpcThreadNum: sentinel 16→0 (0 means auto-detect) - maxConcurrentCallsPerConnection: 100→2147483647 (Integer.MAX_VALUE) - flowControlWindow: 0→1048576 (1MB, gRPC default) - maxMessageSize: 0→4194304 (4MB, gRPC default) - maxHeaderListSize: 0→8192 (gRPC default) - minEffectiveConnection: remove if(==0)→1 conversion entirely
1 parent 1bbbe5a commit ac54ab8

2 files changed

Lines changed: 11 additions & 28 deletions

File tree

common/src/main/resources/reference.conf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -268,27 +268,27 @@ node {
268268
PBFTEnable = true
269269
PBFTPort = 50071
270270

271-
# Number of gRPC threads, default availableProcessors / 2
272-
thread = 16
271+
# Number of gRPC threads, 0 = auto (availableProcessors / 2)
272+
thread = 0
273273

274274
# Maximum concurrent calls per incoming connection
275-
# 100 triggers Args conversion to Integer.MAX_VALUE (no limit)
276-
maxConcurrentCallsPerConnection = 100
275+
# No limit on concurrent calls per connection
276+
maxConcurrentCallsPerConnection = 2147483647
277277

278-
# 0 = use gRPC default (1MB)
279-
flowControlWindow = 0
278+
# HTTP/2 flow control window (bytes), default 1MB
279+
flowControlWindow = 1048576
280280

281281
# Connection idle timeout (ms). No limit by default.
282282
maxConnectionIdleInMillis = 9223372036854775807
283283

284284
# Connection max age (ms). No limit by default.
285285
maxConnectionAgeInMillis = 9223372036854775807
286286

287-
# 0 = use gRPC default (4MB)
288-
maxMessageSize = 0
287+
# Maximum message size (bytes), default 4MB
288+
maxMessageSize = 4194304
289289

290-
# 0 = use gRPC default (8192)
291-
maxHeaderListSize = 0
290+
# Maximum header list size (bytes), default 8192
291+
maxHeaderListSize = 8192
292292

293293
# RST_STREAM frames allowed per connection per period, 0 = no limit
294294
maxRstStream = 0

framework/src/main/java/org/tron/core/config/args/Args.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -543,36 +543,19 @@ private static void applyNodeConfig(NodeConfig nc) {
543543
PARAMETER.rpcOnSolidityPort = rpc.getSolidityPort();
544544
PARAMETER.rpcOnPBFTPort = rpc.getPBFTPort();
545545
PARAMETER.rpcThreadNum = rpc.getThread();
546-
if (PARAMETER.rpcThreadNum == 16) {
547-
// default from bean — apply dynamic default: (CPUs + 1) / 2
546+
if (PARAMETER.rpcThreadNum == 0) {
548547
PARAMETER.rpcThreadNum = (Runtime.getRuntime().availableProcessors() + 1) / 2;
549548
}
550549
PARAMETER.maxConcurrentCallsPerConnection = rpc.getMaxConcurrentCallsPerConnection();
551-
if (PARAMETER.maxConcurrentCallsPerConnection == 100) {
552-
// bean default 100 — original code used Integer.MAX_VALUE as default
553-
PARAMETER.maxConcurrentCallsPerConnection = Integer.MAX_VALUE;
554-
}
555550
PARAMETER.flowControlWindow = rpc.getFlowControlWindow();
556-
if (PARAMETER.flowControlWindow == 0) {
557-
PARAMETER.flowControlWindow = NettyServerBuilder.DEFAULT_FLOW_CONTROL_WINDOW;
558-
}
559551
PARAMETER.rpcMaxRstStream = rpc.getMaxRstStream();
560552
PARAMETER.rpcSecondsPerWindow = rpc.getSecondsPerWindow();
561553
PARAMETER.maxConnectionIdleInMillis = rpc.getMaxConnectionIdleInMillis();
562554
PARAMETER.maxConnectionAgeInMillis = rpc.getMaxConnectionAgeInMillis();
563555
PARAMETER.maxMessageSize = rpc.getMaxMessageSize();
564-
if (PARAMETER.maxMessageSize == 0) {
565-
PARAMETER.maxMessageSize = GrpcUtil.DEFAULT_MAX_MESSAGE_SIZE;
566-
}
567556
PARAMETER.maxHeaderListSize = rpc.getMaxHeaderListSize();
568-
if (PARAMETER.maxHeaderListSize == 0) {
569-
PARAMETER.maxHeaderListSize = GrpcUtil.DEFAULT_MAX_HEADER_LIST_SIZE;
570-
}
571557
PARAMETER.isRpcReflectionServiceEnable = rpc.isReflectionService();
572558
PARAMETER.minEffectiveConnection = rpc.getMinEffectiveConnection();
573-
if (PARAMETER.minEffectiveConnection == 0) {
574-
PARAMETER.minEffectiveConnection = 1;
575-
}
576559
PARAMETER.trxCacheEnable = rpc.isTrxCacheEnable();
577560

578561
// ---- HTTP sub-bean ----

0 commit comments

Comments
 (0)