Skip to content

fix: GraphQL schema rebuilds leak Apollo signal handlers and pin old schema graphs in memory#10539

Open
dblythy wants to merge 1 commit into
parse-community:alphafrom
dblythy:fix/graphql-schema-rebuild-memory-leak-9813
Open

fix: GraphQL schema rebuilds leak Apollo signal handlers and pin old schema graphs in memory#10539
dblythy wants to merge 1 commit into
parse-community:alphafrom
dblythy:fix/graphql-schema-rebuild-memory-leak-9813

Conversation

@dblythy

@dblythy dblythy commented Jul 4, 2026

Copy link
Copy Markdown
Member

Closes #9813

Summary by CodeRabbit

  • Bug Fixes
    • Prevented duplicate process signal listeners from accumulating during GraphQL schema rebuilds.
    • Reduced the risk of stale server instances and schemas staying in memory after updates.
    • Added coverage to ensure listener counts remain stable across repeated schema changes.

@parse-github-assistant

Copy link
Copy Markdown

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

Tip

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

Note

Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect.

Caution

Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code.

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3384f593-e3f9-45a5-b5c8-c9ba78ec6e28

📥 Commits

Reviewing files that changed from the base of the PR and between 7e9d53a and e90bdb1.

📒 Files selected for processing (2)
  • spec/ParseGraphQLServer.spec.js
  • src/GraphQL/ParseGraphQLServer.js

📝 Walkthrough

Walkthrough

Adds stopOnTerminationSignals: false to the ApolloServer configuration in ParseGraphQLServer.js to prevent process-level SIGINT/SIGTERM listener accumulation across schema rebuilds, and adds a regression test verifying listener counts remain stable after multiple _getServer() calls.

Changes

Apollo signal listener leak fix

Layer / File(s) Summary
ApolloServer termination signal configuration
src/GraphQL/ParseGraphQLServer.js
Adds stopOnTerminationSignals: false option with explanatory comment when instantiating ApolloServer to prevent registration of process-level SIGINT/SIGTERM listeners on each schema rebuild.
Listener leak regression test
spec/ParseGraphQLServer.spec.js
Adds a test that forces NODE_ENV to 'production', records SIGINT/SIGTERM listener counts, triggers multiple schema changes and _getServer() calls, and asserts the listener count is unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • parse-community/parse-server#9929: Both PRs modify ApolloServer initialization in _getServer() within ParseGraphQLServer.js to fix issues from repeated server creation, with matching test additions in ParseGraphQLServer.spec.js.

Suggested reviewers: mtrezza

🚥 Pre-merge checks | ✅ 5 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is missing the required Issue, Approach, and Tasks sections from the template. Add the Issue and Approach sections and complete the Tasks checklist, including any applicable test and security items.
Engage In Review Feedback ❓ Inconclusive Repo diff shows the fix, but there’s no accessible review-thread or feedback history to verify prior engagement or retraction. Provide the PR review conversation or metadata showing the reviewer comment, author response, and either a follow-up commit or retraction.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required prefix and accurately summarizes the GraphQL schema leak fix.
Linked Issues check ✅ Passed The Apollo signal-handler leak fix and regression test address the memory-growth issue described in #9813.
Out of Scope Changes check ✅ Passed The changes are limited to the leak fix and a targeted regression test, with no unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Security Check ✅ Passed PASS: The change only disables Apollo’s redundant SIGINT/SIGTERM listeners to prevent a memory leak; no new auth, input, or network exposure is introduced.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Biome (2.5.1)
src/GraphQL/ParseGraphQLServer.js

File contains syntax errors that prevent linting: Line 121: return types can only be used in TypeScript files; Line 295: Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 295: return type annotation are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.

🔧 ast-grep (0.44.0)
spec/ParseGraphQLServer.spec.js

ast-grep timed out on this file


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

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.66%. Comparing base (cce91e5) to head (e90bdb1).
⚠️ Report is 1 commits behind head on alpha.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha   #10539   +/-   ##
=======================================
  Coverage   92.66%   92.66%           
=======================================
  Files         193      193           
  Lines       16981    16981           
  Branches      248      248           
=======================================
  Hits        15736    15736           
  Misses       1224     1224           
  Partials       21       21           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Memory leak when upgrading from Parse Server 6.5.11 to Parse Server 7.5.2

1 participant