Hendy Irawan created ARIES-1033: ----------------------------------- Summary: Blueprint does not stop bundle when a dependency service is gone Key: ARIES-1033 URL: https://issues.apache.org/jira/browse/ARIES-1033 Project: Aries Issue Type: Bug Components: Blueprint Affects Versions: blueprint-core-1.0.1 Environment: karaf@root> list -s -t 0 | grep bluepri [ 7] [Active ] [Created ] [ 20] org.apache.aries.blueprint.core (1.1.0) [ 8] [Active ] [Created ] [ 20] org.apache.aries.blueprint.cm (1.0.1) [ 13] [Active ] [ ] [ 20] org.apache.aries.blueprint.api (1.0.0) [ 16] [Active ] [Created ] [ 28] org.apache.karaf.deployer.blueprint (2.3.1) [ 35] [Active ] [ ] [ 30] org.apache.aries.jmx.blueprint.core (1.1.0) [ 38] [Active ] [ ] [ 30] org.apache.aries.jmx.blueprint.api (1.1.0)
Karaf Karaf version 2.3.1 Karaf home /home/rudi/git/bippo-commerce5/karaf_mini Karaf base /home/rudi/git/bippo-commerce5/karaf_mini OSGi Framework org.apache.felix.framework - 4.0.3 JVM Java Virtual Machine OpenJDK 64-Bit Server VM version 23.7-b01 Version 1.7.0_15 Vendor Oracle Corporation Uptime 12 minutes Total compile time 3.927 seconds Threads Live threads 32 Daemon threads 27 Peak 35 Total started 47 Memory Current heap size 67,978 kbytes Maximum heap size 466,048 kbytes Committed heap size 158,400 kbytes Pending objects 0 Garbage collector Name = 'PS Scavenge', Collections = 4, Time = 0.025 seconds Garbage collector Name = 'PS MarkSweep', Collections = 1, Time = 0.023 seconds Classes Current classes loaded 3,452 Total classes loaded 3,452 Total classes unloaded 0 Operating system Name Linux version 3.5.0-25-generic Architecture amd64 Processors 8 Reporter: Hendy Irawan BTW the blueprint.core 1.1.0 is not available in the JIRA choices. It should be added. Here's the dependency: {code} <bean id="hello" class="com.hendyirawan.blueprintdep.dep.HelloImpl" init-method="init" destroy-method="destroy"/> <service ref="hello" auto-export="interfaces"/> {code} Here's the consumer: (note that adding `depends-on` has no effect on behavior) {code} <reference id="hello" interface="com.hendyirawan.blueprintdep.dep.HelloService"/> <bean id="consumer" class="com.hendyirawan.blueprintdep.consumer.Consumer" init-method="init" destroy-method="destroy"> <argument ref="hello"/> </bean> {code} 1. Install the dependency, but don't start it. Then install the consumer and start it. We'll get this which is correct behavior: {code} karaf@root> list START LEVEL 100 , List Threshold: 50 ID State Blueprint Level Name [ 54] [Resolved ] [ ] [ 80] com.hendyirawan.blueprintdep.dep (0.0.1.SNAPSHOT) [ 55] [Active ] [GracePeriod ] [ 80] com.hendyirawan.blueprintdep.consumer (0.0.1.SNAPSHOT) {code} 2. Start the dependency. The dependency is started and also the consumer, also correct behavior: {code} karaf@root> start 54 karaf@root> HelloService constructed HelloService inited Consumer created karaf@root> list START LEVEL 100 , List Threshold: 50 ID State Blueprint Level Name [ 54] [Active ] [Created ] [ 80] com.hendyirawan.blueprintdep.dep (0.0.1.SNAPSHOT) [ 55] [Active ] [Created ] [ 80] com.hendyirawan.blueprintdep.consumer (0.0.1.SNAPSHOT) {code} 3. Stop the dependency. Here's unexpected behavior. The dependency is now in 'resolved' state but the consumer stays in Active-Created state: {code} karaf@root> stop 54 HelloService destroyed karaf@root> list START LEVEL 100 , List Threshold: 50 ID State Blueprint Level Name [ 54] [Resolved ] [ ] [ 80] com.hendyirawan.blueprintdep.dep (0.0.1.SNAPSHOT) [ 55] [Active ] [Created ] [ 80] com.hendyirawan.blueprintdep.consumer (0.0.1.SNAPSHOT) {code} 4. If we restart the consumer, now the consumer is aware that dependency is gone, so consumer is destroyed and goes to GracePeriod. But this should have happened in step 3 without manual restart: {code} karaf@root> restart 55 Consumer destroyed karaf@root> list START LEVEL 100 , List Threshold: 50 ID State Blueprint Level Name [ 54] [Resolved ] [ ] [ 80] com.hendyirawan.blueprintdep.dep (0.0.1.SNAPSHOT) [ 55] [Active ] [GracePeriod ] [ 80] com.hendyirawan.blueprintdep.consumer (0.0.1.SNAPSHOT) {code} Is this a bug or that there's a Blueprint trick I'm not aware yet? The sample project is available at https://github.com/ceefour/blueprintdep -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira