[infinispan-issues] [JBoss JIRA] (ISPN-10346) BlockingTaskAwareExecutorServiceImpl may leak controller thread

Dan Berindei (Jira) issues at jboss.org
Tue Jun 25 06:34:00 EDT 2019


    [ https://issues.jboss.org/browse/ISPN-10346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13751273#comment-13751273 ] 

Dan Berindei commented on ISPN-10346:
-------------------------------------

The thread leak was actually caused by one of my changes for ISPN-10330. I thought it would be a good idea to not start the dependencies of factories too early, but I didn't realize that {{NamedExecutorsFactory}} is responsible for stopping all the executors it creates, so it must start before any of them is injected.

> BlockingTaskAwareExecutorServiceImpl may leak controller thread
> ---------------------------------------------------------------
>
>                 Key: ISPN-10346
>                 URL: https://issues.jboss.org/browse/ISPN-10346
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Core, Test Suite - Core
>    Affects Versions: 10.0.0.Beta3
>            Reporter: Dan Berindei
>            Assignee: Dan Berindei
>            Priority: Major
>             Fix For: 10.0.0.Beta4
>
>
> I got a thread leak when running the test suite with trace logging enabled and {{taskset -c 1-2}}:
> {noformat}
> 17:06:05,307 DEBUG (testng-Test:[]) [TestSuiteProgress] Test configuration finished: org.infinispan.remoting.transport.InitialClusterSizeTest.testClassFinished
> 17:15:17,284 ERROR [TestSuiteProgress] Test failed: InitialClusterSizeTest.ThreadLeakChecker
> java.lang.RuntimeException: Leaked thread Controller-remote-thread-InitialClusterSizeTest-NodeB
> 	at jdk.internal.misc.Unsafe.park(Native Method) ~[?:?]
> 	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) ~[?:?]
> 	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:885) ~[?:?]
> 	at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1039) ~[?:?]
> 	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1345) ~[?:?]
> 	at java.util.concurrent.Semaphore.acquire(Semaphore.java:318) ~[?:?]
> 	at org.infinispan.util.concurrent.BlockingTaskAwareExecutorServiceImpl$ControllerThread.run(BlockingTaskAwareExecutorServiceImpl.java:159) ~[classes/:?]
> {noformat}
> I believe it may be caused by {{doExecute()}} adding a task to the blocked tasks queue without calling {{checkForReadyTasks()}} (after the executor rejected the task). {{ControllerThread.run()}} needs a semaphore permit to start polling for tasks, so it needs a {{semaphore.release()}} after each {{blockedTasks.add().



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the infinispan-issues mailing list