Skip to content

fix: ensure GC safety for arena-allocated string values#1383

Merged
jensneuse merged 1 commit intomasterfrom
fix/arena-alloc-panic
Feb 13, 2026
Merged

fix: ensure GC safety for arena-allocated string values#1383
jensneuse merged 1 commit intomasterfrom
fix/arena-alloc-panic

Conversation

@jensneuse
Copy link
Copy Markdown
Member

@jensneuse jensneuse commented Feb 13, 2026

Summary by CodeRabbit

  • Performance & Reliability

    • Improved error handling to enhance system stability and reliability when processing GraphQL errors, subgraph errors, authorization edge cases, and rate limiting scenarios.
  • Tests

    • Added comprehensive benchmark tests validating robustness across error handling scenarios including fetch errors, invalid responses, subgraph errors, authorization rejections, and rate limiting.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

The changes refactor memory allocation in JSON value handling to ensure arena-based GC safety by replacing direct AST parsing with arena-allocated helper functions, and introduce comprehensive benchmark tests validating the arena allocation across multiple error scenarios.

Changes

Cohort / File(s) Summary
Arena-based string allocation refactoring
v2/pkg/engine/resolve/loader.go
Introduced parseStringOnArena and stringValueOnArena helper functions for GC-safe arena allocation. Systematically replaced ~20+ direct AST JSON parsing and string value creation calls to use these helpers throughout error construction, path rewriting, and error extension handling.
Arena GC safety benchmarks
v2/pkg/engine/resolve/loader_arena_gc_test.go
Added comprehensive benchmark suite exercising arena allocation across diverse error paths: fetch errors, invalid JSON/shape, subgraph errors (wrap/passthrough modes), error codes, service-name augmentation, and authorization/rate-limit rejections. Includes helper data source and test response constructors with explicit GC invocations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: ensure GC safety for arena-allocated string values' directly summarizes the main change - introducing arena allocation helpers and updating string/JSON value creations to use arena allocation for garbage collection safety.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into master

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/arena-alloc-panic

No actionable comments were generated in the recent review. 🎉

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@jensneuse jensneuse merged commit 608be72 into master Feb 13, 2026
11 checks passed
@jensneuse jensneuse deleted the fix/arena-alloc-panic branch February 13, 2026 19:24
jensneuse pushed a commit that referenced this pull request Feb 13, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.0.0-rc.249](v2.0.0-rc.248...v2.0.0-rc.249)
(2026-02-13)


### Bug Fixes

* ensure GC safety for arena-allocated string values
([#1383](#1383))
([608be72](608be72))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Fixed a memory safety issue with string value handling to improve
stability and reliability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

2 participants