Thread Blocking? sun.misc.Unsafe.park(Native Method)

2,351 views
Skip to first unread message

jason zhao yang

unread,
Oct 12, 2015, 7:39:01 AM10/12/15
to DataStax Java Driver for Apache Cassandra User Mailing List
Hi,

Previously, when we are doing loading testing staging server, we found "sun.misc.Unsafe.park(Native Method)" error from Datastax Driver. 
But we were unable to reproduce it on local.

Now when I try benchmark using Java MicroBenchMark Harness. The thread problem was able to reproduce.

I am using single node local Cassandra 2.1.1, Java Driver 2.1.5, Ubuntu 14.04LTS.

Here is the testing code, simply async and then getUninterruptibly.
(About JMH, please see this: About JMH)
    @Benchmark 
    public void test() throws InterruptedException {
    ResultSetFuture future = session.executeAsync(QUERY);
        future.getUninterruptibly()
    }

    public static void main(String[] args) throws RunnerException {
        Options opt = new OptionsBuilder()
                .include(MyBenchmark.class.getSimpleName())
                .forks(1)
                .build();

        new Runner(opt).run();
    }


 

Here is the errror log:

Thread[New I/O worker #2,5,main]
  at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
  at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
  at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79)
  at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
  at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
  at org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:68)
  at org.jboss.netty.channel.socket.nio.AbstractNioSelector.select(AbstractNioSelector.java:415)
  at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:212)
  at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
  at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
  at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
  at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)

Thread[Hashed wheel timer #1,5,main]
  at java.lang.Thread.sleep(Native Method)
  at org.jboss.netty.util.HashedWheelTimer$Worker.waitForNextTick(HashedWheelTimer.java:483)
  at org.jboss.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:392)
  at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
  at java.lang.Thread.run(Thread.java:745)

Thread[Hashed wheel timer #2,5,main]
  at java.lang.Thread.sleep(Native Method)
  at org.jboss.netty.util.HashedWheelTimer$Worker.waitForNextTick(HashedWheelTimer.java:483)
  at org.jboss.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:392)
  at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
  at java.lang.Thread.run(Thread.java:745)

Thread[Reaper-0,5,main]
  at sun.misc.Unsafe.park(Native Method)
  at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
  at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
  at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)



Thank you very much.


Zhao Yang

Olivier Michallat

unread,
Oct 12, 2015, 9:08:57 AM10/12/15
to java-dri...@lists.datastax.com
Hi,

That thread is not blocked, it's sitting idle in an executor that has nothing to do

How are you closing the Cluster instance at the end of your test?

--

Olivier Michallat

Driver & tools engineer, DataStax


To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.

jason zhao yang

unread,
Oct 12, 2015, 10:50:36 PM10/12/15
to DataStax Java Driver for Apache Cassandra User Mailing List
Hi Olivier,

Thanks for your reply.

I didn't close the connection. I initialize Session as static.

And the exception happened in the middle of the benchmark.

So you mean the following log is not a problem?
Thread[Reaper-0,5,main]
 at sun.misc.Unsafe.park(Native Method)
 at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
 at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
 at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
 at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
 at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)


Zhao Yang

在 2015年10月12日星期一 UTC+8下午9:08:57,Olivier Michallat写道:
Reply all
Reply to author
Forward
0 new messages