简体   繁体   English

Java在Linux上使用100%的cpu

[英]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. 在我的linux服务器上,任何java程序(甚至是“Hello world”)都使用100%的cpu而且非常慢。 Id does not depend on the java version, I have tried different versions of openjdk and sun jdk, both behave the same. Id不依赖于java版本,我尝试过不同版本的openjdk和sun jdk,两者的行为都相同。 How could I fix that? 我怎么能解决这个问题?

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/ 我在本文中找到了解决方案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". 这是一个很好的机会,这是由“闰秒内核bug”引起的。 Firstly, check for the following in the dmesg 首先,在dmesg检查以下内容

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

To fix it, firstly stop the ntp client. 要修复它,首先停止ntp客户端。 On debian-like systems 在类似debian的系统上

/etc/init.d/ntp stop

Store the current time 存储当前时间

date -s now

And test the java. 并测试java。 If everything is working correctly, try to restart ntp service 如果一切正常,请尝试重新启动ntp服务

/etc/init.d/ntp start

And test it again. 并再次测试它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM