简体   繁体   English

System.exit在OpenJDK 7 / FreeBSD上似乎花费很长时间

[英]System.exit appears to take a long time on OpenJDK 7 / FreeBSD

I'm having a problem with the performance of a Java subprocess running under Java, running on FreeBSD 9.0-RELEASE i386. 我在FreeBSD 9.0-RELEASE i386上运行的Java下运行的Java子进程的性能出现问题。

System.exit(), for this program, takes about 2.6 seconds to run. 对于此程序,System.exit()大约需要2.6秒才能运行。 And I can't figure out why. 我不知道为什么。 It takes 0.025 seconds on Windows. 在Windows上需要0.025秒。 Update: It also runs much faster on OpenJDK 6. 更新:它还在OpenJDK 6上运行得更快。

Running OpenJDK7 under ktrace reveals, during shutdown, a huge sequence of the following: 在ktrace下运行OpenJDK7会在关机期间显示以下的大量序列:

26795 java 1.808597 CALL _umtx_op(0x2831e068,0xf,0,0,0xbf7a9870) 26795 Java 1.808597调用_umtx_op(0x2831e068,0xf,0,0,0xbf7a9870)
26795 java 1.838640 RET _umtx_op -1 errno 60 Operation timed out 26795 Java 1.838640 RET _umtx_op -1 errno 60操作超时

How can I figure out what the program is trying to do here? 我如何弄清楚程序在这里试图做什么? Or, is there an easy workaround or way to fix this? 或者,是否有简单的解决方法或解决方案? It looks like this problem comes up at the OS level on FreeBSD pretty frequently, judging by web searching, but I'm still analyzing what I'm finding (and trying to learn libthr and so forth). 通过Web搜索来判断,这个问题似乎很频繁地出现在FreeBSD的OS级别上,但是我仍在分析发现的内容(并尝试学习libthr等)。

There are no shutdown hooks added by me other than one to print a timestamp, no shutdown hooks added by the system, no files to delete, and no runFinalizersOnExit. 除了打印时间戳记之外,我没有添加任何关机钩子,系统也没有添加关机钩子,没有要删除的文件,也没有runFinalizersOnExit。 The system seems to be spending the time in the native method java.lang.Shutdown.halt0, which I am still trying to analyze. 系统似乎在本机方法java.lang.Shutdown.halt0中花费时间,我仍在尝试分析该方法。

The operand 0xf is UMTX_OP_WAKE_PRIVATE (see /usr/src/sys/sys/umtx.h ). 操作数0xf为UMTX_OP_WAKE_PRIVATE(请参见/usr/src/sys/sys/umtx.h )。 This tries to wake up a kernel thread, and fails. 这尝试唤醒内核线程,但失败。

Now as to why it fails is impossible to say. 关于失败的原因现在无法说。 It could be a deadlock in java. 这可能是Java的死锁。

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

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