-
Notifications
You must be signed in to change notification settings - Fork 321
Open
Description
Summary
The server process is consistently crashing with a FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory. This appears to be triggered when the Admin Dashboard attempts to fetch seller and its orders/products with deep relational expansions.
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
[39:0x9cea8c0] 2329014 ms: Scavenge 813.1 (832.5) -> 812.2 (836.8) MB, 136.42 / 0.00 ms
<--- JS stacktrace --->
1: 0xb71e90 node::OOMErrorHandler
2: 0xeaabdc v8::Utils::ReportOOMFailure
...
Context & Observed Behavior
Prior to the crash, several high-load requests were observed targeting the admin API. Specifically, requests using wildcards (*) for field expansion seem to push the memory usage past the ~832MB limit:
GET /admin/stores
GET /admin/stock-locations?q=&limit=3&fields=id%2Cname
GET /admin/sellers/.../customer-groups?fields=...,*customers
GET /admin/sellers/.../orders?fields=...,*customer
GET /admin/orders?fields=id,display_id,email
Environment: Medusa Cloud [Production]
Possible Root Causes
- Inefficient Query Expansion: The use of *customers and *orders in the admin dashboard fetches may be attempting to load thousands of records into the Node.js heap simultaneously without sufficient pagination or selective field loading.
- Heap Memory Constraints: The process is hitting a hard limit at
~800MB. MercurJS/Medusa v2 may require a higher max-old-space-size when dealing with large multi-vendor datasets. - Relation Hydration: The way MercurJS hydrates relations for sellers might be creating large object trees that the Garbage Collector cannot clean up fast enough.
Steps to Reproduce
- Navigate to the Admin Dashboard
- Access a Seller with a significant number of products and orders.
- Observe memory usage spike until the process terminates.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels