You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Pierre De Rop (JIRA)" <ji...@apache.org> on 2009/11/27 21:22:20 UTC
[jira] Created: (FELIX-1903) SCR sometimes does not activate
components when configuration-policy is required
SCR sometimes does not activate components when configuration-policy is required
--------------------------------------------------------------------------------
Key: FELIX-1903
URL: https://issues.apache.org/jira/browse/FELIX-1903
Project: Felix
Issue Type: Bug
Components: Declarative Services (SCR)
Environment: linux fc10/jdk1.5
Reporter: Pierre De Rop
This issue is about the following post: http://www.mail-archive.com/dev@felix.apache.org/msg14019.html
Use case: I have a component which declare configuration-policy="require", meaning that it must not be activated before the corresponding PID is available.
But, even if SCR firsts detects that the pid is available, the component is then not activated, and ends up with the following log: "Missing required configuration, cannot activate".
Please take a look at the mentioned post, in the DEV mailing list, everything is explained, with some logs.
I also have attached to this post a sequence diagram which illustrates what is going on (well, as far as I understand):
1) In the sequence diagram, you will see that CM first provides the PID to SCR, by calling the ConfigurationComponentRegistry.configurationEvent() method.
But in this method, the getComponent(pid) returns null, because the component's bundle is probably not yet started, at the time we are called by CM.
2) Next, the component's bundle is started, and the Component Actor thread invokes ImmediatComponentManager.activateInternal() method, which invokes activate() in the Unsatisfied state,
3) but, then, the hasConfiguration() method is invoked and returns null, and we then get the log " Missing required configuration, cannot activate".
So, I have tried the attached patch which seems to resolve the issue: I just have modified the ImmediateComponentManager.hasConfiguration() in order to check if the PID is available from CM.
(Well, admittedly, the patch is probably dirty and I have added a static method in the Activator in order to get the bundle context, but it works ...)
please tell me what you think;
/pierre
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (FELIX-1903) SCR sometimes does not activate
components when configuration-policy is required
Posted by "Pierre De Rop (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pierre De Rop updated FELIX-1903:
---------------------------------
Attachment: FELIX-1903.patch
and here is the patch (it's probably dirty, but it's just for testing purpose).
> SCR sometimes does not activate components when configuration-policy is required
> --------------------------------------------------------------------------------
>
> Key: FELIX-1903
> URL: https://issues.apache.org/jira/browse/FELIX-1903
> Project: Felix
> Issue Type: Bug
> Components: Declarative Services (SCR)
> Environment: linux fc10/jdk1.5
> Reporter: Pierre De Rop
> Attachments: FELIX-1903.patch, sequence_diagram.pdf
>
>
> This issue is about the following post: http://www.mail-archive.com/dev@felix.apache.org/msg14019.html
> Use case: I have a component which declare configuration-policy="require", meaning that it must not be activated before the corresponding PID is available.
> But, even if SCR firsts detects that the pid is available, the component is then not activated, and ends up with the following log: "Missing required configuration, cannot activate".
> Please take a look at the mentioned post, in the DEV mailing list, everything is explained, with some logs.
> I also have attached to this post a sequence diagram which illustrates what is going on (well, as far as I understand):
> 1) In the sequence diagram, you will see that CM first provides the PID to SCR, by calling the ConfigurationComponentRegistry.configurationEvent() method.
> But in this method, the getComponent(pid) returns null, because the component's bundle is probably not yet started, at the time we are called by CM.
> 2) Next, the component's bundle is started, and the Component Actor thread invokes ImmediatComponentManager.activateInternal() method, which invokes activate() in the Unsatisfied state,
> 3) but, then, the hasConfiguration() method is invoked and returns null, and we then get the log " Missing required configuration, cannot activate".
> So, I have tried the attached patch which seems to resolve the issue: I just have modified the ImmediateComponentManager.hasConfiguration() in order to check if the PID is available from CM.
> (Well, admittedly, the patch is probably dirty and I have added a static method in the Activator in order to get the bundle context, but it works ...)
> please tell me what you think;
> /pierre
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (FELIX-1903) SCR sometimes does not activate
components when configuration-policy is required
Posted by "Pierre De Rop (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pierre De Rop updated FELIX-1903:
---------------------------------
Attachment: sequence_diagram.pdf
here is the sequence diagram.
> SCR sometimes does not activate components when configuration-policy is required
> --------------------------------------------------------------------------------
>
> Key: FELIX-1903
> URL: https://issues.apache.org/jira/browse/FELIX-1903
> Project: Felix
> Issue Type: Bug
> Components: Declarative Services (SCR)
> Environment: linux fc10/jdk1.5
> Reporter: Pierre De Rop
> Attachments: sequence_diagram.pdf
>
>
> This issue is about the following post: http://www.mail-archive.com/dev@felix.apache.org/msg14019.html
> Use case: I have a component which declare configuration-policy="require", meaning that it must not be activated before the corresponding PID is available.
> But, even if SCR firsts detects that the pid is available, the component is then not activated, and ends up with the following log: "Missing required configuration, cannot activate".
> Please take a look at the mentioned post, in the DEV mailing list, everything is explained, with some logs.
> I also have attached to this post a sequence diagram which illustrates what is going on (well, as far as I understand):
> 1) In the sequence diagram, you will see that CM first provides the PID to SCR, by calling the ConfigurationComponentRegistry.configurationEvent() method.
> But in this method, the getComponent(pid) returns null, because the component's bundle is probably not yet started, at the time we are called by CM.
> 2) Next, the component's bundle is started, and the Component Actor thread invokes ImmediatComponentManager.activateInternal() method, which invokes activate() in the Unsatisfied state,
> 3) but, then, the hasConfiguration() method is invoked and returns null, and we then get the log " Missing required configuration, cannot activate".
> So, I have tried the attached patch which seems to resolve the issue: I just have modified the ImmediateComponentManager.hasConfiguration() in order to check if the PID is available from CM.
> (Well, admittedly, the patch is probably dirty and I have added a static method in the Activator in order to get the bundle context, but it works ...)
> please tell me what you think;
> /pierre
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (FELIX-1903) SCR sometimes does not activate
components when configuration-policy is required
Posted by "Pierre De Rop (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783170#action_12783170 ]
Pierre De Rop commented on FELIX-1903:
--------------------------------------
I added logs in the createComponentHolder method, and it looks like the findSingletonConfiguration method returns null ...
So, may be there is an issue with my MapPersistenceManager ? I will check.
> SCR sometimes does not activate components when configuration-policy is required
> --------------------------------------------------------------------------------
>
> Key: FELIX-1903
> URL: https://issues.apache.org/jira/browse/FELIX-1903
> Project: Felix
> Issue Type: Bug
> Components: Declarative Services (SCR)
> Environment: linux fc10/jdk1.5
> Reporter: Pierre De Rop
> Attachments: FELIX-1903.patch, sequence_diagram.pdf
>
>
> This issue is about the following post: http://www.mail-archive.com/dev@felix.apache.org/msg14019.html
> Use case: I have a component which declare configuration-policy="require", meaning that it must not be activated before the corresponding PID is available.
> But, even if SCR firsts detects that the pid is available, the component is then not activated, and ends up with the following log: "Missing required configuration, cannot activate".
> Please take a look at the mentioned post, in the DEV mailing list, everything is explained, with some logs.
> I also have attached to this post a sequence diagram which illustrates what is going on (well, as far as I understand):
> 1) In the sequence diagram, you will see that CM first provides the PID to SCR, by calling the ConfigurationComponentRegistry.configurationEvent() method.
> But in this method, the getComponent(pid) returns null, because the component's bundle is probably not yet started, at the time we are called by CM.
> 2) Next, the component's bundle is started, and the Component Actor thread invokes ImmediatComponentManager.activateInternal() method, which invokes activate() in the Unsatisfied state,
> 3) but, then, the hasConfiguration() method is invoked and returns null, and we then get the log " Missing required configuration, cannot activate".
> So, I have tried the attached patch which seems to resolve the issue: I just have modified the ImmediateComponentManager.hasConfiguration() in order to check if the PID is available from CM.
> (Well, admittedly, the patch is probably dirty and I have added a static method in the Activator in order to get the bundle context, but it works ...)
> please tell me what you think;
> /pierre
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (FELIX-1903) SCR sometimes does not activate
components when configuration-policy is required
Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783169#action_12783169 ]
Felix Meschberger commented on FELIX-1903:
------------------------------------------
Hmm, this is strange since there are tests which ensure this exact situation. Looking at the code it also shows, that it should really work: In step (2) a ConfiguredComponentHolder is created and provided with the configuration, which in turn causes the configuration to be set and the component to be activated. See ConfigurationComponentRegistry.createComponentHolder.
I may of course be wrong, and I will verify this later.
> SCR sometimes does not activate components when configuration-policy is required
> --------------------------------------------------------------------------------
>
> Key: FELIX-1903
> URL: https://issues.apache.org/jira/browse/FELIX-1903
> Project: Felix
> Issue Type: Bug
> Components: Declarative Services (SCR)
> Environment: linux fc10/jdk1.5
> Reporter: Pierre De Rop
> Attachments: FELIX-1903.patch, sequence_diagram.pdf
>
>
> This issue is about the following post: http://www.mail-archive.com/dev@felix.apache.org/msg14019.html
> Use case: I have a component which declare configuration-policy="require", meaning that it must not be activated before the corresponding PID is available.
> But, even if SCR firsts detects that the pid is available, the component is then not activated, and ends up with the following log: "Missing required configuration, cannot activate".
> Please take a look at the mentioned post, in the DEV mailing list, everything is explained, with some logs.
> I also have attached to this post a sequence diagram which illustrates what is going on (well, as far as I understand):
> 1) In the sequence diagram, you will see that CM first provides the PID to SCR, by calling the ConfigurationComponentRegistry.configurationEvent() method.
> But in this method, the getComponent(pid) returns null, because the component's bundle is probably not yet started, at the time we are called by CM.
> 2) Next, the component's bundle is started, and the Component Actor thread invokes ImmediatComponentManager.activateInternal() method, which invokes activate() in the Unsatisfied state,
> 3) but, then, the hasConfiguration() method is invoked and returns null, and we then get the log " Missing required configuration, cannot activate".
> So, I have tried the attached patch which seems to resolve the issue: I just have modified the ImmediateComponentManager.hasConfiguration() in order to check if the PID is available from CM.
> (Well, admittedly, the patch is probably dirty and I have added a static method in the Activator in order to get the bundle context, but it works ...)
> please tell me what you think;
> /pierre
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (FELIX-1903) SCR sometimes does not activate
components when configuration-policy is required
Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783454#action_12783454 ]
Felix Meschberger commented on FELIX-1903:
------------------------------------------
> So, sorry for having created this issue uselessly.
Maybe we stumbled upon missing documentation of the API here ... I created FELIX-1907 for this
> SCR sometimes does not activate components when configuration-policy is required
> --------------------------------------------------------------------------------
>
> Key: FELIX-1903
> URL: https://issues.apache.org/jira/browse/FELIX-1903
> Project: Felix
> Issue Type: Bug
> Components: Declarative Services (SCR)
> Environment: linux fc10/jdk1.5
> Reporter: Pierre De Rop
> Attachments: FELIX-1903.patch, sequence_diagram.pdf
>
>
> This issue is about the following post: http://www.mail-archive.com/dev@felix.apache.org/msg14019.html
> Use case: I have a component which declare configuration-policy="require", meaning that it must not be activated before the corresponding PID is available.
> But, even if SCR firsts detects that the pid is available, the component is then not activated, and ends up with the following log: "Missing required configuration, cannot activate".
> Please take a look at the mentioned post, in the DEV mailing list, everything is explained, with some logs.
> I also have attached to this post a sequence diagram which illustrates what is going on (well, as far as I understand):
> 1) In the sequence diagram, you will see that CM first provides the PID to SCR, by calling the ConfigurationComponentRegistry.configurationEvent() method.
> But in this method, the getComponent(pid) returns null, because the component's bundle is probably not yet started, at the time we are called by CM.
> 2) Next, the component's bundle is started, and the Component Actor thread invokes ImmediatComponentManager.activateInternal() method, which invokes activate() in the Unsatisfied state,
> 3) but, then, the hasConfiguration() method is invoked and returns null, and we then get the log " Missing required configuration, cannot activate".
> So, I have tried the attached patch which seems to resolve the issue: I just have modified the ImmediateComponentManager.hasConfiguration() in order to check if the PID is available from CM.
> (Well, admittedly, the patch is probably dirty and I have added a static method in the Activator in order to get the bundle context, but it works ...)
> please tell me what you think;
> /pierre
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (FELIX-1903) SCR sometimes does not activate
components when configuration-policy is required
Posted by "Pierre De Rop (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pierre De Rop closed FELIX-1903.
--------------------------------
Resolution: Fixed
All right,
The problem comes from my custom MapPersistenceManager, which was not cloning dictionaries from getters/setters methods.
Indeed, it seems that when ConfigAdmin invokes from PersistentManager some methods like PersistentManager.getDictionaries(), then CM may modify the returned dictionaries.
For instance, in ConfigurationManager.listConfigurations() method, when a Dictionary is retrieved by calling PersistentManager.getDictionaries(), then line 544, the constructor of the ConfigurationImpl class is removing the service.pid from the returned dictionary.
To work around, I just managed to clone getters/setters from my PersistentManager and every problems have disappeared.
So, sorry for having created this issue uselessly.
> SCR sometimes does not activate components when configuration-policy is required
> --------------------------------------------------------------------------------
>
> Key: FELIX-1903
> URL: https://issues.apache.org/jira/browse/FELIX-1903
> Project: Felix
> Issue Type: Bug
> Components: Declarative Services (SCR)
> Environment: linux fc10/jdk1.5
> Reporter: Pierre De Rop
> Attachments: FELIX-1903.patch, sequence_diagram.pdf
>
>
> This issue is about the following post: http://www.mail-archive.com/dev@felix.apache.org/msg14019.html
> Use case: I have a component which declare configuration-policy="require", meaning that it must not be activated before the corresponding PID is available.
> But, even if SCR firsts detects that the pid is available, the component is then not activated, and ends up with the following log: "Missing required configuration, cannot activate".
> Please take a look at the mentioned post, in the DEV mailing list, everything is explained, with some logs.
> I also have attached to this post a sequence diagram which illustrates what is going on (well, as far as I understand):
> 1) In the sequence diagram, you will see that CM first provides the PID to SCR, by calling the ConfigurationComponentRegistry.configurationEvent() method.
> But in this method, the getComponent(pid) returns null, because the component's bundle is probably not yet started, at the time we are called by CM.
> 2) Next, the component's bundle is started, and the Component Actor thread invokes ImmediatComponentManager.activateInternal() method, which invokes activate() in the Unsatisfied state,
> 3) but, then, the hasConfiguration() method is invoked and returns null, and we then get the log " Missing required configuration, cannot activate".
> So, I have tried the attached patch which seems to resolve the issue: I just have modified the ImmediateComponentManager.hasConfiguration() in order to check if the PID is available from CM.
> (Well, admittedly, the patch is probably dirty and I have added a static method in the Activator in order to get the bundle context, but it works ...)
> please tell me what you think;
> /pierre
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.