You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Marc Durand <ma...@gmail.com> on 2016/09/13 15:01:05 UTC

Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times

I've been having a problem that I can't seem to resolve even after days of
troubleshooting.  When Karaf starts up, some of my components are activated
(methods annotated with @Activate are called), then de-activated (methods
annotated with @Deactivate are called) and activated again - sometimes
multiple times.  I see this in the log:

2016-09-13 10:46:07,624 INFO  (CM Configuration Updater (ManagedService
Update: pid=[org.apache.aries.transaction]):::::::)
[DatabaseHelperFactoryImpl] activate: called
2016-09-13 10:46:07,773 INFO  (CM Configuration Updater (ManagedService
Update: pid=[org.apache.aries.transaction]):::::::)
[DatabaseHelperFactoryImpl] deactivate: called
2016-09-13 10:46:07,783 INFO  (CM Configuration Updater (ManagedService
Update: pid=[org.apache.aries.transaction]):::::::)
[DatabaseHelperFactoryImpl] activate: called
2016-09-13 10:46:07,901 INFO  (CM Configuration Updater (ManagedService
Update: pid=[org.apache.aries.transaction]):::::::)
[DatabaseHelperFactoryImpl] deactivate: called
2016-09-13 10:46:07,911 INFO  (CM Configuration Updater (ManagedService
Update: pid=[org.apache.aries.transaction]):::::::)
[DatabaseHelperFactoryImpl] activate: called

Seeing "CM Configuration Updater (ManagedService Update:
pid=[org.apache.aries.transaction])" in the log makes me think that Aries
thinks its configuration has changed when in fact it has not.  Is this a
bug?  What can I do to troubleshoot/resolve this issue?

Thanks in advance,
Marc



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-x-startup-Aries-causing-components-to-deactivate-and-re-activate-multiple-times-tp4047996.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times

Posted by Marc Durand <ma...@gmail.com>.
Thank you Guillaume!

What is the process to get Aries transaction-manager 1.3.1 into the next
release of Karaf, hopefully 4.0.8?

Marc

On Tue, Sep 27, 2016 at 10:07 AM, Guillaume Nodet <gn...@apache.org> wrote:

> Fixed
>
> 2016-09-27 15:01 GMT+02:00 Marc Durand <ma...@gmail.com>:
>
>> Thank you Guillaume.  Here is the JIRA issue:
>> https://issues.apache.org/jira/browse/ARIES-1621
>>
>> Marc
>>
>>
>>
>> --
>> View this message in context: http://karaf.922171.n3.nabble.
>> com/Karaf-4-x-startup-Aries-causing-components-to-deactivate
>> -and-re-activate-multiple-times-tp4047996p4048177.html
>> Sent from the Karaf - User mailing list archive at Nabble.com.
>>
>
>
>
> --
> ------------------------
> Guillaume Nodet
> ------------------------
> Red Hat, Open Source Integration
>
> Email: gnodet@redhat.com
> Web: http://fusesource.com
> Blog: http://gnodet.blogspot.com/
>
>

Re: Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times

Posted by Guillaume Nodet <gn...@apache.org>.
Fixed

2016-09-27 15:01 GMT+02:00 Marc Durand <ma...@gmail.com>:

> Thank you Guillaume.  Here is the JIRA issue:
> https://issues.apache.org/jira/browse/ARIES-1621
>
> Marc
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.
> com/Karaf-4-x-startup-Aries-causing-components-to-
> deactivate-and-re-activate-multiple-times-tp4047996p4048177.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: gnodet@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Re: Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times

Posted by Marc Durand <ma...@gmail.com>.
Thank you Guillaume.  Here is the JIRA issue:
https://issues.apache.org/jira/browse/ARIES-1621

Marc



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-x-startup-Aries-causing-components-to-deactivate-and-re-activate-multiple-times-tp4047996p4048177.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times

Posted by Guillaume Nodet <gn...@apache.org>.
Could you raise a JIRA issue please ?
I'll see how the activator can be improved to avoid unnecessary refreshes
if that's possible.


2016-09-26 22:48 GMT+02:00 Marc Durand <ma...@gmail.com>:

> Just realized that ​org.osgi.service.cm only contains the
> ConfigurationAdmin
> interface and not the service implementation - so my simple suggestion
> would
> not work...
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.
> com/Karaf-4-x-startup-Aries-causing-components-to-
> deactivate-and-re-activate-multiple-times-tp4047996p4048175.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: gnodet@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Re: Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times

Posted by Marc Durand <ma...@gmail.com>.
Just realized that ​org.osgi.service.cm only contains the ConfigurationAdmin
interface and not the service implementation - so my simple suggestion would
not work...



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-x-startup-Aries-causing-components-to-deactivate-and-re-activate-multiple-times-tp4047996p4048175.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times

Posted by Marc Durand <ma...@gmail.com>.
Can the fix for this problem be as easy as changing the "start" method in
https://github.com/apache/aries/blob/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/Activator.java
by removing these 2 lines?

        // Make sure TransactionManager comes up even if no config admin is
installed
        updated(null);

My reasoning is that config admin is required for this bundle to have its
dependencies met as per the module's pom.xml which contains this:

        <aries.osgi.import>
            org.springframework.*;resolution:=optional;version="[2.5,5)",
            !org.apache.geronimo.transaction*,
            javax.resource.spi;resolution:=optional,
            org.osgi.framework,
            org.osgi.service.cm,            <-- 
            *
        </aries.osgi.import>

By removing those 2 lines from the start method, the transaction manager
won't be published until after the Activator's "updated" method is called.  

Am I missing something?

Thanks,
Marc








--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-x-startup-Aries-causing-components-to-deactivate-and-re-activate-multiple-times-tp4047996p4048174.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times

Posted by Marc Durand <ma...@gmail.com>.
Thanks David - I don't see any evidence of bundle location changes.  It
looks to me like the Aries TransactionManagerService is published to the
OSGi registry by its own BundleActivator, then its configuration is
provided so the activator unregisters itself (causing my components to all
shut down because I have a @Reference to the
javax.transaction.TransactionManager).  The Aries source code seems to show
that as well:

https://github.com/apache/aries/blob/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/Activator.java

I see that the code has not changed in over a year so maybe I'm on the
wrong path here.  But based on breakpoints set up in my IDE, this looks
like the root cause.
1) first, "start" is called which end up publishing
the TransactionManagerService
2) after a short while, "updated" is called by UpdateThread in Felix CM,
which causes TransactionManagerService to be unregistered and registered
again

I don't recall running into this problem in Karaf 3.x.  We recently updated
to Karaf 4.x and started seeing this problem.  Any ideas?

Thanks,
Marc





On Tue, Sep 13, 2016 at 11:48 AM, David Jencks <da...@gmail.com>
wrote:

> I forgot the possible solutions if this is the problem :-)
>
> The best would be if you can figure out how to set the bundleLocation to
> “?” and this works.  It should work fine with DS and felix config admin. I
> don’t know if blueprint would work with this: my impression is that it
> relies on ManagedService[Factory] so since config admin works it should too
> (no guarantees).
>
> Otherwise you might need to have several copies of the configuration or
> move all the code consuming the configuration into one bundle.
>
> david jencks
>
> > On Sep 13, 2016, at 8:33 AM, David Jencks <da...@gmail.com>
> wrote:
> >
> > I wonder if something is setting/changing/unsetting the bundle location
> on the configuration?  Based on reports of other cycling behavior, I think
> this might happen if there’s a blueprint bundle also using the pid.  If the
> bundle location is for instance set to another bundle and then unset
> repeatedly then DS will see the configuration as alternatingly
> visible/invisible to your DS component and activate/deactive it.
> >
> > I’m not very familiar with karaf but I would try to turn up the config
> admin logging all the way and look for evidence about what is happening
> with the bundle location.
> >
> > hope this helps
> >
> > david jencks
> >
> >> On Sep 13, 2016, at 8:01 AM, Marc Durand <ma...@gmail.com> wrote:
> >>
> >> I've been having a problem that I can't seem to resolve even after days
> of
> >> troubleshooting.  When Karaf starts up, some of my components are
> activated
> >> (methods annotated with @Activate are called), then de-activated
> (methods
> >> annotated with @Deactivate are called) and activated again - sometimes
> >> multiple times.  I see this in the log:
> >>
> >> 2016-09-13 10:46:07,624 INFO  (CM Configuration Updater (ManagedService
> >> Update: pid=[org.apache.aries.transaction]):::::::)
> >> [DatabaseHelperFactoryImpl] activate: called
> >> 2016-09-13 10:46:07,773 INFO  (CM Configuration Updater (ManagedService
> >> Update: pid=[org.apache.aries.transaction]):::::::)
> >> [DatabaseHelperFactoryImpl] deactivate: called
> >> 2016-09-13 10:46:07,783 INFO  (CM Configuration Updater (ManagedService
> >> Update: pid=[org.apache.aries.transaction]):::::::)
> >> [DatabaseHelperFactoryImpl] activate: called
> >> 2016-09-13 10:46:07,901 INFO  (CM Configuration Updater (ManagedService
> >> Update: pid=[org.apache.aries.transaction]):::::::)
> >> [DatabaseHelperFactoryImpl] deactivate: called
> >> 2016-09-13 10:46:07,911 INFO  (CM Configuration Updater (ManagedService
> >> Update: pid=[org.apache.aries.transaction]):::::::)
> >> [DatabaseHelperFactoryImpl] activate: called
> >>
> >> Seeing "CM Configuration Updater (ManagedService Update:
> >> pid=[org.apache.aries.transaction])" in the log makes me think that
> Aries
> >> thinks its configuration has changed when in fact it has not.  Is this a
> >> bug?  What can I do to troubleshoot/resolve this issue?
> >>
> >> Thanks in advance,
> >> Marc
> >>
> >>
> >>
> >> --
> >> View this message in context: http://karaf.922171.n3.nabble.
> com/Karaf-4-x-startup-Aries-causing-components-to-
> deactivate-and-re-activate-multiple-times-tp4047996.html
> >> Sent from the Karaf - User mailing list archive at Nabble.com.
> >
>
>

Re: Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times

Posted by David Jencks <da...@gmail.com>.
I forgot the possible solutions if this is the problem :-)

The best would be if you can figure out how to set the bundleLocation to “?” and this works.  It should work fine with DS and felix config admin. I don’t know if blueprint would work with this: my impression is that it relies on ManagedService[Factory] so since config admin works it should too (no guarantees).  

Otherwise you might need to have several copies of the configuration or move all the code consuming the configuration into one bundle.

david jencks

> On Sep 13, 2016, at 8:33 AM, David Jencks <da...@gmail.com> wrote:
> 
> I wonder if something is setting/changing/unsetting the bundle location on the configuration?  Based on reports of other cycling behavior, I think this might happen if there’s a blueprint bundle also using the pid.  If the bundle location is for instance set to another bundle and then unset repeatedly then DS will see the configuration as alternatingly visible/invisible to your DS component and activate/deactive it.
> 
> I’m not very familiar with karaf but I would try to turn up the config admin logging all the way and look for evidence about what is happening with the bundle location.
> 
> hope this helps
> 
> david jencks
> 
>> On Sep 13, 2016, at 8:01 AM, Marc Durand <ma...@gmail.com> wrote:
>> 
>> I've been having a problem that I can't seem to resolve even after days of
>> troubleshooting.  When Karaf starts up, some of my components are activated
>> (methods annotated with @Activate are called), then de-activated (methods
>> annotated with @Deactivate are called) and activated again - sometimes
>> multiple times.  I see this in the log:
>> 
>> 2016-09-13 10:46:07,624 INFO  (CM Configuration Updater (ManagedService
>> Update: pid=[org.apache.aries.transaction]):::::::)
>> [DatabaseHelperFactoryImpl] activate: called
>> 2016-09-13 10:46:07,773 INFO  (CM Configuration Updater (ManagedService
>> Update: pid=[org.apache.aries.transaction]):::::::)
>> [DatabaseHelperFactoryImpl] deactivate: called
>> 2016-09-13 10:46:07,783 INFO  (CM Configuration Updater (ManagedService
>> Update: pid=[org.apache.aries.transaction]):::::::)
>> [DatabaseHelperFactoryImpl] activate: called
>> 2016-09-13 10:46:07,901 INFO  (CM Configuration Updater (ManagedService
>> Update: pid=[org.apache.aries.transaction]):::::::)
>> [DatabaseHelperFactoryImpl] deactivate: called
>> 2016-09-13 10:46:07,911 INFO  (CM Configuration Updater (ManagedService
>> Update: pid=[org.apache.aries.transaction]):::::::)
>> [DatabaseHelperFactoryImpl] activate: called
>> 
>> Seeing "CM Configuration Updater (ManagedService Update:
>> pid=[org.apache.aries.transaction])" in the log makes me think that Aries
>> thinks its configuration has changed when in fact it has not.  Is this a
>> bug?  What can I do to troubleshoot/resolve this issue?
>> 
>> Thanks in advance,
>> Marc
>> 
>> 
>> 
>> --
>> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-x-startup-Aries-causing-components-to-deactivate-and-re-activate-multiple-times-tp4047996.html
>> Sent from the Karaf - User mailing list archive at Nabble.com.
> 


Re: Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times

Posted by David Jencks <da...@gmail.com>.
I wonder if something is setting/changing/unsetting the bundle location on the configuration?  Based on reports of other cycling behavior, I think this might happen if there’s a blueprint bundle also using the pid.  If the bundle location is for instance set to another bundle and then unset repeatedly then DS will see the configuration as alternatingly visible/invisible to your DS component and activate/deactive it.

I’m not very familiar with karaf but I would try to turn up the config admin logging all the way and look for evidence about what is happening with the bundle location.

hope this helps

david jencks

> On Sep 13, 2016, at 8:01 AM, Marc Durand <ma...@gmail.com> wrote:
> 
> I've been having a problem that I can't seem to resolve even after days of
> troubleshooting.  When Karaf starts up, some of my components are activated
> (methods annotated with @Activate are called), then de-activated (methods
> annotated with @Deactivate are called) and activated again - sometimes
> multiple times.  I see this in the log:
> 
> 2016-09-13 10:46:07,624 INFO  (CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.transaction]):::::::)
> [DatabaseHelperFactoryImpl] activate: called
> 2016-09-13 10:46:07,773 INFO  (CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.transaction]):::::::)
> [DatabaseHelperFactoryImpl] deactivate: called
> 2016-09-13 10:46:07,783 INFO  (CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.transaction]):::::::)
> [DatabaseHelperFactoryImpl] activate: called
> 2016-09-13 10:46:07,901 INFO  (CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.transaction]):::::::)
> [DatabaseHelperFactoryImpl] deactivate: called
> 2016-09-13 10:46:07,911 INFO  (CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.transaction]):::::::)
> [DatabaseHelperFactoryImpl] activate: called
> 
> Seeing "CM Configuration Updater (ManagedService Update:
> pid=[org.apache.aries.transaction])" in the log makes me think that Aries
> thinks its configuration has changed when in fact it has not.  Is this a
> bug?  What can I do to troubleshoot/resolve this issue?
> 
> Thanks in advance,
> Marc
> 
> 
> 
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-x-startup-Aries-causing-components-to-deactivate-and-re-activate-multiple-times-tp4047996.html
> Sent from the Karaf - User mailing list archive at Nabble.com.


Re: Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times

Posted by Marc Durand <ma...@gmail.com>.
Thanks for that information Jens.  I am using Karaf 4.0.6 which appears to
have version 2.0.6 of SCR:

 84 | Active   |  30 | 2.0.6                 | Apache Felix Declarative
Services

There must be another problem...

Marc

On Tue, Sep 13, 2016 at 11:17 AM, Jens Offenbach <wo...@gmx.de> wrote:

> Hi Marc,
> please check the SCR version you are using... I was facing the same kind
> of issue in my Eclipse PDE environment. The problem was caused by SCR 2.0.2
> and got fixed in SCR >= 2.0.4. This fix solved my problem:
> https://issues.apache.org/jira/browse/FELIX-5194
>
> Regards,
> Jens
>
>
> Gesendet: Dienstag, 13. September 2016 um 17:01 Uhr
> Von: "Marc Durand" <ma...@gmail.com>
> An: user@karaf.apache.org
> Betreff: Karaf 4.x startup - Aries causing components to deactivate and
> re-activate multiple times
> I've been having a problem that I can't seem to resolve even after days of
> troubleshooting. When Karaf starts up, some of my components are activated
> (methods annotated with @Activate are called), then de-activated (methods
> annotated with @Deactivate are called) and activated again - sometimes
> multiple times. I see this in the log:
>
> 2016-09-13 10:46:07,624 INFO (CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.transaction]):::::::)
> [DatabaseHelperFactoryImpl] activate: called
> 2016-09-13 10:46:07,773 INFO (CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.transaction]):::::::)
> [DatabaseHelperFactoryImpl] deactivate: called
> 2016-09-13 10:46:07,783 INFO (CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.transaction]):::::::)
> [DatabaseHelperFactoryImpl] activate: called
> 2016-09-13 10:46:07,901 INFO (CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.transaction]):::::::)
> [DatabaseHelperFactoryImpl] deactivate: called
> 2016-09-13 10:46:07,911 INFO (CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.transaction]):::::::)
> [DatabaseHelperFactoryImpl] activate: called
>
> Seeing "CM Configuration Updater (ManagedService Update:
> pid=[org.apache.aries.transaction])" in the log makes me think that Aries
> thinks its configuration has changed when in fact it has not. Is this a
> bug? What can I do to troubleshoot/resolve this issue?
>
> Thanks in advance,
> Marc
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.
> com/Karaf-4-x-startup-Aries-causing-components-to-
> deactivate-and-re-activate-multiple-times-tp4047996.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Aw: Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times

Posted by Jens Offenbach <wo...@gmx.de>.
Hi Marc,
please check the SCR version you are using... I was facing the same kind of issue in my Eclipse PDE environment. The problem was caused by SCR 2.0.2 and got fixed in SCR >= 2.0.4. This fix solved my problem: https://issues.apache.org/jira/browse/FELIX-5194

Regards,
Jens
 

Gesendet: Dienstag, 13. September 2016 um 17:01 Uhr
Von: "Marc Durand" <ma...@gmail.com>
An: user@karaf.apache.org
Betreff: Karaf 4.x startup - Aries causing components to deactivate and re-activate multiple times
I've been having a problem that I can't seem to resolve even after days of
troubleshooting. When Karaf starts up, some of my components are activated
(methods annotated with @Activate are called), then de-activated (methods
annotated with @Deactivate are called) and activated again - sometimes
multiple times. I see this in the log:

2016-09-13 10:46:07,624 INFO (CM Configuration Updater (ManagedService
Update: pid=[org.apache.aries.transaction]):::::::)
[DatabaseHelperFactoryImpl] activate: called
2016-09-13 10:46:07,773 INFO (CM Configuration Updater (ManagedService
Update: pid=[org.apache.aries.transaction]):::::::)
[DatabaseHelperFactoryImpl] deactivate: called
2016-09-13 10:46:07,783 INFO (CM Configuration Updater (ManagedService
Update: pid=[org.apache.aries.transaction]):::::::)
[DatabaseHelperFactoryImpl] activate: called
2016-09-13 10:46:07,901 INFO (CM Configuration Updater (ManagedService
Update: pid=[org.apache.aries.transaction]):::::::)
[DatabaseHelperFactoryImpl] deactivate: called
2016-09-13 10:46:07,911 INFO (CM Configuration Updater (ManagedService
Update: pid=[org.apache.aries.transaction]):::::::)
[DatabaseHelperFactoryImpl] activate: called

Seeing "CM Configuration Updater (ManagedService Update:
pid=[org.apache.aries.transaction])" in the log makes me think that Aries
thinks its configuration has changed when in fact it has not. Is this a
bug? What can I do to troubleshoot/resolve this issue?

Thanks in advance,
Marc



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-x-startup-Aries-causing-components-to-deactivate-and-re-activate-multiple-times-tp4047996.html
Sent from the Karaf - User mailing list archive at Nabble.com.