I have a complex Java application that runs for a long time. the application does the same operation, with little nuances, over and over again. My problem is that Windows task manager shows a lot of leaking handles for the java process (not file handles).
after some time of running the application in stress, I get strange failures, like the application getting stuck, dissappears, or I get FileNotFoundException when trying to open a file ("Insufficient system resources exist to complete the requested service").
I used Windows task manager to see what is the problem, and found that for the java.exe process - the number of handles is being increased very fast. the number of threads in not increased, and the amount of used RAM is also not increased.
I then used SysInternal's Process Explorer in order to understand what are these handles. I see that they are not file handles, but thousands of handles of type 'Mutant', with the name \BaseNamedObjects\??????n. According to some sites in the web, Mutant in Process explorer means Mutex. My Java app does not intentionally create any Mutexes.
The next step was to use profiling tools in order to narrow down the source of the leaks. I used "J Optimizer" & "Java VirtualVM". with both applications, I cannot detect the leaking handles. they have memory leak detectors, But I can't find a way to detect leaking handles.
My question is : How can I debug this problem ? How can I discover what causes the leaking handles ?
Thank you