novu
novu copied to clipboard
🐛 Bug Report: Web Docker container gets existed with JavaScript heap out of memory
📜 Description
When using self-hosted version of Novu, many times docker container for Web
gets terminated with error FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
.
👟 Reproduction steps
Deploy Novu on Ubuntu instance with Ubuntu version: 22.04 LTS
and 11 GB RAM
, and start using it.
👍 Expected behavior
It should work smoothly.
👎 Actual Behavior with Screenshots
Web container gets terminated with error FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
.
💻 Operating system
Linux
🤖 Node Version
v16.15.1
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
- [X] I checked and didn't find similar issue
🏢 Have you read the Contributing Guidelines?
- [X] I have read the Contributing Guidelines
Are you willing to submit PR?
Yes I am willing to submit a PR!
Could you provide more logs from the container of what was being executed before running out? Thus will make it easier to investigate. What was the running time of the container before terminating for the memory error?
@p-fernandez I couldn't able to find exact timing for start and end of container but it happened two times, one was after 2 month and another was after 1 day. And Docker logs showing the same entries of the image I attached previously.
Hey, @scopsy @p-fernandez Any update on this issue? I can spare some time on it if you can provide some hints on possible ways to tackle this issue.
Hi @chavda-bhavik, I would mainly suggest to think of a different static content serving options instead of the simple-http server npm package we use there. Maybe we can use NGINX? Or any other static serving solution?
Internally we use Netlify, so we don't experience any problems with it. But previously I have used nginx for static files so maybe it will also work here. Wdyt?
Didn't tried serving static content with Nginx before, But I will look into it. @scopsy can you assign this issue to me?
@chavda-bhavik I think I actually noticed that it happens during the initialization of the container right? Seems like the build
command is the one that is failing. If this is the case, you would need to provide a bit more RAM for your docker daemon that running the web component
@scopsy RAM can be the reason for this issue. Actually memory
error was happening some days after the application started. And from my observation on apps/web/Dockerfile
, it looks like build
will be happening during docker image creation time, instead of container initialization time, Am I right?
Yes, we are doing initialization time build because we need to compile some environment variables and inject them there. We might need to revisit this in the future as it's not the best approach.
Hey, @scopsy I have been busy nowadays, I will look into it as I got some time.
@scopsy Why do you think it is an issue at build time? The service seems to be running successfully before it crashes, making it a runtime issue. Or am I missing something here?
A deploy was made that should help address this in the prebuilt 0.11.0 version. @chavda-bhavik please let me know if you still see this when running the 0.11.0
Closing this for now 🙏