Skip to content

fix(vm): clear leftover thread-local VMConfig snapshot - #16

Closed
vividctrlalt wants to merge 4 commits into
developfrom
fix/rocky_ci_flakes
Closed

fix(vm): clear leftover thread-local VMConfig snapshot#16
vividctrlalt wants to merge 4 commits into
developfrom
fix/rocky_ci_flakes

Conversation

@vividctrlalt

@vividctrlalt vividctrlalt commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

Fix intermittent :framework:test failures on Rocky Linux JDK 8 after tronprotocol#6857.

The same commit is green on Debian 11 JDK 8, Ubuntu, and macOS. London / Osaka tests fail because initAllowTvm*() writes globalSnapshot while current() still reads a leftover thread-local snapshot. Assertions are unchanged.

Root cause

tronprotocol#6857 split VM config into a process-global snapshot (block processing) and a thread-local snapshot (constant calls). Getters use current() (local if present). initAllowTvm*() still mutates only the global snapshot. ConfigLoader.disable skips load(), so a leftover local view is never cleared. With forkEvery = 100, the next test on the same thread does not observe the flags it just set.

VMConfigIsolationTest does not cover this contract. Pre-tronprotocol#6857 tests (AllowTvmLondonTest, ValidateMultiSignContractTest) still use init*.

Rocky Linux reproduces it more often because the host is slower. A failed-job rerun going green is expected.

Separate races on the same host:

  • BackupServer.close() could run before bind and called stop() before closing the UDP channel (channel was not volatile; port probe was TCP-only).
  • TransactionsMsgHandlerTest used when(mock.foo()) while handleTransaction called isBadPeer() on the same mock.

Changes

  • ConfigLoader.load: when disable is set, clearLocalSnapshot() so init* is visible to current().
  • Base test teardown: drop the local snapshot and reset ConfigLoader.disable.
  • London / Osaka tests: persist the flag to the store and clear the local snapshot.
  • BackupServer: volatile channel, close the channel before backupManager.stop(), close-if-shutdown after bind; wait for bind instead of sleep(1000); chooseRandomPort probes UDP.
  • TransactionsMsgHandlerTest: doReturn and a fresh peer mock per case.

Related

tronprotocol#6857

Test plan

  • Rocky Linux JDK 8 ./gradlew :framework:test --tests org.tron.common.runtime.vm.AllowTvmLondonTest --tests org.tron.common.runtime.vm.ValidateMultiSignContractTest --tests org.tron.common.backup.BackupServerTest --tests org.tron.core.net.messagehandler.TransactionsMsgHandlerTest
  • Debian 11 JDK 8 still green
  • Full :framework:test on Rocky Linux JDK 8

@vividctrlalt vividctrlalt changed the title test: harden flaky rocky linux suite fix(vm): clear leftover thread-local VMConfig snapshot Aug 19, 2026
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