Description
The StoredWiringResolver's bundle wiring cache assumes each requirement is only wired to a single capability. This isn't true for osgi.wiring.host requirements as fragments can attach to multiple hosts.
It is storing only the last wiring it comes across, resulting in the loss of the other wirings when booting with hot caches.
Steps to reproduce:
1. Start a clean karaf
$ bin/karaf __ __ ____ / //_/____ __________ _/ __/ / ,< / __ `/ ___/ __ `/ /_ / /| |/ /_/ / / / /_/ / __/ /_/ |_|\__,_/_/ \__,_/_/ Apache Karaf (4.2.7) Hit '<tab>' for a list of available commands and '[cmd] --help' for help on a specific command. Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf. karaf@root()> list START LEVEL 100 , List Threshold: 50 ID │ State │ Lvl │ Version │ Name 22 │ Active │ 80 │ 4.2.7 │ Apache Karaf :: OSGi Services :: Event
2. Install a fragment bundle and install and start two or more bundles that satisfies the fragment's Fragment-Host requirement
You can use the attached example-1.0-SNAPSHOT.kar file. Put it in the deploy folder and it will install a fragment bundle and three hosts:
Starting the host 2 Starting the host 1 Starting the host 3
3. Check that the bundles are correctly installed and the fragment is attached to all three hosts
karaf@root()> list START LEVEL 100 , List Threshold: 50 ID │ State │ Lvl │ Version │ Name 22 │ Active │ 80 │ 4.2.7 │ Apache Karaf :: OSGi Services :: Event 44 │ Resolved │ 80 │ 1.0.0.SNAPSHOT │ fragment Bundle, Hosts: 47, 46, 45 45 │ Active │ 80 │ 1.0.0 │ host1 Bundle, Fragments: 44 46 │ Active │ 80 │ 1.5.0 │ host2 Bundle, Fragments: 44 47 │ Active │ 80 │ 2.0.0 │ host3 Bundle, Fragments: 44
4. However, notice that the wiring cache of the fragment bundle (44) isn't right
$ cat data/cache/bundle0/wiring/44 osgi.ee; (&(osgi.ee=JavaSE)(version=1.8)) 0; version=[1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.8.0] osgi.wiring.host; (&(osgi.wiring.host=our-host)(bundle-version>=0.0.0)) 45
5. Stop karaf
karaf@root()> ^D Stopping the host 3 Stopping the host 2 Stopping the host 1
6. Start karaf with hot caches
$ bin/karaf org.ops4j.pax.url.wrap [org.ops4j.pax.url.commons.handler.HandlerActivator] DEBUG : Handler for protocols [wrap] started __ __ ____ / //_/____ __________ _/ __/ / ,< / __ `/ ___/ __ `/ /_ / /| |/ /_/ / / / /_/ / __/ /_/ |_|\__,_/_/ \__,_/_/ Apache Karaf (4.2.7) Hit '<tab>' for a list of available commands and '[cmd] --help' for help on a specific command. Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf. Starting the host 1 Starting the host 2 Starting the host 3
7. Check that the fragment is no longer correctly attached to all three hosts, but just to one
karaf@root()> list START LEVEL 100 , List Threshold: 50 ID │ State │ Lvl │ Version │ Name 22 │ Active │ 80 │ 4.2.7 │ Apache Karaf :: OSGi Services :: Event 44 │ Resolved │ 80 │ 1.0.0.SNAPSHOT │ fragment Bundle, Hosts: 45 45 │ Active │ 80 │ 1.0.0 │ host1 Bundle, Fragments: 44 46 │ Active │ 80 │ 1.5.0 │ host2 Bundle 47 │ Active │ 80 │ 2.0.0 │ host3 Bundle
Attachments
Attachments
Issue Links
- links to