parse-community / parse-community/parse-server
Memory leak when upgrading from Parse Server 6.5.11 to Parse Server 7.5.2
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
Hello!
New Issue Checklist
- Report security issues confidentially.
- Any contribution is under this license.
- Before posting search existing issues.
Issue Description
After upgrading from Parse Server 6.5.11 and JS SDK 4.2.0 to Parse Server 7.5.2 and JS SDK 5.3.0, I observed a consistent increase in memory usage over time in our production environment. Heap snapshots revealed that the memory was increasingly filled with what looks like schema related objects, primarily related to the GQL schema.
After adjusting the schemaCacheTtl from 60 to 86400 seconds the memory buildup stopped.
This suggests there might be a memory leak with the GraphQL schema caching in this newer version.
Steps to reproduce
The problem proved difficult to reproduce in a dev environment. I attempted running loads of queries with autocannon locally against the server but saw little increases in memory then. However when it was live in production memory steadily increased every time we released it. I suspect the issue could be bigger in production over dev by the sheer different kinds of requests we're doing, as I only blasted a few different queries in dev.
Here the spike is visible when having this release out between 11.00 and 12.00 with TTL of 60 seconds, and the same release out after 4 pm with the TTL set to 86400.
Actual Outcome
Steady increase of memory usage, primarly filled with schema related objects.
Expected Outcome
Stable memory usage.
Environment
Server
- Parse Server version: 7.5.2
- Operating system: Linux
- Local or remote host: Heroku
Database
- System (MongoDB or Postgres): MongoDB
- Database version: 6.0.0
- Local or remote host: MongoDB Atlas
Client
- SDK: Javascript
- SDK version: 5.3.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining GraphQL schema caching around the schemaCacheTtl setting and compare heap snapshots with TTL values of 60 and 86400 seconds. Try to reproduce the production-like request variety described in the issue, then verify that memory usage remains stable over time and that schema-related objects do not accumulate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100