You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by Steinar Bang <sb...@dod.no> on 2022/05/14 06:56:26 UTC

Stack overflow in gogo shell on second "feature:install"

Platform: karaf 4.3.7, java 11, debian 11.3 "bullseye"

When I run the first "feature:install" everything works fine.

But when I try to "feature:install" for a different feature, felix gogo
shell gets a stack overflow:
 https://gist.github.com/steinarb/cfbb1fad2795a93c0eda55951b85ab44

The stack trace is from karaf 4.3.6, but I have verified that it fails
in the same way on karaf 4.3.7.

My apps don't install on 4.4.0 yet, so I haven't tried that.

Is this a known bug, or should I create a Jira for it?


Re: Stack overflow in gogo shell on second "feature:install"

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:

> I think this may be (as JB hinted at), a problem with my features,
> rather than a bug in karaf.

> I think the problem is with this feature:
>  https://github.com/steinarb/oldalbum/blob/master/oldalbum.roleadder.test/src/main/feature/feature.xml#L3
> created in this commit:
>  https://github.com/steinarb/oldalbum/commit/d05e79fe598091781e760f1b74eb0b53b7df0e32

> (this is the feature the resolver infloops on)

Nope! That wasn't it.

> I will post the conclusions of my debugging on this thread, but other
> than that I'll go quiet until I've figured this out.

Turns out the reason was rather trivial and silly: one leftover
dependency during the last big upgrade:
 https://github.com/steinarb/sampleapp/commit/18b6eeb048cc06adbad5427bdcefb361e18ed6e0

The resulting runtime feature tried to resolve version 1.8.4 of some of
these:
 https://github.com/steinarb/jersey-karaf-feature
when 1.8.5 of the feature already had been installed.

And that resolution inflooped.


Re: Stack overflow in gogo shell on second "feature:install"

Posted by Steinar Bang <sb...@dod.no>.
I think this may be (as JB hinted at), a problem with my features,
rather than a bug in karaf.

I think the problem is with this feature:
 https://github.com/steinarb/oldalbum/blob/master/oldalbum.roleadder.test/src/main/feature/feature.xml#L3
created in this commit:
 https://github.com/steinarb/oldalbum/commit/d05e79fe598091781e760f1b74eb0b53b7df0e32

(this is the feature the resolver infloops on)

I will post the conclusions of my debugging on this thread, but other
than that I'll go quiet until I've figured this out.



Re: Stack overflow in gogo shell on second "feature:install"

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:

> Maybe I can try a remote debug into karaf and figure out what is
> attempted loaded that way...?

I've done remote debugging of the second call to bundle:install.

One thing I see, is that in the call to Deployer.handlrePrerequisites()
on line 394 (in the karaf-4.3.x branch) of Deployer.java, the feature
I'm requesting seems to be part of the prerequisites:

{root=[feature:system/[4.3.7,4.3.7], feature:diagnostic/[4.3.7,4.3.7], feature:kar/[4.3.7,4.3.7], feature:oldalbum-with-derby/[1.8.0.SNAPSHOT,1.8.0.SNAPSHOT], feature:service/[4.3.7,4.3.7], feature:jaas/[4.3.7,4.3.7], feature:config/[4.3.7,4.3.7], feature:feature/[4.3.7,4.3.7], feature:management/[4.3.7,4.3.7], feature:sampleapp-with-derby/[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT], feature:wrap/[2.6.10,2.6.10], feature:log/[4.3.7,4.3.7], feature:instance/[4.3.7,4.3.7], feature:bundle/[4.3.7,4.3.7], feature:eventadmin/[4.3.7,4.3.7], feature:shell/[4.3.7,4.3.7], feature:ssh/[4.3.7,4.3.7], feature:package/[4.3.7,4.3.7], feature:deployer/[4.3.7,4.3.7], feature:framework/[4.3.7,4.3.7]]}

(in this case sampleapp-with-derby)

Presumably that's why it seems to go loopety-loop between
Deployer.deploy() and Deployer.handlePrerequisites() until the stack
overflows...?

But why this happens and also why this only happens only on the second
use of the bundle:install command, is still unclear...?

I see that sampleapp-with-derby (the feature currently being installed)
and the feature I installed with the first feature:install are the only
non-karaf features in the list.

Also: why is oldalbum-with-derby part of the prerquisites?
 1. It's already installed
 2. It is not a prerequisite listed by sampleapp-with-derby

The search continues.


Re: Stack overflow in gogo shell on second "feature:install"

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Jean-Baptiste Onofré <jb...@nanthrax.net>:

> Thanks,
> I will take a look on your project/features asap (I will travel
> tomorrow and Monday, but I should have time mid week).

It seems to affect all of my projects and happens on the second
feature:install.

Digging into it feels a bit like looking for a needle in a haystack.

Is there a way to list out the feature/bundle that is attempted loaded
when it starts looping?

Maybe I can try a remote debug into karaf and figure out what is
attempted loaded that way...?


Re: Stack overflow in gogo shell on second "feature:install"

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Thanks,

I will take a look on your project/features asap (I will travel
tomorrow and Monday, but I should have time mid week).

Regards
JB

On Sat, May 14, 2022 at 12:34 PM Steinar Bang <sb...@dod.no> wrote:
>
> >>>>> Jean-Baptiste Onofré <jb...@nanthrax.net>:
>
> > Hi,
> > It looks related to the resolver: it seems you have an infinite loop
> > in requirements check for your feature.
>
> Ok, so you're saying the problem is in my features and not in the
> resolver?
>
> > Do you have something special in terms of req/cap in your feature (and
> > bundles in the feature) ?
>
> Well, both of the applications I have looked at have pulled in their a
> third feature, called authservice, so that is a possible loop...?
>
> The two applications where I have seen the problem, are:
>  1. https://github.com/steinarb/oldalbum
>     Install: https://github.com/steinarb/oldalbum#installation-with-test-database
>     (this will install from maven central, it is possible that you need
>     to build a local snapshot and install from that to trigger the
>     issue...? (I haven't checked yet))
>  2. https://github.com/steinarb/sampleapp
>     Build and install: https://github.com/steinarb/sampleapp#installing-the-sample-application
>
> The third feature they both pull in, is: https://github.com/steinarb/authservice
> (provides shiro based authentication for webapps)
>
> All of these three applications consist of OSGi bundles with
> accompanying features created by karaf-maven-plugin, and with
> handwritten features on top of those that install the application.
>
> The handwritten features, are:
>  1. https://github.com/steinarb/oldalbum/blob/master/karaf/src/main/filtered-resources/feature.xml#L16
>  2. https://github.com/steinarb/sampleapp/blob/master/karaf/src/main/filtered-resources/feature.xml#L16
>
> I'm off to the mountains now for a long weekend and I don't have time to
> debug this closer now, but will do so when I get back down.
>

Re: Stack overflow in gogo shell on second "feature:install"

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Jean-Baptiste Onofré <jb...@nanthrax.net>:

> Hi,
> It looks related to the resolver: it seems you have an infinite loop
> in requirements check for your feature.

Ok, so you're saying the problem is in my features and not in the
resolver?

> Do you have something special in terms of req/cap in your feature (and
> bundles in the feature) ?

Well, both of the applications I have looked at have pulled in their a
third feature, called authservice, so that is a possible loop...?

The two applications where I have seen the problem, are:
 1. https://github.com/steinarb/oldalbum
    Install: https://github.com/steinarb/oldalbum#installation-with-test-database
    (this will install from maven central, it is possible that you need
    to build a local snapshot and install from that to trigger the
    issue...? (I haven't checked yet))
 2. https://github.com/steinarb/sampleapp
    Build and install: https://github.com/steinarb/sampleapp#installing-the-sample-application

The third feature they both pull in, is: https://github.com/steinarb/authservice
(provides shiro based authentication for webapps)

All of these three applications consist of OSGi bundles with
accompanying features created by karaf-maven-plugin, and with
handwritten features on top of those that install the application.

The handwritten features, are:
 1. https://github.com/steinarb/oldalbum/blob/master/karaf/src/main/filtered-resources/feature.xml#L16
 2. https://github.com/steinarb/sampleapp/blob/master/karaf/src/main/filtered-resources/feature.xml#L16

I'm off to the mountains now for a long weekend and I don't have time to
debug this closer now, but will do so when I get back down.


Re: Stack overflow in gogo shell on second "feature:install"

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

It looks related to the resolver: it seems you have an infinite loop
in requirements check for your feature.

Do you have something special in terms of req/cap in your feature (and
bundles in the feature) ?

Regards
JB

On Sat, May 14, 2022 at 8:56 AM Steinar Bang <sb...@dod.no> wrote:
>
> Platform: karaf 4.3.7, java 11, debian 11.3 "bullseye"
>
> When I run the first "feature:install" everything works fine.
>
> But when I try to "feature:install" for a different feature, felix gogo
> shell gets a stack overflow:
>  https://gist.github.com/steinarb/cfbb1fad2795a93c0eda55951b85ab44
>
> The stack trace is from karaf 4.3.6, but I have verified that it fails
> in the same way on karaf 4.3.7.
>
> My apps don't install on 4.4.0 yet, so I haven't tried that.
>
> Is this a known bug, or should I create a Jira for it?
>