Skip to content

fix: use random port on each startApp to avoid port binding conflict in DbLiteTest#6560

Closed
vividctrlalt wants to merge 3 commits intotronprotocol:developfrom
vividctrlalt:develop
Closed

fix: use random port on each startApp to avoid port binding conflict in DbLiteTest#6560
vividctrlalt wants to merge 3 commits intotronprotocol:developfrom
vividctrlalt:develop

Conversation

@vividctrlalt
Copy link
Contributor

Summary

  • Fix flaky test DbLiteRocksDbTest.testToolsWithRocksDB caused by TCP port binding conflict
  • DbLiteTest.testTools() calls startApp() 4 times in a single test, but the RPC port was only set once in init(). After shutdown(), the port may remain in TCP TIME_WAIT state, causing the next startApp() to fail with Failed to bind to address 0.0.0.0:xxxx
  • Fix: call PublicMethod.chooseRandomPort() at the beginning of each startApp() to ensure a fresh port every time

Test plan

  • DbLiteRocksDbTest.testToolsWithRocksDB passed 3/3 runs locally
  • DbLiteLevelDbTest.testToolsWithLevelDB passed 3/3 runs locally
  • DbLiteRocksDbV2Test.testToolsWithRocksDB passed 3/3 runs locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant