Repository navigation
[Server] Fix memory growing with every tools/call - #574
Open
chr-hertel wants to merge 1 commit into
Open
chr-hertel wants to merge 1 commit into
chr-hertel wants to merge 1 commit into
Conversation
chr-hertel
requested review from
CodeWithKyrian,
Nyholm and
soyuka
as code owners
October 10, 2026 01:55
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused memoization correctly addresses the reported cache growth and is covered by an appropriate regression test.
0 open findings
What changed in this PR
Fixes repeated schema decoding that caused Opis cache growth during long-lived tools/call workloads.
Changes:
- Memoizes decoded schemas by JSON representation.
- Removes unreachable exception handling.
- Adds regression coverage and a changelog entry.
| File | Description |
|---|---|
src/Capability/Discovery/SchemaValidator.php |
Reuses decoded schema objects. |
tests/Unit/Capability/Discovery/SchemaValidatorTest.php |
Verifies stable Opis cache size. |
CHANGELOG.md |
Documents the memory fix. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Reuse the decoded schema object, Opis caches each new one forever.
chr-hertel
force-pushed
the
fix-schema-validator-leak
branch
from
October 12, 2026 20:55
0365008 to
86c20db
Compare
This branch has not been deployed
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.
SchemaValidatordecoded the tool schema into a newstdClasson every call, and Opis'SchemaLoadercaches every new schema object for good => ~7 KB leaked pertools/callin long-lived processes (stdio, FrankenPHP workers).InvalidArgumentExceptionbranch, the signature already narrows toarray|objectFixes chr-hertel#62
🤖 Generated with Claude Code