-
Notifications
You must be signed in to change notification settings - Fork 589
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
Possible memory leak-- processPromiseRejections
never called?
#262
Comments
That's probably a correct find, I've been spending far too long trying to fight that whole dreadful nextTick nonsense. It has been the finger nail in my eye for a long time and I properly hate it for existing. The only proper way is to use node::MakeCallback which is a massive performance hit since nodejs is a pile of garbage. In any case, I'll probably have to accept nodejs is nodejs. It's easier to deal with knowing Python has no such nonsense. |
i hear ya, issue: nodejs/node#29671 |
It's an easy fix, all you have to do is resort to the "correct" way of calling in to JavaScript. Problem is, that "correct" way is really bad, and limits performance a lot. Vanilla V8 Function calls are fast, I get 123k messages/second while node::MakeCallback is down to 99k. It's a major hit to performance. However, since I have found Python and already do 137k messages/second there I think it is time to just let nodejs be nodejs like I said earlier, and work more on the Python extension when it comes to showcasing performance. Moving back to the "correct" way would solve a lot of strange crashes when debugging and just overall make it more robust. I see it as a speeding ticket, now it's time to pay the price. |
Does this mean you will stop developing the js library? |
No I'm just saying, writing the Python extension is a pleasure. It's the scripting environment that really lets uWS shine |
@mattkrick Please try |
@alexhultman why do this if performance is sacrificed? Is this a non issue if you just catch all promises? |
Because there are other problems such as the debugger crashing. |
verified that the leak no longer exists after installing binaries. thank you! sidenote-- i tried to downgrade to v16.5.0 to reproduce the leak, but kept getting an error during heap dump ( |
That crash you got in v16.5 is exactly the kind of issues this commit solves, so it further highlights the need for it |
Having debugger, heap dump and this memory leak fixed is probably worth it even though I hate to say it. Great |
After migrating from express to uwebsockets, i noticed a memory leak caused by node holding onto unhandled rejections and never flushing them
![Screen Shot 2020-01-12 at 7 54 53 PM](https://user-images.githubusercontent.com/5514175/72228579-e6eda080-3575-11ea-88b5-d614fcff43c2.png)
The
pendingUnhandledRejections
array is emptied whenprocessPromiseRejections
is called: https://github.com/nodejs/node/blob/c9b93e234454322ac0b7a6cd29d394f428f3e37d/lib/internal/process/promises.js#L171It should get called every tick here: https://github.com/nodejs/node/blob/68abaab8baac203833889c9106abf6fe82a5900f/lib/internal/process/task_queues.js#L98
Perhaps the task queue is never empty, so
!queue.isEmpty() || processPromiseRejections()
always shortcircuits? Any guidance appreciatedThe text was updated successfully, but these errors were encountered: