I have a Java program that at some point turns into 100% CPU usage and sleep state at the same time. The program is not multithreaded.
Looking around, I think the most likely cause for that is a bug or some mismatch in the way I run the java interpreter with respect to garbage collection. I can only think that the 100% CPU usage is because of GC. I am allocating enough memory for the program to run using Xmx, and the program does not run even near the amount I allocate. The amount I allocate is also much less than the total memory available on the machine.
I found this:
http://code.google.com/p/spymemcached/issues/detail?id=279
There were also some mentions of that on stackoverflow.com such as here:
CMS garbage collector - when does it run?
Still, I couldn't find a solution. Is this a bug in the JVM, and if so, how would I fix it?
EDIT: I added a paste of the jstack output here: http://pastebin.com/Au0V9FCN