Skip to content

fix(vercel-ai): prevent tool call span map memory leak#19328

Open
lithdew wants to merge 1 commit intogetsentry:developfrom
lithdew:develop
Open

fix(vercel-ai): prevent tool call span map memory leak#19328
lithdew wants to merge 1 commit intogetsentry:developfrom
lithdew:develop

Conversation

@lithdew
Copy link

@lithdew lithdew commented Feb 14, 2026

Tool calls were stored in a global map and only cleaned up on tool errors, causing unbounded retention in tool-heavy apps (and potential OOMs when inputs/outputs were recorded). Store only span context in a bounded LRU cache and clean up on successful tool results; add tests for caching/eviction.

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).
  • Link an issue if there is one related to your pull request. If no issue is linked, one will be auto-generated and linked.

Closes #issue_link_here

Tool calls were stored in a global map and only cleaned up on tool
errors, causing unbounded retention in tool-heavy apps (and potential
OOMs when inputs/outputs were recorded). Store only span context in a
bounded LRU cache and clean up on successful tool results; add tests for
caching/eviction.
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