Netty Leak Detector throwing exceptions - memory-leaks

I am analisying my java app and I have pretty much resolved all the issues reported from JavaMissionControl
The only bit left is a certain and significative amount of exceptions thrown from the Netty Leak Detector
Not sure if it is trying to signal issues in my code but I am not sure how this should be resolved. Has anyone had similar issue?
See picture below

Related

node.js memory leak with cluster and express

I am using the node.js 6.11.3 ,cluster module, express 4.14
Seeing memory leaks slowly over a period of 1 weeks.
attached is a screenshot of the heap dumps in chrome dev tools. Cant tell the reason for the leak.click for heap dump
Unfortunately, nobody can answer where your leak comes from without accessing the entire application and environment. The real question is how do you debug a node memory leak.
First its important to try to understand how memory leaks occur in Node. How is it possible if Node has built in garbage collection? Well, variables are marked as garbage when no longer referenced. If you have code (closures etc) that still hold reference to variables, they are not collected. That is just one example. There are also dependencies that can cause memory leaks which can confuse you into thinking you have issues in your own code. And maybe you do, in the way you use the dependency.
Bottom line, its best to get familiar with this debugging process yourself so that you can understand the issues leading to the leak. Best of luck. Here is one article that is helpful.
https://www.alexkras.com/simple-guide-to-finding-a-javascript-memory-leak-in-node-js/

Memory leak node js

I have a memory leak on my nodejs application. In order to resume the purpose of the application, it's an api called by an iOS application and a backoffice to administrate some content.
The application is in production and we experience some memory leak due to utilisation.
The memory on the server is always going up and never going down.
I try to analyze the problem using node-heapdump.
First of all, i see a big difference between the heap size of the snapshot given by node-heapdump and the size taken by the app in the memory (heap size ~ 30Mb and RAM size ~ 100Mb), where that difference came from ?
Then i see an increment of the heap size just by refreshing a home page who does not return anything.
Is anyone has an idea of where my problem could be ?
For information i use nodejs version 0.10.x and expressjs 4.0.0
Thanks in advance guys.
EDIT
I install memwatch-next and the leak event is raised.
The error i have is this one :
warning: possible EventEmitter memory leak detected. 11 leak listeners
added. Use emitter.setMaxListeners() to increase limit.
I try to set the defaultMaxListeners but when i stress the application the leak event is raised after sometime.
Does anyone knows what that error means ?
have a look at memwatch-next
I had similar issues with the memwatch package and switched to memwatch-next and it installed without the node-gyp error and produced worked. As for the difference between the RSS and the heapdump , I am in the same boat as you are.
Try to find memory leakage leak and stat from https://www.npmjs.com/package/memwatch.
Hope it would help.
I think you need this tool: easy-monitor
Might I recommend you try running the application with the --inspect argument, this will then allow you to attach Chrome dev tools and take memory snapshots. From here take one at startup one during testing and then one after you have finished testing the application (no more requests to the application but must still be running.) This will allow you to see what exactly is causing the growth in memory.
From here you will be able to see what is causing the growth and hopefully an indication as to where the leak is.

Is there a way to fail an automated test upon Netty leak detection?

I'm using Netty 4.0.x on a project where a core separate project will create ByteBuf buffers and pass them to the client code layer, which should be responsible for closing the buffer.
I've found leaks in some cases and I'd like to cover the codepath leading to those leaks with an automated test, but Netty's ResourceLeakDetector seems to only report leaks inside logs.
Is there a way to fail an automated JUnit test in the event of such a leak? (eg by plugin some behavior in the ResourceLeakDetector)?
Thanks!
PS: Keep in mind that my test wouldn't really create the buffers, the core code (which is a dependency) does.
Netty's CI server leak build will indicate that the build is unstable if leaks are detected. I'm not sure on the mechanism for this but it is possible (possibly detecting the leak messages from build logs) to automatically detect.
Keep in mind that the leaks are detected when the ByteBuf objects are GC. So when/where a leak is detected may be far removed from when/where the leak actually occurred. Netty does include a trail of places where the ByteBuf has been accessed in meaningful ways to help you trace back where the buffer was originally allocated, and potentially a list of objects who may be responsible for releasing that buffer.
If you are OK with the above limitations you could add a throw of an exception into ResourceLeakDetector for private use.

How to diagnose Segmentation Fault on Node.Js

My Node.Js application occasionally fails with a "Segmentation fault" and I am at a loss as to how to diagnose the cause. As mentioned below I have dramatically reduced their frequency by raising maxlisteners but not made the problem go away.
The application runs on a BeagleBone Black under Node v0.8.22 and uses Socket.io to communicate realtime data to browser pages displayed on the BBB's LCD display. It collects data from a sensor connected via I2C using the korevec/node-i2c library. I have, however, isolated that library and still have failures.
The failures generally occur when I have streamed data for a while to the client though they will occasionally/rarely happen at other times as well. This is not surprising as my app uses socket.io to communicate on almost all pages but the streaming page is at much higher volume.
I am getting the below message:
(node) warning: possible EventEmitter memory leak detected. 11
listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
and have been doing so since day 1. I was also seeing the symptoms of a memory leak but since I raised the MaxListeners memory usage stays constant. Failure rate after making this change went down dramatically but has not gone away completely. I am using socket.io on top of http and raised MaxListeners for both socket.it and for http.
How does one go about diagnosing this problem? Is the memory leak error related? I can post code but there is quite a bit of it and I am not sure what parts are most relevant.
Thanks for any help,
Cheers, Will

iOS Application Crashing again and again when re-launching the application

I have an iOS4 Application, sometimes if any crash happens in my application i am not able to launch my application it crashes again and again and not allow me to launch application for continuously 4 or 5 times.
This is my application log error code:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x50000000
How to solve these kind of application crashes?
From the error, it looks like you might try to access memory that's been already released or never actually allocated.
If you have no idea, where the crash is coming from, you have to work out bottom-up where the crash might occur. Disable all functionality of your app and gradually turn on until the crash comes up. That way you can isolate the memory issue you're having.
But first try running Analyze function in XCode - it may find potential problems you may be having in the code.

Resources