Skip to content

[bug] Aedes is running out of memory when starting with 30 million subscriptions in MongoDB. #973

@zagadheesh

Description

@zagadheesh

System Information
Aedes: 0.52.0
NodeJS: 16.15.0

  • OS: Amazon linux EC2

Describe the bug
I configured node js to use more than 5gb of memory using "--max-old-space-size=6000". I have 30 million subscriptions stored in Mosca, and I am in the process of transferring these subscriptions from Mosca's MongoDB to Aedes' MongoDB using a Java tool. This tool performs the necessary transformation by converting the 'client' attribute to 'clientId' in the subscription JSON. It streams the data from Mosca's MongoDB, transforms it, and inserts it into Aedes' MongoDB. I have continously monitored server stats and i can confirm aedes loading huge data in memory because of which Node.js throws the following error:

<--- Last few GCs --->

[1761157:0x614f740] 176313 ms: Mark-Compact 5895.4 (6035.5) -> 5884.2 (6037.8) MB, 3557.40 / 0.01 ms (average mu = 0.133, current mu = 0.029) task; scavenge might not succeed
[1761157:0x614f740] 179961 ms: Mark-Compact 5899.0 (6038.0) -> 5887.0 (6040.8) MB, 3420.21 / 0.01 ms (average mu = 0.099, current mu = 0.062) task; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

1: 0xb80c98 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
2: 0xeede90 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
3: 0xeee177 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
4: 0x10ffd15 [node]
5: 0x11002a4 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
6: 0x1117194 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [node]
7: 0x11179ac v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
8: 0x117076c v8::internal::MinorGCJob::Task::RunInternal() [node]
9: 0xd368e6 [node]
10: 0xd39e8f node::PerIsolatePlatformData::FlushForegroundTasksInternal() [node]
11: 0x18af2d3 [node]
12: 0x18c3d4b [node]
13: 0x18afff7 uv_run [node]
14: 0xbc7be6 node::SpinEventLoopInternal(node::Environment*) [node]
15: 0xd0ae44 [node]
16: 0xd0b8dd node::NodeMainInstance::Run() [node]
17: 0xc6fc8f node::Start(int, char**) [node]
18: 0x7f786d23feb0 [/lib64/libc.so.6]
19: 0x7f786d23ff60 __libc_start_main [/lib64/libc.so.6]
20: 0xbc430e start [node]
run.sh: line 3: 1761157 Aborted (core dumped) node --nouse-idle-notification --max-old-space-size=6000 /apps/aedes/server-mongo.js > /apps/aedes/logs/console
$cdata.log

Please suggest me for furthur steps?

To Reproduce
Steps to reproduce the behavior:

  1. Manually copy 30 million subscriptions to aedes
  2. Run the aedes with command like "node --nouse-idle-notification --max-old-space-size=6000 /apps/aedes/server-mongo.js"

Expected behavior
Aedes should start and function properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions