Memory leak in postgres - crashes node
See original GitHub issueIssue type:
<--- Last few GCs --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
[29:0x4147350] 2796188 ms: Mark-sweep 1477.8 (1520.0) -> 1465.4 (1521.2) MB, 852.1 / 0.1 ms (average mu = 0.253, current mu = 0.207) allocation failure scavenge might not succeed
[29:0x4147350] 2797191 ms: Mark-sweep 1479.0 (1521.5) -> 1463.4 (1521.2) MB, 806.5 / 0.1 ms (average mu = 0.227, current mu = 0.197) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x13cf019]
Security context: 0x340360a008d1 <JSObject>
1: /* anonymous */(aka /* anonymous */) [0x1d76b52d04a1] [/app/node_modules/typeorm/query-builder/RelationIdLoader.js:~93] [pc=0x331c83d059b0](this=0x22e64c6804b1 <undefined>,0x0e9b400da2b9 <Object map = 0x2e6ef8dbe379>)
2: forEach [0x340360a16769](this=0x26ad8b44e919 <JSArray[363]>,0x1d76b52d04a1 <JSFunction (sfi = 0x15f19a7b2f81)>)
3: /* anonymous *...
1: 0xa093f0 node::Abort() [/usr/local/bin/node]
2: 0xa097fc node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
3: 0xb842ae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
4: 0xb84629 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0xd30fe5 [/usr/local/bin/node]
6: 0xd31676 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node]
7: 0xd3def5 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
8: 0xd3eda5 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
9: 0xd4185c v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
10: 0xd0830b v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
11: 0x1049f4e v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
12: 0x13cf019 [/usr/local/bin/node]
Aborted (core dumped)
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[x] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
using pg & pg-native I am not 100% why it crashes but it’s doing 30 updates per second and 150 selects
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Node calling postgres function with temp tables causing ...
Node calling postgres function with temp tables causing "memory leak" ; var pg = require ; var conString = "postgres://username:password@server/ ...
Read more >Memory leak (possibly connected to postgis) leading to server ...
Re: Memory leak (possibly connected to postgis) leading to server crash ; pgsql-bugs(at)lists(dot)postgresql(dot)org · Re: Memory leak (possibly ...
Read more >Thread: Memory leak (possibly connected to postgis) leading ...
I believe there may be a memory leak somewhere in postgres/postgis, which can eat up all the available memory, leading to postgres crash...
Read more >Troubleshooting Node.js Memory Use - Heroku Dev Center
Memory leaks become a problem when they grow large enough to slow your application down. For example, a small leak on each request...
Read more >Avoiding Memory Leaks in Node.js: Best Practices for ...
In simple terms, a memory leak is nothing but an orphan block of memory on the heap that is no longer used by...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After investigating, I found that there was no memory leak in my case. Just an astronomical amount of memory used that would probably be released if it didn’t crash due to memory limit exceeded.
Our reconciler for converting raw SQL back into entities could definitely use some attention.