You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Kevin Schmidt <kt...@gmail.com> on 2021/01/11 00:13:05 UTC

Bundle transitions to and stays Waiting when service it depends on stops/starts

Hi,

All of the below is done using Karaf 4.2.9.

I have a bundle exposing a REST endpoint that is deployed using Blueprint
that uses a service that is deployed using Declarative Services.  When both
bundles are active, all is well.

If I stop the service bundle (DS), it shows as Resolved but the REST bundle
(BP) shows as Active still, all as expected.

When I make a request to the endpoint, it blocks with the BP proxy doing
its damping as expected.  Also, the REST bundle (BP) state changes to
Waiting at this point.  Is this correct and expected?

I then start the service bundle (DS) and it goes back to Active and the
execution completes and the REST endpoint returns.  However, the REST
bundle remains in the Waiting state.  This isn't correct is it?

Note that requests to the REST endpoint do work in this state, but it is a
bit disconcerting to have the REST endpoint bundle not Active.

Also, FWIW, I just tried the above with 4.3.0 as well and it behaves the
same.

Is this a bug?  Should I open a Jira?

Thanks,

Kevin

Re: Bundle transitions to and stays Waiting when service it depends on stops/starts

Posted by Kevin Schmidt <kt...@gmail.com>.
JB,

Yes, when the service is started, the client bundle using the service
remains in the waiting state.  But the REST endpoint the client bundle is
providing continues to work.

And yes, restarting the client bundle causes it to go back to active.

And yes, I'm aware of the proxy and grace period.  I actually start both
the client and server bundles and have both active before doing the steps I
outlined.  So the grace period should no longer be in play should it?  Note
that the client bundle remains in the waiting state forever, it doesn't
seem to timeout like it would on startup due to the grace period so this
seems different.

Also, I made versions of the service that use Blueprint and just an
Activator, instead of using DS, and itt behaves the same.

When the client is in the waiting state, diag returns this:

Status: Waiting
Blueprint
1/11/21 5:53 AM
Missing dependencies:
(objectClass=<service interface name>)
Declarative Services

However, doing a service:list on the service interface name shows there is
a service registered:

 service.bundleid = 155
 service.id = 174
 service.scope = singleton
Provided by :
 <service bundle name/ID>
Used by:
 <client bundle name/ID>

So it is unclear why the client remains in the waiting state.

Yes, in this case I'm directly using stop/start on the bundle and these
bundles are not part of a feature.  It is unclear to me though why that
should make a difference?  Since Blueprint is using a proxy, it seems
normal that one should be able to stop/start the bundle providing the
proxied service and as long as that restart happens when no requests in
in-flight (which works fine), or if a request is in-flight the restart
happens before the Blueprint configured timeout occurs (this is the
scenario that doesn't work), the client should be unaffected and remain or
get back to the active state.  Being stuck in the waiting state is
incorrect and misleading since the bundle is operating correctly, IMHO.

What specifically would have to be a feature to get the resolver involved
and have it work?  Would I need a feature that includes the client, service
interface, and service implementation bundles?  Or something different?  If
a feature is required, I'm just surprised as I didn't pick up on that in
any docs or using Karaf over a number of years, but I guess one can learn
something new every day!

I'm happy to provide sample source code for my scenario if needed.

Thanks,

Kevin

On Sun, Jan 10, 2021 at 10:28 PM Jean-Baptiste Onofre <jb...@nanthrax.net>
wrote:

> Hi Kevin,
>
> To be sure I understand your use case: when you start the bundle providing
> the service, the bundles using it stay in waiting state ?
>
> If you restart the "client" bundles, does it work ?
>
> As reminder, blueprint uses a proxy to the service, and evaluated at start
> time (grace period). So, I’m pretty sure it works if you restart the
> blueprint bundle, correct ?
>
> I’m not sure it could consider as a bug. I guess you are using directly
> bundle (stop/start), not feature, so the resolver is not involved and can’t
> automatically restart/refresh the blueprint bundle (you have to do it
> manually). If you add a requirement and use feature, it should work.
>
> Regards
> JB
>
> > Le 11 janv. 2021 à 01:13, Kevin Schmidt <kt...@gmail.com> a écrit :
> >
> > Hi,
> >
> > All of the below is done using Karaf 4.2.9.
> >
> > I have a bundle exposing a REST endpoint that is deployed using
> Blueprint that uses a service that is deployed using Declarative Services.
> When both bundles are active, all is well.
> >
> > If I stop the service bundle (DS), it shows as Resolved but the REST
> bundle (BP) shows as Active still, all as expected.
> >
> > When I make a request to the endpoint, it blocks with the BP proxy doing
> its damping as expected.  Also, the REST bundle (BP) state changes to
> Waiting at this point.  Is this correct and expected?
> >
> > I then start the service bundle (DS) and it goes back to Active and the
> execution completes and the REST endpoint returns.  However, the REST
> bundle remains in the Waiting state.  This isn't correct is it?
> >
> > Note that requests to the REST endpoint do work in this state, but it is
> a bit disconcerting to have the REST endpoint bundle not Active.
> >
> > Also, FWIW, I just tried the above with 4.3.0 as well and it behaves the
> same.
> >
> > Is this a bug?  Should I open a Jira?
> >
> > Thanks,
> >
> > Kevin
>
>

Re: Bundle transitions to and stays Waiting when service it depends on stops/starts

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi Kevin,

To be sure I understand your use case: when you start the bundle providing the service, the bundles using it stay in waiting state ?

If you restart the "client" bundles, does it work ?

As reminder, blueprint uses a proxy to the service, and evaluated at start time (grace period). So, I’m pretty sure it works if you restart the blueprint bundle, correct ?

I’m not sure it could consider as a bug. I guess you are using directly bundle (stop/start), not feature, so the resolver is not involved and can’t automatically restart/refresh the blueprint bundle (you have to do it manually). If you add a requirement and use feature, it should work.

Regards
JB

> Le 11 janv. 2021 à 01:13, Kevin Schmidt <kt...@gmail.com> a écrit :
> 
> Hi,
> 
> All of the below is done using Karaf 4.2.9.
> 
> I have a bundle exposing a REST endpoint that is deployed using Blueprint that uses a service that is deployed using Declarative Services.  When both bundles are active, all is well.
> 
> If I stop the service bundle (DS), it shows as Resolved but the REST bundle (BP) shows as Active still, all as expected.
> 
> When I make a request to the endpoint, it blocks with the BP proxy doing its damping as expected.  Also, the REST bundle (BP) state changes to Waiting at this point.  Is this correct and expected?
> 
> I then start the service bundle (DS) and it goes back to Active and the execution completes and the REST endpoint returns.  However, the REST bundle remains in the Waiting state.  This isn't correct is it?
> 
> Note that requests to the REST endpoint do work in this state, but it is a bit disconcerting to have the REST endpoint bundle not Active.
> 
> Also, FWIW, I just tried the above with 4.3.0 as well and it behaves the same.
> 
> Is this a bug?  Should I open a Jira?
> 
> Thanks,
> 
> Kevin