Hi,
I have a karaf instance which is starved for CPU, which might be helpful to
figure out how it could come to this:
A threaddump shows the following:
at sun.misc.Unsafe.park(boolean, long)
at java.util.concurrent.locks.LockSupport.park(java.lang.Object) (line:
175)
at java.util.concurrent.FutureTask.awaitDone(boolean, long) (line: 429)
at java.util.concurrent.FutureTask.get() (line: 191)
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvisionInThread(java.util.Map,
java.util.Map, org.apache.karaf.features.internal.service.State,
java.util.EnumSet) (line: 1071)
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRequirements(java.util.Map,
java.util.EnumSet) (line: 1014)
I checked the executor that is used here, and its thread is:
at sun.misc.Unsafe.park(boolean, long) at
java.util.concurrent.locks.LockSupport.parkNanos(java.lang.Object, long)
(line: 215)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(long)
(line: 2078)
at
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take()
(line: 1093)
at
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take()
(line: 809)
at java.util.concurrent.ThreadPoolExecutor.getTask() (line: 1067)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker)
(line: 1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run() (line: 617)
at java.lang.Thread.run() (line: 745)
So the thread is ready for work, the FeaturesService is waiting for the
work to complete.
Now it gets interesting. Looking at the heap dump, I can see the lambda
instance, and it is claimed to be on the stack of the executor thread
[image: Inline image 1]
But the thread dump disagrees.
The reason is, that this pool-3-thread-1 exists twice!
So the get() is waiting forever, because the thread that is supposed to run
the callable is not running.
I am actually quite puzzled how this could happen. Any ideas, suggestions
what I could look for?
What I think should happen in any case is that the doProvisionInThread sets
a timeout on the get() method, then potentially retires or other actions
could fix this situation.
Maybe the Features service was restarted? with bad timing? The stop()
method of the features service potentially should cancel/interrupt pending
tasks?
Fabian
--
Fabian Lange | Performance Expert
mobil: +49 (0) 160.3673393
codecentric AG | Hochstraße 11 | 42697 Solingen | Deutschland
Sitz der Gesellschaft: Solingen | HRB 25917| Amtsgericht Wuppertal
Vorstand: Michael Hochgürtel . Mirko Novakovic . Rainer Vehns
Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Klaus Jäger . Jürgen Schütz