1

我有一个 java 应用程序,它有两个线程在主线程之外运行。我正在使用 Log4j 发送有关错误的电子邮件。该应用程序在启动和发送错误电子邮件时运行良好。但是应用程序在 30 分钟后被挂起。请指教。

这是线程转储

全线程转储 Java HotSpot(TM) 64 位服务器 VM(23.3-b01 混合模式):

“附加监听器”守护进程prio=10 tid=0x00007fe564001000 nid=0x76b5 等待条件[0x0000000000000000]

java.lang.Thread.State:可运行

“MultiThreadedHttpConnectionManager 清理”守护进程 prio=10 tid=0x00007fe5400f9000 nid=0x6ff8 in Object.wait() [0x00007fe57c414000]

java.lang.Thread.State:等待(在对象监视器上)

at java.lang.Object.wait(Native Method)

- waiting on <0x00000000fd97cf50> (a java.lang.ref.ReferenceQueue$Lock)

at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)

- locked <0x00000000fd97cf50> (a java.lang.ref.ReferenceQueue$Lock)

at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)

at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ReferenceQueueThread.run(MultiThreadedHttpConnectionManager.java:1122)

“Timer-0”守护进程prio=10 tid=0x00007fe540044000 nid=0x6ff7 in Object.wait() [0x00007fe57c515000]

java.lang.Thread.State:TIMED_WAITING(在对象监视器上)

at java.lang.Object.wait(Native Method)

- waiting on <0x00000000fda732b8> (a java.util.TaskQueue)

at java.util.TimerThread.mainLoop(Timer.java:552)

- locked <0x00000000fda732b8> (a java.util.TaskQueue)

at java.util.TimerThread.run(Timer.java:505)

“BBMONITOR”prio=10 tid=0x00007fe5848a0000 nid=0x6ff6 等待监视器条目 [0x00007fe57c616000]

java.lang.Thread.State: BLOCKED (在对象监视器上)

at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:247)

- waiting to lock <0x00000000fd964fb8> (a org.apache.log4j.net.SMTPAppender)

at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:67)

at org.apache.log4j.Category.callAppenders(Category.java:218)

at org.apache.log4j.Category.forcedLog(Category.java:587)

at org.apache.log4j.Category.info(Category.java:856)

at com.shaklee.processor.ShakleeRNTUserProfileBBMonitor.bb_notify(ShakleeRNTUserProfileBBMonitor.java:94)

at com.shaklee.processor.ShakleeRNTUserProfileBBMonitor.bbmonitor(ShakleeRNTUserProfileBBMonitor.java:124)

at com.shaklee.processor.ShakleeRNTUserProfileBBMonitor.run(ShakleeRNTUserProfileBBMonitor.java:144)

at java.lang.Thread.run(Thread.java:722)

“配置文件处理器”prio=10 tid=0x00007fe584922000 nid=0x6ff5 可运行 [0x00007fe57c716000]

java.lang.Thread.State:可运行

at java.net.SocketInputStream.socketRead0(Native Method)

at java.net.SocketInputStream.read(SocketInputStream.java:150)

at java.net.SocketInputStream.read(SocketInputStream.java:121)

at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)

at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)

at java.io.BufferedInputStream.read(BufferedInputStream.java:254)

- locked <0x00000000ecea5c58> (a java.io.BufferedInputStream)

at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:88)

at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1589)

at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:698)

- locked <0x00000000ecea2698> (a com.sun.mail.smtp.SMTPTransport)

at javax.mail.Transport.send0(Transport.java:191)

at javax.mail.Transport.send(Transport.java:118)

at org.apache.log4j.net.SMTPAppender.sendBuffer(SMTPAppender.java:300)

at org.apache.log4j.net.SMTPAppender.append(SMTPAppender.java:181)

at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:286)

- locked <0x00000000fd964fb8> (a org.apache.log4j.net.SMTPAppender)

at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:67)

at org.apache.log4j.Category.callAppenders(Category.java:218)

at org.apache.log4j.Category.forcedLog(Category.java:587)

at org.apache.log4j.Category.error(Category.java:406)

at com.shaklee.processor.UserProfileFileProcessor.processFile(UserProfileFileProcessor.java:96)

- locked <0x00000000fda70e70> (a java.lang.Object)

at com.shaklee.processor.UserProfileFileProcessor.run(UserProfileFileProcessor.java:58)

“Thread-1”守护进程prio=10 tid=0x00007fe584d6f800 nid=0x6ff4 可运行[0x00007fe57c818000]

java.lang.Thread.State:可运行

at sun.nio.fs.LinuxWatchService.poll(Native Method)

at sun.nio.fs.LinuxWatchService.access$600(LinuxWatchService.java:47)

at sun.nio.fs.LinuxWatchService$Poller.run(LinuxWatchService.java:311)

at java.lang.Thread.run(Thread.java:722)

“服务线程”守护进程prio=10 tid=0x00007fe584171800 nid=0x6ff0 可运行[0x0000000000000000]

java.lang.Thread.State:可运行

“C2 CompilerThread1”守护进程prio=10 tid=0x00007fe58416f000 nid=0x6fef 等待条件[0x0000000000000000]

java.lang.Thread.State:可运行

“C2 CompilerThread0”守护进程prio=10 tid=0x00007fe58416c800 nid=0x6fee 等待条件[0x0000000000000000]

java.lang.Thread.State:可运行

“信号调度程序”守护进程prio=10 tid=0x00007fe58416a000 nid=0x6fed 可运行[0x0000000000000000]

java.lang.Thread.State:可运行

“终结器”守护进程 prio=10 tid=0x00007fe58411d000 nid=0x6fec in Object.wait() [0x00007fe57d44b000]

java.lang.Thread.State:等待(在对象监视器上)

at java.lang.Object.wait(Native Method)

- waiting on <0x00000000fdde4588> (a java.lang.ref.ReferenceQueue$Lock)

at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)

- locked <0x00000000fdde4588> (a java.lang.ref.ReferenceQueue$Lock)

at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)

at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:177)

“引用处理程序”守护进程 prio=10 tid=0x00007fe58411b000 nid=0x6feb in Object.wait() [0x00007fe57d54c000]

java.lang.Thread.State:等待(在对象监视器上)

at java.lang.Object.wait(Native Method)

- waiting on <0x00000000fdde43a0> (a java.lang.ref.Reference$Lock)

at java.lang.Object.wait(Object.java:503)

at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)

- locked <0x00000000fdde43a0> (a java.lang.ref.Reference$Lock)

“主”prio=10 tid=0x00007fe584007800 nid=0x6fe7 等待条件 [0x00007fe5884e1000]

java.lang.Thread.State:等待(停车)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for  <0x00000000c4c01a90> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)

at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)

at java.util.concurrent.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:489)

at java.util.concurrent.LinkedBlockingDeque.take(LinkedBlockingDeque.java:678)

at sun.nio.fs.AbstractWatchService.take(AbstractWatchService.java:118)

at com.shaklee.RNTUserProfile.processIncomingFiles(RNTUserProfile.java:140)

at com.shaklee.RNTUserProfile.main(RNTUserProfile.java:74)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)

at com.simontuffs.onejar.Boot.run(Boot.java:342)

at com.simontuffs.onejar.Boot.main(Boot.java:168)

“VM 线程”prio=10 tid=0x00007fe584113800 nid=0x6fea 可运行

“GC 任务线程#0 (ParallelGC)”prio=10 tid=0x00007fe584015000 nid=0x6fe8 可运行

“GC 任务线程#1 (ParallelGC)”prio=10 tid=0x00007fe584017000 nid=0x6fe9 可运行

“VM 周期性任务线程”prio=10 tid=0x00007fe584174800 nid=0x6ff1 等待条件

JNI 全局引用:223

谢谢,JK

4

0 回答 0