-
Notifications
You must be signed in to change notification settings - Fork 3
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
Unnecessary register of uncaughtException handlers #4
Comments
I'm trying to figure why my app memory usage is growing slowly but quite linear . This is Node-Express app transpiled via TypeScript. I made a shell-script for recording mem usage (via pm2) :
There was several authentication tasks while this test, and one to suspect specially is : node-xmllint : Does anyone know how can I ensure this happening, because there are also other possibilities for growing mem usage. |
Think it's fixed now. I had set schemaValidator to : and now removed it totally, and skipped whole validation by :
Mem usage seems to be ok now, and linear growing has disappered. Could you add some warning to docs, maybe Deprecated, to |
@netmiller Does this mean you're not doing any XML validation at all? |
True. My only IdP is national security authority, and I can suppose the XML they provide is valid and checked properly. |
I also encountered the issue very randomly - running HAPI web server on Node. Sometimes when logging has a big payload, on drain of stdout event node-xmllint quits the process like nothing happened, no exception!!! |
I took the job of forking this library and in-lined "node-xmllint" (orginal repo is removed). I manually patched the memory leak in node-xmllint. This is the result, currently validating in a real application: |
Update; we have been running the above version in production across all our customers integrating with various SAML 2.0 providers (Google Workspace, Okta, Azure AD, and more). We have not observed any memory leak after switching to https://www.npmjs.com/package/samlify-validator-js (github) |
At the beginning, I will mention that I'm aware that the main source of the issue is node-xmllint however it looks that node-xmllint is not maintained anymore, so any fix there would require creating a fork or merging its code directly here.
I noticed in my application that handle SAML that I got node warnings:
(node:1) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 uncaughtException listeners added to [process]. Use emitter.setMaxListeners() to increase limit
After deeper investigations, I found that uncaughtException listeners are registered by node-xmllint called by
samlify-node-xmllint
.node-xmllint has been made as a conversion of libxml2 using Emscripten. Emscripten contains a feature that it auto-register these handlers for each compilation. In the newer version, it is possible to disable it:
emscripten-core/emscripten#7855
Why is this problematic?
The text was updated successfully, but these errors were encountered: