我在jstack中看到这个线程似乎根本没有移动。关于如何弄清楚它为何被卡住的任何指针?我没有看到任何锁或任何东西,唯一可疑的是“Object.wait()”引用。
"main" prio=10 tid=0x00007f3a8000b000 nid=0x942 in Object.wait() [0x00007f3a89539000]
java.lang.Thread.State: RUNNABLE
at org.joda.time.DateTimeZone.<clinit>(DateTimeZone.java:95)
at org.joda.time.format.DateTimeFormatter.withZoneUTC(DateTimeFormatter.java:301)
at com.amazonaws.auth.AWS4Signer.<clinit>(AWS4Signer.java:44)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at com.amazonaws.auth.SignerFactory.createSigner(SignerFactory.java:121)
at com.amazonaws.auth.SignerFactory.lookupAndCreateSigner(SignerFactory.java:107)
at com.amazonaws.auth.SignerFactory.getSigner(SignerFactory.java:80)
at com.amazonaws.AmazonWebServiceClient.computeSignerByServiceRegion(AmazonWebServiceClient.java:311)
at com.amazonaws.AmazonWebServiceClient.computeSignerByURI(AmazonWebServiceClient.java:284)
at com.amazonaws.AmazonWebServiceClient.setEndpoint(AmazonWebServiceClient.java:160)
此外,堆栈顶部的DateTimeZone.java中的第95行是:
public static final DateTimeZone UTC = new FixedDateTimeZone("UTC", "UTC", 0, 0);
还有另一个线程也停留在类似的地方:
"FeatureManagerService" daemon prio=10 tid=0x00007f3a8056a800 nid=0x94f in Object.wait() [0x00007f3a84151000]
java.lang.Thread.State: RUNNABLE
at com.amazonaws.util.DateUtils.<clinit>(DateUtils.java:35)
at com.amazonaws.services.s3.internal.ServiceUtils.<clinit>(ServiceUtils.java:59)
at com.amazonaws.services.s3.internal.S3Signer.sign(S3Signer.java:123)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:348)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:245)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3711)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3664)
at com.amazonaws.services.s3.AmazonS3Client.listObjects(AmazonS3Client.java:620)
at com.amazonaws.services.s3.AmazonS3Client.listObjects(AmazonS3Client.java:603)
而DateUtils.java:35是:
private static final DateTimeZone GMT = new FixedDateTimeZone("GMT", "GMT", 0, 0);
我已经尝试过使用jvisualvm / jhat进行调查,但实际上并没有走得太远。
请注意,这是一个实时进程,而不是我在本地调试器中运行的东西,并且在重新启动后它工作正常,因此它似乎是间歇性的。
任何帮助将不胜感激!
谢谢!
使用jstack中的混合模式更新似乎提供了更多的洞察力 - 它正在等待pthread_cond_wait:
----------------- 2370 -----------------
0x00007f3a89115414 __pthread_cond_wait + 0xc4
0x00007f3a8833a03c _ZN13ObjectMonitor4waitElbP6Thread + 0x7dc
0x00007f3a88117fbb _ZN13instanceKlass15initialize_implE19instanceKlassHandleP6Thread + 0x36b
0x00007f3a881182ca _ZN13instanceKlass10initializeEP6Thread + 0x6a
0x00007f3a8814d3f3 _ZN18InterpreterRuntime4_newEP10JavaThreadP19constantPoolOopDesci + 0x143
0x00007f3a7d01d9ee * org.joda.time.DateTimeZone.<clinit>() bci:0 line:95 (Interpreted frame)
0x00007f3a7d0004f7 <StubRoutines>
...
答案 0 :(得分:0)
也许它没有卡住。它只是在循环中调用新的DateTimeZone(),构造函数进行一些计算。每次看这个帖子时,它都在DateTimeZone()里面 - 但每次都是一个不同的DateTimeZone()。
然后被丢弃。发生了很多次。
答案 1 :(得分:0)
由@naumcho发现,这被证明是一个错误(https://github.com/JodaOrg/joda-time/issues/171)。
根据提供的信息(两个不同线程+源代码行的堆栈跟踪),可能会怀疑死锁,因为两个线程都试图实例化同一类型FixedDateTimeZone
的新对象。
确认将使用GDB检查__pthread_cond_wait()
周围的堆栈帧的下一步。