Repository navigation
Wekan Crash if more than 2GB of RAM is used #3585
Description
Issue
Other Wekan issues can be added here.
Server Setup Information:
- Did you test in newest Wekan?: yes
- For new Wekan install, did you configure root-url correctly so Wekan cards open correctly https://github.com/wekan/wekan/wiki/Settings ?
- Wekan version: 4.96
- Deployment Method: docker swarm
- Http frontend if any (Caddy, Nginx, Apache, see config examples from Wekan GitHub wiki first):
- Node Version:
- MongoDB Version: 4.0.11
Problem description:
if NodeJs uses more than 2GB of Memory, Wekan crashes with a Exception:
I researched a little and as it turns out NodeJs v12 has a standard limit of 2GB Memory Consumption, but it can be changed with the following Nodejs CLI Command: --max-old-space-size xxxx where xxxx is the memory in MB (source) Can this be implemented to raise the Wekan max Memory Limit?
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory,
,
<--- Last few GCs --->,
,
[1:0x38a2e80] 324979 ms: Mark-sweep 2029.2 (2080.6) -> 2018.8 (2083.1) MB, 1608.6 / 0.1 ms (average mu = 0.120, current mu = 0.022) allocation failure scavenge might not succeed,
[1:0x38a2e80] 327768 ms: Mark-sweep 2031.4 (2083.1) -> 2022.9 (2063.4) MB, 2738.9 / 0.1 ms (+ 0.1 ms in 30 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 2751 ms) (average mu = 0.061, current mu = 0.018) allocation f,
,
<--- JS stacktrace --->,
,
==== JS stack trace =========================================,
,
0: ExitFrame [pc: 0x140a859],
Security context: 0x22ae44d408d1 ,
1: changeField [0x369877f3a6b9] [/build/programs/server/packages/ddp-server.js:~287] [pc=0x273d069851f8](this=0x36d784d60269 ,0x06e82165b7a9 <String[18]: Ngb63ADH8RE3BT3C8Y>,0x24027c246289 <String[#6]: status>,0x1a40249114f9 <String[6]: online>,0x36d784d603e1 ,0x24027c240639 ),
2: ...,
,
1: 0xa18150 node::Abort() [node],
2: 0xa1855c node::OnFatalError(char const*, char const*) [node],
3: 0xb970be v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node],
4: 0xb97439 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node],
5: 0xd546b5 [node],
6: 0xd54d46 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node],
7: 0xd61605 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node],
8: 0xd624b5 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node],
9: 0xd64f6c v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node],
10: 0xd2b98b v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node],
11: 0x106e0bc v8::internal::Runtime_AllocateInOldGeneration(int, unsigned long*, v8::internal::Isolate*) [node],
12: 0x140a859 [node],
Activity
xet7 commentedon Feb 19, 2021
Related https://github.com/wekan/wekan/discussions/3580
r4nc0r commentedon Feb 19, 2021
Do you mean the env var NODE_OPTIONS: --max_old_space_size=4096? If this is enough to fix the problem it would be great :)
xet7 commentedon Feb 19, 2021
@r4nc0r
Please try does it work.
r4nc0r commentedon Feb 22, 2021
Works :)
r4nc0r commentedon Feb 22, 2021
Could you add this to the offical wekan documentation?
jankapunkt commentedon Jul 3, 2021
The real question is why it's using >2GB of RAM.
Are there any unbusted chaches?
Memory leaks?
Too many publictations/observers?
Assets Like Images loaded into RAM?
xet7 commentedon Jul 3, 2021
@jankapunkt
Yes sure. When Wekan is running, CPU usage and RAM usage is increasing all the time, as mentioned in some of these issues.
xet7 commentedon Jul 3, 2021
Also too much data is published to browserside, making browsers crash #3893
Ben0it-T commentedon Nov 5, 2021
Definitely a stupid question ...
Should we add the env var
NODE_OPTIONS: --max_old_space_size=4096with snap (for prevent Wekan crashes if NodeJs uses more than 2GB of Memory) ?If yes, where/how ?
On Debian 10, the unit file
snap.wekan.wekan.service, we can seeEnvironmentFile=-/etc/environmentShould we add the env var
NODE_OPTIONS: --max_old_space_size=4096in/etc/environment?Thanks
xet7 commentedon Nov 5, 2021
@Ben0it-T
There are no stupid questions. There are only my stupid answers.
WeKan Snap does not have that setting option yet.
To try that option, you could use start-wekan.sh from https://github.com/wekan/wekan or some service file, and bundle version from https://github.com/wekan/wekan/wiki/Raspberry-Pi using bundle version for your server CPU architecture.
If adding that option helps, that setting could be added to some Snap settings at https://github.com/wekan/wekan/tree/master/snap-src/bin .
If that option does not help, then you should wait when I have finished partial stupid rewrite of WeKan.
Ben0it-T commentedon Nov 6, 2021
@xet7
Thank you for your answer
For the moment I have not yet deployed Wekan within our team. I use it for my personal use.
I plan to deploy it in a few weeks for our team. So I have not yet encountered this type of problem...
At first, it could probably be interesting to know the details about the heap and size, with
getHeapStatistics().Maybe in
Admin Panel>Version?What do you think about that ?
xet7 commentedon Nov 6, 2021
@Ben0it-T
You can send PR to add them to:
Thanks!
Ben0it-T commentedon Nov 12, 2021
@xet7
A little feedback on my stupid question about
NODE_OPTIONSwith snapOn the latest Wekan version (5.75) with snap, if I put
NODE_OPTIONSin/etc/environment, it works !Ex1 :
Ex2 :
xet7 commentedon Jan 19, 2022
Somebody got this:
So does any of these help?
https://stackoverflow.com/questions/53230823/fatal-error-ineffective-mark-compacts-near-heap-limit-allocation-failed-javas
@mfilser
Is there already some setting in WeKan for this, or should it be added?
xet7 commentedon Jan 25, 2022
Some progress:
I did this testing on Debian VM that is running on bare metal server donated to WeKan development. That Debian VM has 60 GB RAM, just in case, it could work with less.
start-wekan.shI have added these, with node path, and additional stack size mentioned here https://stackoverflow.com/questions/20936486/node-js-maximum-call-stack-size-exceededUPDATE: This works best with size 4096. Bigger values do increase CPU usage too much.
Add more stack and heap to Node.js at all WeKan platforms.