jmockit / jmockit1

Advanced Java library for integration testing, mocking, faking, and code coverage
Other
461 stars 239 forks source link

Test hangs when trying to initialize the mock #117

Closed nitinpasula closed 9 years ago

nitinpasula commented 9 years ago

Hi

I have weird issue going on, this happens only on a linux VM where the test is run The tests hangs when it is trying to initialize the mock. Here is the snippet from thread dump

"RMI TCP Connection(11)-132.253.8.162" Id=155 daemon prio=5 RUNNABLE (in native) Blocked (cnt): 4; Waited (cnt): 6 CPU nanos: 316001400; User nanos: 290000000; Bytes allocated: 16268048 Method context: 10wdtwi;i3qgy3di;22299;3k824z;2; DB session: 384 at sun.tools.attach.LinuxVirtualMachine.read(Native Method) at sun.tools.attach.LinuxVirtualMachine$SocketInputStream.read(LinuxVirtualMachine.java:259)

"JMX Monitor ThreadGroup

Executor Pool [Thread-1]" Id=154 daemon prio=5 TIMED_WAITING on lock=java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@5603731e Blocked (cnt): 0; Waited (cnt): 1 CPU nanos: 79011889; User nanos: 70000000; Bytes allocated: 28760 at sun.misc.Unsafe.park(Native Method) at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2082) at java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

rliesenfeld commented 9 years ago

What is the JDK/JRE being used to run tests? Is it an Oracle JDK, or OpenJDK? Which version? If it is OpenJDK, did you try the Oracle JDK too?

As a workaround, JMockit can also be initialized with the "-javaagent:jmockit.jar" JVM parameter, which avoids use of the "attach" API seen in the stack trace.