refactor(framework): decouple Manager from TronJsonRpcImpl - #6990
Open
0xbigapple wants to merge 5 commits into
Open
0xbigapple wants to merge 5 commits into
0xbigapple wants to merge 5 commits into
Conversation
Remove unused queue inspection and mutation methods, and mark the remaining stream accessor as test-only. Drop unreachable offer failure handling for the unbounded queue.
0xbigapple
requested review from
317787106,
bladehan1 and
waynercheung
and removed request for
317787106 and
xxo1shine
September 22, 2026 08:01
317787106
reviewed
Sep 23, 2026
| } | ||
| // The consumer loop submits to logsFilterPool (over-threshold path), so it must | ||
| // terminate before the pool shuts down. | ||
| ExecutorServiceManager.shutdownAndAwaitTermination(filterEs, filterEsName); |
Collaborator
There was a problem hiding this comment.
[SHOULD] shutdownAndAwaitTermination() does not guarantee that the consumer has terminated: if the closing thread is interrupted, it calls shutdownNow() and returns without waiting again. We then shut down logsFilterPool while the consumer may still submit work to it.
I reproduced close() returning with filterEs.isTerminated() == false and logsFilterPool.isShutdown() == true; resuming the consumer then caused a RejectedExecutionException.
Could we preserve the consumer-before-pool shutdown ordering on this interruption path and add a regression test? The existing interrupted-close test registers no filters, so it never exercises submission to logsFilterPool.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
close #6963
Removes the
Manager → TronJsonRpcImplreverse dependency left by #6732, where core-layerManagerholds the json-rpc filter consumer through a@Lazyinjection.FilterCapsuleQueuebean;Manager.postBlockFilter/postLogsFilterproduce into it, so Manager no longer references anything underorg.tron.core.services.jsonrpc(repo-wideframework/src/mainis now@Lazy-free).TronJsonRpcImpl: started by@PostConstructwhenisJsonRpcFilterEnabled(), single daemon thread, stopped byclose().TronJsonRpcImplconstructor becomes(NodeInfoService, Wallet, Manager);setManager()is removed and the direct-construction test sites are migrated.close()is rewritten: anAtomicBooleanguard makes it idempotent and serves as a visibility-safe stop flag, the loop exits on interrupt, and the consumer is awaited beforelogsFilterPoolshuts down so an in-flight capsule completes on graceful shutdown.ApplicationImpl.shutdown()now closes the consumer after producers stop and beforedbManager.close(); the later Spring-destructionclose()is a no-op.instanceofdispatch logs a warning for unknownFilterTriggerCapsulesubtypes instead of silently dropping them.Runtime behavior of the filter API is unchanged: same unbounded queue, same discard-on-shutdown semantics, one consumer shared by the FullNode/solidity/PBFT json-rpc services.
Why are these changes required?
Follow-up agreed in the #6732 review (see discussion).
FullNodesetsallowCircularReferences(false);@Lazy, likeObjectProvideror a runtimegetBean(), only makes Spring tolerate the cycle. The reverse core → API edge stays, obscuring the component graph, and later json-rpc cleanups keep copying the pattern. This PR removes the edge instead.This PR has been tested by:
eth_getFilterChangesdelivers; SIGTERM log order confirms consumer →logs-filter-pool→dbManager→ context close, single shutdown episode, no errorsfilter not foundafter restart; noRejectedExecutionException, no bean-cycle errors, shutdown order identical in every cycleFollow up
Extra details