Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java is using 100% of cpu on linux

On my linux server, any java program (even the "Hello world") uses 100% of cpu and is very very slow. Id does not depend on the java version, I have tried different versions of openjdk and sun jdk, both behave the same. How could I fix that?

like image 355
Samuel Hapak Avatar asked Aug 15 '12 09:08

Samuel Hapak


1 Answers

I have found the solution in this article http://blog.wpkg.org/2012/07/01/java-leap-second-bug-30-june-1-july-2012-fix/

There is a great chance, this is caused by the "leap second kernel bug". Firstly, check for the following in the dmesg

[10703552.860274] Clock: inserting leap second 23:59:60 UTC

To fix it, firstly stop the ntp client. On debian-like systems

/etc/init.d/ntp stop

Store the current time

date -s now

And test the java. If everything is working correctly, try to restart ntp service

/etc/init.d/ntp start

And test it again.

like image 111
Samuel Hapak Avatar answered Sep 30 '22 19:09

Samuel Hapak