Repository navigation
fix(skill): remove O(n^2) copies in computeSignature and unbounded file lock map - #3795
Merged
xzxiaoshan merged 3 commits intoOct 27, 2026
Merged
Conversation
…le lock map - computeSignature: per-key getResource() instead of whole-map getResources() copies in the resource hash loop; signature bytes unchanged (golden-value test) - SkillBox: fixed 256-stripe lock table replaces the per-path FILE_LOCKS map that accumulated one lock object per path and was never cleaned
…-perf-leaks # Conflicts: # agentscope-core/src/test/java/io/agentscope/core/skill/DynamicSkillMiddlewareTest.java
jujn
approved these changes
Oct 27, 2026
…el build stalls allow() piggybacks a sweep on the same windowMillis + cooldownMillis threshold idle eviction uses, so a ~100ms stall on the first sleep let that sweep evict the idle peer before the explicit evictIdlePeers() call (observed under mvn -T1C). Rebalance the sleeps so every phase keeps a 400ms margin against runner stalls; assertions unchanged.
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.
Two targeted fixes in the skill materialisation path:
DynamicSkillMiddleware.computeSignaturecopied the whole resource map on every key inside the hash loop (O(n²) per skill). It now enumerates keys once viagetResourcePaths()and reads values with per-keygetResource(); the hashed bytes — and therefore signature values — are unchanged (pinned by a golden-value regression test).SkillBox.FILE_LOCKSwas a static per-path lock map that accumulated one lock object per materialised path and was never cleaned. It is replaced by a fixed 256-stripe lock table (floorMod(pathHash, N)): same-path mutual exclusion is preserved, unrelated paths colliding on a stripe merely serialise, and lock memory no longer grows with path count.Also includes (kept as separate commits):
DynamicSkillMiddlewareTestfixtures added by fix(skill): move blocking skill reload off reactive event-loop threads #3792 still usedmy_skill, which the skill-name validation from fix(skill): block path traversal in skill materialization and disambiguate skillId #3787 rejects — renamed tomy-skillfollowing the convention fix(skill): block path traversal in skill materialization and disambiguate skillId #3787 itself applied to the older fixtures.test(channel): deflakeBotLoopGuardTest.activePeersSurviveEvictionOfIdleOnes—allow()piggybacks a sweep on the same threshold idle eviction uses, so a ~100ms runner stall (e.g. undermvn -T1C) let the sweep evict the idle peer before the explicitevictIdlePeers()assertion. Rebalanced sleeps for a 400ms stall margin; assertions unchanged.Verified with
mvn -T1C -pl agentscope-core -am test(2805 tests, 0 failures) andspotless:check.