felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nölle (JIRA) <j...@apache.org>
Subject [jira] [Commented] (FELIX-5416) Endless loop throwing InterruptedException when shutting down framework
Date Fri, 12 May 2017 13:24:04 GMT

    [ https://issues.apache.org/jira/browse/FELIX-5416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16008115#comment-16008115
] 

Christoph Nölle commented on FELIX-5416:
----------------------------------------

Seems to be a problem in the terminate method of ComponentActorThread (see below). Suppose
we run into tasks.wait(), the thread gets interrupted, and the tasks lists is not empty yet.
Then the catch block is executed, we interrupt the thread, and run into tasks.wait() again.
But since the thread has been interrupted, another InterruptedException is raised immediately,
and we are caught in a loop.

I think that there should be either a return statement at the end of the catch block (then
the remaining tasks in the list will not be executed), or the interrupt() call should be moved
outside the while loop.

void terminate()
    {
        schedule( TERMINATION_TASK );
        synchronized ( tasks )
        {
            while ( !tasks.isEmpty() )
            {
                try
                {
                    tasks.wait();
                }
                catch ( InterruptedException e )
                {
                    Thread.currentThread().interrupt();
                    logger.log( LogService.LOG_ERROR, "Interrupted exception waiting for queue
to empty", e );
                }
            }
        }
    }

> Endless loop throwing InterruptedException when shutting down framework
> -----------------------------------------------------------------------
>
>                 Key: FELIX-5416
>                 URL: https://issues.apache.org/jira/browse/FELIX-5416
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-2.0.6
>         Environment: OS: linux and windows
> Java Version: 1.8.0_111
> OSGi Impl: Apache Felix (5.6.1)
>            Reporter: Jorge Cercas
>
> When shutting down the framework via the framework's stop method or in a gogo terminal
shell via stop 0 command, the Apache Felix Declarative Services goes into a never ending loop
with the following log ENTRIES:
> 2016-11-16 17:44:22,030 | ERROR | FelixStartLevel  | scr                            
 | 7 - org.apache.felix.scr - 2.0.6 | Interrupted exception waiting for queue to empty
> java.lang.InterruptedException
> 	at java.lang.Object.wait(Native Method)[:1.8.0_111]
> 	at java.lang.Object.wait(Object.java:502)[:1.8.0_111]
> 	at org.apache.felix.scr.impl.ComponentActorThread.terminate(ComponentActorThread.java:131)[7:org.apache.felix.scr:2.0.6]
> 	at org.apache.felix.scr.impl.Activator.doStop(Activator.java:216)[7:org.apache.felix.scr:2.0.6]
> 	at org.apache.felix.utils.extender.AbstractExtender.stop(AbstractExtender.java:128)[7:org.apache.felix.scr:2.0.6]
> 	at org.apache.felix.scr.impl.Activator.stop(Activator.java:181)[7:org.apache.felix.scr:2.0.6]
> 	at org.apache.felix.framework.util.SecureAction.stopActivator(SecureAction.java:719)[org.apache.felix.framework-5.6.1.jar:]
> 	at org.apache.felix.framework.Felix.stopBundle(Felix.java:2610)[org.apache.felix.framework-5.6.1.jar:]
> 	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1389)[org.apache.felix.framework-5.6.1.jar:]
> 	at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)[org.apache.felix.framework-5.6.1.jar:]
> 	at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message