Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EJS Rethrow Function Memory Leak #401

Closed
m-majetic opened this issue Sep 22, 2018 · 4 comments
Closed

EJS Rethrow Function Memory Leak #401

m-majetic opened this issue Sep 22, 2018 · 4 comments

Comments

@m-majetic
Copy link

I am testing this simple app on Ubuntu 18.04 with EJS version 2.6.1 and Express.js version 4.16.3 .

memleakservercode

The home.ejs file is in a folder called home which is located in the views directory.
Contents of the .ejs files are the following:

memleakejscode

I was investigating a memory leak in another app and decided to test it in the simplest manner possible.
Then, I made this app and the memory leak persists.
Testing for memory leakage was realized using node --inspect and expose GC flags.
User simulation was achieved using Siege.
The results:

memleak

Memory is constantly getting allocated to EJS strings, but the strings are never Garbage collected.

Am I missing something in my code, or is this ejs package related ?

@mde
Copy link
Owner

mde commented Sep 23, 2018

This looks like a much more helpful example than what we have previously gotten here: #359 (comment) It might help us narrow things further, although it could very well involve the way that EJS is integrated into Express. We don't see this issue with a minimal script that does nothing but require EJS, and render.

@m-majetic
Copy link
Author

Interesting...
I will test this same simple app, but with older versions of express to see if we can pinpoint the update that caused this.
After that I think we should contact Express developers to see how is the ejs view engine treated and why are the references still present.

@m-majetic
Copy link
Author

Hey, I suspect the problem is not EJS related. This is something on the express side.
I did the same experiment with pug...and would you know:

pugmemleakchrome2

This is the server configuration and the pug file itself.
pugmemleakserver
memleakpugfile

@m-majetic
Copy link
Author

Looks like the problem was something under my nose the whole time...
Sorry to bother you.

expressjs/express#3751 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants