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

John Ellinwood commented on KARAF-1729:
---------------------------------------

I can reproduce the problem on karaf apache-karaf-3.0.2-20141010.122359-267.  I 
see this creep up in a number of situations from KAR installations with 
incomplete feature installations, blueprint bundles in grace period, to simple 
bundles that aren't finished starting.  One of our test procedures involves 
shutting the power off to our machine and seeing if things come back 
successfully, and this issue regularly affects us.

I believe the root of the problem may be with bundles that have not fully 
started when the karaf process is killed.  I will attach a maven project 
containing a simple bundle that can be used to reproduce the issue.  Simply put 
a Thread.sleep() loop in a bundle activator, kill the karaf process, restart 
karaf, attempt to do anything to the bundle in question (e.g., uninstall, 
headers, etc). I

To reproduce the problem:

start a clean karaf
karaf> install mvn:example/invalid-maven-bundle/1.0.0-SNAPSNOT
kill -9 <karaf pid>
start karaf agaiin
karaf> uninstall <invalid-maven-bundle id>
Bundle is invalid
No bundles specified.

The bundle activator looks like:
package example.karaf_invalid_bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
    public void start(BundleContext context) {
        System.out.println("Starting the bundle");
        while(true) {
                try {
                        Thread.sleep(10000);
                } catch (Exception e) {
                }
        }
    }
    public void stop(BundleContext context) {
        System.out.println("Stopping the bundle");
    }
}

I will continue to investigate this by debugging karaf in the invalid state and 
attempt to see where things went wrong, and hopefully I can then determine 
where in startup this happens.

> Cannot uninstall bundle, bundle xx is invalid
> ---------------------------------------------
>
>                 Key: KARAF-1729
>                 URL: https://issues.apache.org/jira/browse/KARAF-1729
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-osgi
>    Affects Versions: 3.0.0
>            Reporter: Hendy Irawan
>            Assignee: Jean-Baptiste Onofré
>             Fix For: 4.0.0, 3.0.3
>
>         Attachments: karaf-invalid-bundle.tgz
>
>
> Karaf marks a bundle as installed and active, but I can't uninstall it, stop 
> it.
> {code}
> karaf@root()> list -t 0 -s | grep pool
> [1295] [    Active] [   50] org.apache.commons.pool (1.6.0)
> karaf@root()> uninstall 1295
> Bundle 1295 is invalid
> No bundles specified.
> karaf@root()> uninstall 1295
> Bundle 1295 is invalid
> No bundles specified.
> karaf@root()> list -t 0 -s | grep pool
> [1295] [    Active] [   50] org.apache.commons.pool (1.6.0)
> karaf@root()> uninstall org.apache.commons.pool
> No bundles specified.
> karaf@root()> list -t 0 -s | grep pool
> [1295] [    Active] [   50] org.apache.commons.pool (1.6.0)
> karaf@root()> stop 1295
> Bundle 1295 is invalid
> No bundles specified.
> {code}
> Workaround: Delete folder karaf/data/cache/bundle1295



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to