Repository navigation
fix(config): reject negative rpc connection idle/age at startup - #7113
Conversation
|
The Coverage Gate failure on the first push was caused by a pre-existing jacoco wiring bug in
getExecutionData().setFrom(fileTree('../framework/build/jacoco').include("**.exec"))
This predates this PR. In the base artifact ( The second commit ( getExecutionData().setFrom(
fileTree("$buildDir/jacoco").include("**.exec"),
fileTree('../framework/build/jacoco').include("**.exec"))
|
|
The fix looks right to me: a negative value never worked, and rejecting it in One observation: three other
Rejecting them in A smaller note, outside this PR: |
|
@SeriousCoding789 I confirmed that The reload issue is separate: I added the |
| rpc.secondsPerWindow = RpcConfig.DEFAULT_SECONDS_PER_WINDOW; | ||
| } | ||
| if (rpc.maxConnectionIdleInMillis < 0) { | ||
| throw new TronError("node.rpc.maxConnectionIdleInMillis must be non-negative, got: " |
There was a problem hiding this comment.
The startup validation looks reasonable, but these checks also affect DynamicArgs.reload(), which calls NodeConfig.fromConfig().
If either value becomes negative during a config reload, TronError bypasses the existing catch (Exception) because it extends Error. The scheduled task then fails, and scheduleWithFixedDelay suppresses subsequent executions. The node keeps running, but peer configuration updates stop permanently, even after the file is corrected.
For context, #7015 introduced this failure path for maxRstStream and secondsPerWindow; those checks were absent in v4.8.2. This PR adds two more triggers for idle/age. The underlying reload issue predates #7015, though, since v4.8.2 already had TronError checks for negative maxMessageSize values in the same parsing path.
Could we isolate dynamic peer reload from startup-wide validation? DynamicArgs only applies node.active and node.passive, so a small change in DynamicArgs.java should be sufficient:
Config config = Configuration.getByFileName(Args.getConfigFilePath());
List<InetSocketAddress> active = Args.filterInetSocketAddress(
config.getStringList("node.active"), true);
List<InetSocketAddress> passive = Args.filterInetSocketAddress(
config.getStringList("node.passive"), false);
updateActiveNodes(active);
updateTrustNodes(passive);The two private update methods would accept the parsed lists and retain their existing update logic. Parsing both lists before modifying state prevents a malformed passive list from leaving the active list partially updated. Configuration.getByFileName() already applies the reference configuration fallback.
This preserves strict startup validation while keeping unrelated settings out of peer reload. Please add regression tests covering:
- Invalid RPC values do not block peer updates.
- Malformed peer lists preserve the current state, and a subsequent corrected reload succeeds.
Parse both peer lists before updating runtime state. Avoid validating unrelated startup settings during reload and keep the previous peer configuration if either list cannot be parsed.
What does this PR do?
Rejects negative
node.rpc.maxConnectionIdleInMillis/node.rpc.maxConnectionAgeInMillisat config parsing time inNodeConfig.postProcess(), throwingTronError(PARAMETER_INIT)— the same handling already applied tomaxRstStream,secondsPerWindowandmaxConcurrentCallsPerConnectionin the same method.Updates
common/build.gradleso thecommonJaCoCo report includes execution data from bothcommonandframeworktests.Why are these changes required?
A negative value is currently passed through to
NettyServerBuilder.maxConnectionIdle/maxConnectionAge, which throwsIllegalArgumentException("max connection idle must be positive")on the main thread when the RPC service starts.ExitManager's uncaught handler only exits onTronError, so the main thread dies, no port listens, but the non-daemon threads started earlier (pbft-timer, rewardViCalService, hit-thread) keep the JVM alive — the process hangs in a dead state until killed manually.With this change the value is rejected during
Args.setParam, before the database and any services are created.ExitManager.initExceptionHandler()is already installed at that point (FullNode.java), so the node fails fast with a clear config error and exits cleanly.Notes for reviewers:
0 = no limitsemantics are unchanged, positive values are unchanged, and a negative value has never been a working configuration (it always crashed at RPC init), so no previously-valid setup is affected and no fork gate is needed.The report previously used
setFrom(...)with only theframeworkexecution data, so it omitted coverage fromNodeConfigTesteven though the test ran. Including both inputs restores that coverage and keeps credit forcommoncode exercised byframeworktests.This PR has been tested by:
NodeConfigTest.testRpcNegativeConnectionIdleAndAgeRejected; the full class (42 tests) and the whole:common:testmodule suite pass.Follow up
Validate
flowControlWindowandmaxHeaderListSizeat startup, and handle config validation failures inDynamicArgsso a rejected reload does not stop future reloads.