merks / simrel-maven

A copy of the simrel report generated by the Oomph incubator
Eclipse Public License 2.0
0 stars 0 forks source link

Aries logs an error on startup #10

Open merks opened 10 months ago

merks commented 10 months ago

@HannesWell @jonahgraham @scottslewis

For lack of a better place to open an issue, opened it here...

Installing the Eierlegende Wollmilchsau 2023-09 RC1, this was logged:

org.osgi.framework.BundleException: Exception in org.apache.aries.spifly.dynamic.DynamicWeavingActivator.start() of bundle org.apache.aries.spifly.dynamic.bundle. at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:839) at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:767) at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1032) at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:371) at org.eclipse.osgi.container.Module.doStart(Module.java:605) at org.eclipse.osgi.container.Module.start(Module.java:468) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1852) at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1845) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1788) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1750) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1672) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) Caused by: java.lang.RuntimeException: org.osgi.framework.InvalidSyntaxException: Filter ended abruptly: (&(osgi.extender at org.apache.aries.spifly.ConsumerBundleTrackerCustomizer.addingBundle(ConsumerBundleTrackerCustomizer.java:39) at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:475) at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1) at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) at org.osgi.util.tracker.BundleTracker.open(BundleTracker.java:159) at org.apache.aries.spifly.BaseActivator.start(BaseActivator.java:103) at org.apache.aries.spifly.dynamic.DynamicWeavingActivator.start(DynamicWeavingActivator.java:37) at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:818) at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:1) at java.base/java.security.AccessController.doPrivileged(AccessController.java:569) at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:810) ... 14 more Caused by: org.osgi.framework.InvalidSyntaxException: Filter ended abruptly: (&(osgi.extender at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse(FilterImpl.java:1334) at org.eclipse.osgi.internal.framework.FilterImpl.newInstance(FilterImpl.java:181) at org.eclipse.osgi.internal.framework.FilterImpl.newInstance(FilterImpl.java:177) at org.osgi.framework.FrameworkUtil.createFilter(FrameworkUtil.java:83) at org.apache.aries.spifly.ConsumerHeaderProcessor.findRequirement(ConsumerHeaderProcessor.java:268) at org.apache.aries.spifly.ConsumerHeaderProcessor.processRequireCapabilityHeader(ConsumerHeaderProcessor.java:197) at org.apache.aries.spifly.ConsumerHeaderProcessor.processHeader(ConsumerHeaderProcessor.java:80) at org.apache.aries.spifly.BaseActivator.addConsumerWeavingData(BaseActivator.java:143) at org.apache.aries.spifly.ConsumerBundleTrackerCustomizer.addingBundle(ConsumerBundleTrackerCustomizer.java:37) ... 25 more Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 16 out of bounds for length 16 at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_attr(FilterImpl.java:1515) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_item(FilterImpl.java:1443) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_filtercomp(FilterImpl.java:1387) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_filter(FilterImpl.java:1353) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_and(FilterImpl.java:1402) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_filtercomp(FilterImpl.java:1376) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_filter(FilterImpl.java:1353) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse(FilterImpl.java:1332) ... 33 more Root exception: java.lang.RuntimeException: org.osgi.framework.InvalidSyntaxException: Filter ended abruptly: (&(osgi.extender at org.apache.aries.spifly.ConsumerBundleTrackerCustomizer.addingBundle(ConsumerBundleTrackerCustomizer.java:39) at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:475) at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1) at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) at org.osgi.util.tracker.BundleTracker.open(BundleTracker.java:159) at org.apache.aries.spifly.BaseActivator.start(BaseActivator.java:103) at org.apache.aries.spifly.dynamic.DynamicWeavingActivator.start(DynamicWeavingActivator.java:37) at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:818) at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:1) at java.base/java.security.AccessController.doPrivileged(AccessController.java:569) at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:810) at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:767) at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1032) at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:371) at org.eclipse.osgi.container.Module.doStart(Module.java:605) at org.eclipse.osgi.container.Module.start(Module.java:468) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1852) at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1845) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1788) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1750) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1672) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) Caused by: org.osgi.framework.InvalidSyntaxException: Filter ended abruptly: (&(osgi.extender at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse(FilterImpl.java:1334) at org.eclipse.osgi.internal.framework.FilterImpl.newInstance(FilterImpl.java:181) at org.eclipse.osgi.internal.framework.FilterImpl.newInstance(FilterImpl.java:177) at org.osgi.framework.FrameworkUtil.createFilter(FrameworkUtil.java:83) at org.apache.aries.spifly.ConsumerHeaderProcessor.findRequirement(ConsumerHeaderProcessor.java:268) at org.apache.aries.spifly.ConsumerHeaderProcessor.processRequireCapabilityHeader(ConsumerHeaderProcessor.java:197) at org.apache.aries.spifly.ConsumerHeaderProcessor.processHeader(ConsumerHeaderProcessor.java:80) at org.apache.aries.spifly.BaseActivator.addConsumerWeavingData(BaseActivator.java:143) at org.apache.aries.spifly.ConsumerBundleTrackerCustomizer.addingBundle(ConsumerBundleTrackerCustomizer.java:37) ... 25 more Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 16 out of bounds for length 16 at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_attr(FilterImpl.java:1515) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_item(FilterImpl.java:1443) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_filtercomp(FilterImpl.java:1387) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_filter(FilterImpl.java:1353) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_and(FilterImpl.java:1402) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_filtercomp(FilterImpl.java:1376) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse_filter(FilterImpl.java:1353) at org.eclipse.osgi.internal.framework.FilterImpl$Parser.parse(FilterImpl.java:1332) ... 33 more

No clue in the log about the bundle original of this problem, so I used remote debug to figure that out:

image

Of course this begs the question "why are examples are available to be installed"?

In any case, the problem arises here in aries parsing the header:

    private static Set<WeavingData> processRequireCapabilityHeader(String consumerHeader) throws InvalidSyntaxException {
        Set<WeavingData> weavingData = new HashSet<WeavingData>();

        Parameters requirements = OSGiHeader.parseHeader(consumerHeader);

Here is a stand-alone program demonstrating the nature of the problem:

package bizq;

import aQute.bnd.header.OSGiHeader;

public class Test {
    public static void main(String[] args) {
        for (var header : new String[] {
                "osgi.extender; filter:=(&(osgi.extender=osgi.remoteserviceadmin) (version>=1.1) (!(version>=2.0))),osgi.extender;filter:=\"(&(osgi.extender=osgi.remoteserviceadmin.localdiscovery)(version>=1.0)(!(version>=2.0)))\"",
                "osgi.extender; filter:=\"(&(osgi.extender=osgi.remoteserviceadmin) (version>=1.1) (!(version>=2.0)))\",osgi.extender;filter:=\"(&(osgi.extender=osgi.remoteserviceadmin.localdiscovery)(version>=1.0)(!(version>=2.0)))\"", }) {
            var parseHeader = OSGiHeader.parseHeader(header);
            System.out.println(header);
            for (var entry : parseHeader.entrySet()) {
                System.out.print("  ");
                System.out.println(entry);
            }
        }
    }
}

It prints out this:

osgi.extender; filter:=(&(osgi.extender=osgi.remoteserviceadmin) (version>=1.1) (!(version>=2.0))),osgi.extender;filter:="(&(osgi.extender=osgi.remoteserviceadmin.localdiscovery)(version>=1.0)(!(version>=2.0)))"
  osgi.extender=filter:="(&(osgi.extender"
osgi.extender; filter:="(&(osgi.extender=osgi.remoteserviceadmin) (version>=1.1) (!(version>=2.0)))",osgi.extender;filter:="(&(osgi.extender=osgi.remoteserviceadmin.localdiscovery)(version>=1.0)(!(version>=2.0)))"
  osgi.extender=filter:="(&(osgi.extender=osgi.remoteserviceadmin) (version>=1.1) (!(version>=2.0)))"
  osgi.extender~=filter:="(&(osgi.extender=osgi.remoteserviceadmin.localdiscovery)(version>=1.0)(!(version>=2.0)))"

The only difference is the quotes around the filter:='s value. I don't think the header is invalid according to the OSGi specification; I think the header parsing utility is what's wrong.

Note that aries has a copy of that utility:

image

What should "we" do about this? ECF could add the quotes around the filter value, aQute ought to fix the parsing problem. and aries needs a copy of that fix.

HannesWell commented 10 months ago

The only difference is the quotes around the filter:='s value. I don't think the header is invalid according to the OSGi specification; I think the header parsing utility is what's wrong.

I'm not sure about that. In the spec 3.2.7 Filter Syntax and 3.3.6 Bundle Requirements are probably the relevant sections but I cannot find anything about quotes there. Probably @tjwatson knows that best?

What should "we" do about this? ECF could add the quotes around the filter value, aQute ought to fix the parsing problem. and aries needs a copy of that fix.

Fixing this at ECF would probably the simplest. If this is really valid of course a fix in BND-tools would of course be good. And even if this is invalid, the error message should be a bit more precise.

Besides that, did you noticed any loss in functionality or is this just an annoying message?

merks commented 10 months ago

I think it was just an annoyingly incorrect messages. Equinox itself has unquoted examples:

image

HannesWell commented 10 months ago

Then it is probably valid.

Did you test your standalone demo with the latest version of BND's OSGIHeader class? If this error occures there it is probably a good idea to report that at https://github.com/bndtools/bnd/issues. The BND devs are usually very well aware of the spec and will tell you if this is, for whatever reason, actually not a valid input.

merks commented 10 months ago

I think it's the latest:

image

HannesWell commented 10 months ago

I think it's the latest:

Yes it is.