Skip to content

p2 can install a bundle family that OSGi cannot resolve when a third-party constraint pins one member #1119

Description

@hspdf

Summary

When several bundles form a family that imports each other's packages with strict micro-version ranges, and one member is held back by a version constraint from an unrelated installed component, p2 will happily upgrade the remaining members. The resulting profile is valid by p2's rules but cannot be resolved by OSGi, and the installation is only discovered to be broken on the next start.

Concrete case

Eclipse IDE for Enterprise Java and Web Developers, buildId 4.40.0.20260604-0652, Java 25.0.3, Linux GTK x86_64. A routine "Check for Updates" on 2026-09-01 08:38 UTC installed 78 jars (m2e 2.11.0, m2e.logback 2.7.300, m2e.pde 2.3.800, 19 EMF features, Checkstyle 13.9.0, plus bnd 7.4.0, lsp4e, tm4e and others). Among them four of the five ASM bundles:

org.objectweb.asm                9.9.1  +  9.10.1
org.objectweb.asm.commons        9.9.1            <- not upgraded
org.objectweb.asm.tree           9.9.1  +  9.10.1
org.objectweb.asm.tree.analysis           9.10.1
org.objectweb.asm.util                    9.10.1

Afterwards the IDE would not start:

java.lang.RuntimeException: Application "org.eclipse.ui.ide.workbench"
could not be found in the registry.

Why the resulting state cannot resolve

The Orbit ASM bundles import each other with strict micro ranges:

org.objectweb.asm.commons 9.9.1   imports org.objectweb.asm [9.9.1,9.10)
org.objectweb.asm.util    9.10.1  imports org.objectweb.asm [9.10.1,9.11)

org.apache.aries.spifly.dynamic.bundle imports org.objectweb.asm, org.objectweb.asm.commons and org.objectweb.asm.util, each [9.6,10). With only asm.commons 9.9.1 and asm.util 9.10.1 available, spifly is exposed to two conflicting wirings of the org.objectweb.asm package and fails on a uses constraint. On Eclipse 4.36+ that cascades into the workbench, because org.eclipse.jface and org.eclipse.ui mandatorily require the SVG capability provided by org.eclipse.swt.svg → jsvg → SPI-Fly → ASM. See eclipse-platform/eclipse.platform.ui#4328 for that part.

Why p2 chose this

From the profile snapshot taken before the update, exactly two IUs consume asm.commons:

org.apache.aries.spifly.dynamic.bundle 1.3.7  ->  [9.6.0,10.0.0)   open
org.jacoco.core 0.8.14                        ->  [9.9.0,9.10.0)   pinned

EclEmma's JaCoCo pins asm.commons to 9.9.x. The other four ASM bundles are only referenced through open ranges, so p2's "prefer newest" took them to 9.10.1 and left asm.commons behind. Every individual choice is legal; the combination is not installable.

Note this is not caused by an incomplete repository. org.objectweb.asm.commons 9.10.1 exists in Orbit Aggregation 2026-09 and installs fine — I later added that site and installed it explicitly with p2.director -installIU. Even with the complete family visible, p2 does not add it on its own, because 9.9.1 already satisfies spifly's open range. A complete repository produces the identical split.

What I would like to ask for

Not full uses-constraint modelling in the solver. I understand that is a large investment (@akurtakov made the same point in eclipse-platform/eclipse.platform.ui#4328).

Something narrower would already have prevented this: validate the computed provisioning plan against the OSGi resolver before applying it. p2 has every manifest in hand at that point. Running Equinox's resolver over the prospective bundle set and refusing (or at least warning) when it does not resolve would turn a silently broken installation into an error message while the old, working configuration is still in place. That is a validation pass rather than a change to the SAT solver.

If that is still too costly, even detecting the narrow pattern would help: two versions of the same exported package, both reachable from a single requirer whose import ranges span both.

Related

This failure shape has come up repeatedly:

@merks noted in oomph#203 that bouncycastle produces the same shape, so it is not ASM-specific. He also suggested in #4328 that singleton:=true on the ASM bundles would have forced a coherent outcome. That is true (JaCoCo would have capped the whole family at 9.9.1), but it would also forbid legitimate side-by-side installs, so it seems more like an Orbit-side trade-off than a general fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions