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/04/23 10:31:47 UTC

[jira] Created: (FELIX-1053) SCR: Bound Service Replacement regression ?

SCR: Bound Service Replacement regression ?
-------------------------------------------

                 Key: FELIX-1053
                 URL: https://issues.apache.org/jira/browse/FELIX-1053
             Project: Felix
          Issue Type: Bug
          Components: Declarative Services (SCR)
         Environment: linux/java version "1.5.0_18"
            Reporter: Pierre De Rop


With the SCR trunk version, it looks like the "Bound Service Replacement" feature does not work anymore, and
I think it might be a regression, because it works fine with the SCR version 1.0.6
I have attached to this issue a sample code which reproduces the problem. In the sample, there are two bundles:

client-1.0.jar
=========

- contains a Client which has a dynamic/required/unary dependency over the "service.Service" interface, with the service property "foo=bar"

- Here is the serviceComponent.xml description:

   <?xml version="1.0" encoding="UTF-8"?>
   <component name="Client">
     <implementation class="client.Client"/>
     <reference name="SERVICE" 
       interface="service.Service"
       policy="dynamic"
       cardinality="1..1"
       target="(foo=bar)"
       bind="bind"/>
   </component>

service-1.0.jar
==========

- contains the Service interface: "service.Service"

- contains the Service implementation: "service.impl.ServiceImpl"

- contains a ComponentFactory ("service.impl.ServiceFactory") which is in charge of creating component instances of type "ServiceImpl".
Here is the serviceComponent.xml:

   <?xml version="1.0" encoding="UTF-8"?>
   <component name="Service" factory="ServiceFactory">
     <service>
       <provide interface="service.Service"/>
     </service>
     <implementation class="service.impl.ServiceImpl"/>
   </component>
   
   <component name="ServiceFactory">
     <implementation class="service.impl.ServiceFactory"/>
     <reference name="COMPONENT_FACTORY" 
       interface="org.osgi.service.component.ComponentFactory"
       target="(component.name=Service)"
       bind="bind"/>
   </component>

The ComponentFactory does the following, in a separate thread:

   while (true) {
     1- create a ServiceImpl component instance with property "foo=bar2"
     2- dispose eventual previously created ServiceImpl with property "foo=bar2"
     3- create a ServiceImpl component instance with property "foo=bar"
     4- dispose eventual previously created ServiceImpl with property "foo=bar"
     5- Sleep 500 seconds
   }

The issue arises in the step 4: Indeed, when the old ServiceImpl (with property "foo=bar") is disposed, the Client is deactivated, but
I think it should not, mainly because SCR should actually replace the old bound ServiceImpl with the new one that was created in step 3.
When you will start the test, you will see the following logs:

   ServiceFactory: creating Service instance with property "foo=bar2" ...
   ServiceFactory: creating Service instance with property "foo=bar" ...
   ServiceFactory: Sleeping 500 ms ...
   Client: bound Service : service.impl.ServiceImpl@1bca5f1
   Client: activated with properties={component.name=Client; component.id=4; SERVICE.target=(foo=bar); }

   ServiceFactory: creating Service instance with property "foo=bar2" ...
   ServiceFactory: disposing old Service instance with property "foo=bar2" ...
   ServiceFactory: creating Service instance with property "foo=bar" ...
   ServiceFactory: disposing old Service instance with property "foo=bar" ...
   Client: DEACTIVATED !

Felix, could you please take a look at the sample code and check if my analysis is correct ?


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (FELIX-1053) SCR: Bound Service Replacement regression ?

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved FELIX-1053.
--------------------------------------

    Resolution: Fixed

The committed fix is reported to work by Pierre De Rop (Thanks). So I resolve this issue.

If you agree, Pierre, would you mind closing this issue ? Thanks.

> SCR: Bound Service Replacement regression ?
> -------------------------------------------
>
>                 Key: FELIX-1053
>                 URL: https://issues.apache.org/jira/browse/FELIX-1053
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>         Environment: linux/java version "1.5.0_18"
>            Reporter: Pierre De Rop
>            Assignee: Felix Meschberger
>             Fix For: scr-1.0.8
>
>         Attachments: bound-replacement.tgz
>
>
> With the SCR trunk version, it looks like the "Bound Service Replacement" feature does not work anymore, and
> I think it might be a regression, because it works fine with the SCR version 1.0.6
> I have attached to this issue a sample code which reproduces the problem. In the sample, there are two bundles:
> client-1.0.jar
> =========
> - contains a Client which has a dynamic/required/unary dependency over the "service.Service" interface, with the service property "foo=bar"
> - Here is the serviceComponent.xml description:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Client">
>      <implementation class="client.Client"/>
>      <reference name="SERVICE" 
>        interface="service.Service"
>        policy="dynamic"
>        cardinality="1..1"
>        target="(foo=bar)"
>        bind="bind"/>
>    </component>
> service-1.0.jar
> ==========
> - contains the Service interface: "service.Service"
> - contains the Service implementation: "service.impl.ServiceImpl"
> - contains a ComponentFactory ("service.impl.ServiceFactory") which is in charge of creating component instances of type "ServiceImpl".
> Here is the serviceComponent.xml:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Service" factory="ServiceFactory">
>      <service>
>        <provide interface="service.Service"/>
>      </service>
>      <implementation class="service.impl.ServiceImpl"/>
>    </component>
>    
>    <component name="ServiceFactory">
>      <implementation class="service.impl.ServiceFactory"/>
>      <reference name="COMPONENT_FACTORY" 
>        interface="org.osgi.service.component.ComponentFactory"
>        target="(component.name=Service)"
>        bind="bind"/>
>    </component>
> The ComponentFactory does the following, in a separate thread:
>    while (true) {
>      1- create a ServiceImpl component instance with property "foo=bar2"
>      2- dispose eventual previously created ServiceImpl with property "foo=bar2"
>      3- create a ServiceImpl component instance with property "foo=bar"
>      4- dispose eventual previously created ServiceImpl with property "foo=bar"
>      5- Sleep 500 seconds
>    }
> The issue arises in the step 4: Indeed, when the old ServiceImpl (with property "foo=bar") is disposed, the Client is deactivated, but
> I think it should not, mainly because SCR should actually replace the old bound ServiceImpl with the new one that was created in step 3.
> When you will start the test, you will see the following logs:
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: Sleeping 500 ms ...
>    Client: bound Service : service.impl.ServiceImpl@1bca5f1
>    Client: activated with properties={component.name=Client; component.id=4; SERVICE.target=(foo=bar); }
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar" ...
>    Client: DEACTIVATED !
> Felix, could you please take a look at the sample code and check if my analysis is correct ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-1053) SCR: Bound Service Replacement regression ?

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger updated FELIX-1053:
-------------------------------------

    Fix Version/s: scr-1.0.8

> SCR: Bound Service Replacement regression ?
> -------------------------------------------
>
>                 Key: FELIX-1053
>                 URL: https://issues.apache.org/jira/browse/FELIX-1053
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>         Environment: linux/java version "1.5.0_18"
>            Reporter: Pierre De Rop
>            Assignee: Felix Meschberger
>             Fix For: scr-1.0.8
>
>         Attachments: bound-replacement.tgz
>
>
> With the SCR trunk version, it looks like the "Bound Service Replacement" feature does not work anymore, and
> I think it might be a regression, because it works fine with the SCR version 1.0.6
> I have attached to this issue a sample code which reproduces the problem. In the sample, there are two bundles:
> client-1.0.jar
> =========
> - contains a Client which has a dynamic/required/unary dependency over the "service.Service" interface, with the service property "foo=bar"
> - Here is the serviceComponent.xml description:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Client">
>      <implementation class="client.Client"/>
>      <reference name="SERVICE" 
>        interface="service.Service"
>        policy="dynamic"
>        cardinality="1..1"
>        target="(foo=bar)"
>        bind="bind"/>
>    </component>
> service-1.0.jar
> ==========
> - contains the Service interface: "service.Service"
> - contains the Service implementation: "service.impl.ServiceImpl"
> - contains a ComponentFactory ("service.impl.ServiceFactory") which is in charge of creating component instances of type "ServiceImpl".
> Here is the serviceComponent.xml:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Service" factory="ServiceFactory">
>      <service>
>        <provide interface="service.Service"/>
>      </service>
>      <implementation class="service.impl.ServiceImpl"/>
>    </component>
>    
>    <component name="ServiceFactory">
>      <implementation class="service.impl.ServiceFactory"/>
>      <reference name="COMPONENT_FACTORY" 
>        interface="org.osgi.service.component.ComponentFactory"
>        target="(component.name=Service)"
>        bind="bind"/>
>    </component>
> The ComponentFactory does the following, in a separate thread:
>    while (true) {
>      1- create a ServiceImpl component instance with property "foo=bar2"
>      2- dispose eventual previously created ServiceImpl with property "foo=bar2"
>      3- create a ServiceImpl component instance with property "foo=bar"
>      4- dispose eventual previously created ServiceImpl with property "foo=bar"
>      5- Sleep 500 seconds
>    }
> The issue arises in the step 4: Indeed, when the old ServiceImpl (with property "foo=bar") is disposed, the Client is deactivated, but
> I think it should not, mainly because SCR should actually replace the old bound ServiceImpl with the new one that was created in step 3.
> When you will start the test, you will see the following logs:
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: Sleeping 500 ms ...
>    Client: bound Service : service.impl.ServiceImpl@1bca5f1
>    Client: activated with properties={component.name=Client; component.id=4; SERVICE.target=(foo=bar); }
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar" ...
>    Client: DEACTIVATED !
> Felix, could you please take a look at the sample code and check if my analysis is correct ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1053) SCR: Bound Service Replacement regression ?

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703047#action_12703047 ] 

Felix Meschberger commented on FELIX-1053:
------------------------------------------

Committed a fix in Rev. 768910:

  * The m_size property is not managed in the servicedAdded and serviceRemoved methods any more
  * The serviceChanged method is modified:
       - if the service is registered: check filter and (if matching) increment m_size and all servicedAdded
       - if the service is unregistered: check filter and decrement m_size if matching, serviceRemoved is always called
       - if the service is modified: call serviceRemoved, set m_size to the number of matching services registered and call serviceAdded
  * The setTargetFilter now also sets the m_size property according to the services matching the new filter

> SCR: Bound Service Replacement regression ?
> -------------------------------------------
>
>                 Key: FELIX-1053
>                 URL: https://issues.apache.org/jira/browse/FELIX-1053
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>         Environment: linux/java version "1.5.0_18"
>            Reporter: Pierre De Rop
>            Assignee: Felix Meschberger
>             Fix For: scr-1.0.8
>
>         Attachments: bound-replacement.tgz
>
>
> With the SCR trunk version, it looks like the "Bound Service Replacement" feature does not work anymore, and
> I think it might be a regression, because it works fine with the SCR version 1.0.6
> I have attached to this issue a sample code which reproduces the problem. In the sample, there are two bundles:
> client-1.0.jar
> =========
> - contains a Client which has a dynamic/required/unary dependency over the "service.Service" interface, with the service property "foo=bar"
> - Here is the serviceComponent.xml description:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Client">
>      <implementation class="client.Client"/>
>      <reference name="SERVICE" 
>        interface="service.Service"
>        policy="dynamic"
>        cardinality="1..1"
>        target="(foo=bar)"
>        bind="bind"/>
>    </component>
> service-1.0.jar
> ==========
> - contains the Service interface: "service.Service"
> - contains the Service implementation: "service.impl.ServiceImpl"
> - contains a ComponentFactory ("service.impl.ServiceFactory") which is in charge of creating component instances of type "ServiceImpl".
> Here is the serviceComponent.xml:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Service" factory="ServiceFactory">
>      <service>
>        <provide interface="service.Service"/>
>      </service>
>      <implementation class="service.impl.ServiceImpl"/>
>    </component>
>    
>    <component name="ServiceFactory">
>      <implementation class="service.impl.ServiceFactory"/>
>      <reference name="COMPONENT_FACTORY" 
>        interface="org.osgi.service.component.ComponentFactory"
>        target="(component.name=Service)"
>        bind="bind"/>
>    </component>
> The ComponentFactory does the following, in a separate thread:
>    while (true) {
>      1- create a ServiceImpl component instance with property "foo=bar2"
>      2- dispose eventual previously created ServiceImpl with property "foo=bar2"
>      3- create a ServiceImpl component instance with property "foo=bar"
>      4- dispose eventual previously created ServiceImpl with property "foo=bar"
>      5- Sleep 500 seconds
>    }
> The issue arises in the step 4: Indeed, when the old ServiceImpl (with property "foo=bar") is disposed, the Client is deactivated, but
> I think it should not, mainly because SCR should actually replace the old bound ServiceImpl with the new one that was created in step 3.
> When you will start the test, you will see the following logs:
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: Sleeping 500 ms ...
>    Client: bound Service : service.impl.ServiceImpl@1bca5f1
>    Client: activated with properties={component.name=Client; component.id=4; SERVICE.target=(foo=bar); }
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar" ...
>    Client: DEACTIVATED !
> Felix, could you please take a look at the sample code and check if my analysis is correct ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1053) SCR: Bound Service Replacement regression ?

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12702940#action_12702940 ] 

Felix Meschberger commented on FELIX-1053:
------------------------------------------

Thanks for reporting this bug. I will look into this issue certainly before cutting the release.

> SCR: Bound Service Replacement regression ?
> -------------------------------------------
>
>                 Key: FELIX-1053
>                 URL: https://issues.apache.org/jira/browse/FELIX-1053
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>         Environment: linux/java version "1.5.0_18"
>            Reporter: Pierre De Rop
>            Assignee: Felix Meschberger
>             Fix For: scr-1.0.8
>
>         Attachments: bound-replacement.tgz
>
>
> With the SCR trunk version, it looks like the "Bound Service Replacement" feature does not work anymore, and
> I think it might be a regression, because it works fine with the SCR version 1.0.6
> I have attached to this issue a sample code which reproduces the problem. In the sample, there are two bundles:
> client-1.0.jar
> =========
> - contains a Client which has a dynamic/required/unary dependency over the "service.Service" interface, with the service property "foo=bar"
> - Here is the serviceComponent.xml description:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Client">
>      <implementation class="client.Client"/>
>      <reference name="SERVICE" 
>        interface="service.Service"
>        policy="dynamic"
>        cardinality="1..1"
>        target="(foo=bar)"
>        bind="bind"/>
>    </component>
> service-1.0.jar
> ==========
> - contains the Service interface: "service.Service"
> - contains the Service implementation: "service.impl.ServiceImpl"
> - contains a ComponentFactory ("service.impl.ServiceFactory") which is in charge of creating component instances of type "ServiceImpl".
> Here is the serviceComponent.xml:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Service" factory="ServiceFactory">
>      <service>
>        <provide interface="service.Service"/>
>      </service>
>      <implementation class="service.impl.ServiceImpl"/>
>    </component>
>    
>    <component name="ServiceFactory">
>      <implementation class="service.impl.ServiceFactory"/>
>      <reference name="COMPONENT_FACTORY" 
>        interface="org.osgi.service.component.ComponentFactory"
>        target="(component.name=Service)"
>        bind="bind"/>
>    </component>
> The ComponentFactory does the following, in a separate thread:
>    while (true) {
>      1- create a ServiceImpl component instance with property "foo=bar2"
>      2- dispose eventual previously created ServiceImpl with property "foo=bar2"
>      3- create a ServiceImpl component instance with property "foo=bar"
>      4- dispose eventual previously created ServiceImpl with property "foo=bar"
>      5- Sleep 500 seconds
>    }
> The issue arises in the step 4: Indeed, when the old ServiceImpl (with property "foo=bar") is disposed, the Client is deactivated, but
> I think it should not, mainly because SCR should actually replace the old bound ServiceImpl with the new one that was created in step 3.
> When you will start the test, you will see the following logs:
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: Sleeping 500 ms ...
>    Client: bound Service : service.impl.ServiceImpl@1bca5f1
>    Client: activated with properties={component.name=Client; component.id=4; SERVICE.target=(foo=bar); }
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar" ...
>    Client: DEACTIVATED !
> Felix, could you please take a look at the sample code and check if my analysis is correct ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (FELIX-1053) SCR: Bound Service Replacement regression ?

Posted by "Pierre De Rop (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pierre De Rop closed FELIX-1053.
--------------------------------


> SCR: Bound Service Replacement regression ?
> -------------------------------------------
>
>                 Key: FELIX-1053
>                 URL: https://issues.apache.org/jira/browse/FELIX-1053
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>         Environment: linux/java version "1.5.0_18"
>            Reporter: Pierre De Rop
>            Assignee: Felix Meschberger
>             Fix For: scr-1.0.8
>
>         Attachments: bound-replacement.tgz
>
>
> With the SCR trunk version, it looks like the "Bound Service Replacement" feature does not work anymore, and
> I think it might be a regression, because it works fine with the SCR version 1.0.6
> I have attached to this issue a sample code which reproduces the problem. In the sample, there are two bundles:
> client-1.0.jar
> =========
> - contains a Client which has a dynamic/required/unary dependency over the "service.Service" interface, with the service property "foo=bar"
> - Here is the serviceComponent.xml description:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Client">
>      <implementation class="client.Client"/>
>      <reference name="SERVICE" 
>        interface="service.Service"
>        policy="dynamic"
>        cardinality="1..1"
>        target="(foo=bar)"
>        bind="bind"/>
>    </component>
> service-1.0.jar
> ==========
> - contains the Service interface: "service.Service"
> - contains the Service implementation: "service.impl.ServiceImpl"
> - contains a ComponentFactory ("service.impl.ServiceFactory") which is in charge of creating component instances of type "ServiceImpl".
> Here is the serviceComponent.xml:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Service" factory="ServiceFactory">
>      <service>
>        <provide interface="service.Service"/>
>      </service>
>      <implementation class="service.impl.ServiceImpl"/>
>    </component>
>    
>    <component name="ServiceFactory">
>      <implementation class="service.impl.ServiceFactory"/>
>      <reference name="COMPONENT_FACTORY" 
>        interface="org.osgi.service.component.ComponentFactory"
>        target="(component.name=Service)"
>        bind="bind"/>
>    </component>
> The ComponentFactory does the following, in a separate thread:
>    while (true) {
>      1- create a ServiceImpl component instance with property "foo=bar2"
>      2- dispose eventual previously created ServiceImpl with property "foo=bar2"
>      3- create a ServiceImpl component instance with property "foo=bar"
>      4- dispose eventual previously created ServiceImpl with property "foo=bar"
>      5- Sleep 500 seconds
>    }
> The issue arises in the step 4: Indeed, when the old ServiceImpl (with property "foo=bar") is disposed, the Client is deactivated, but
> I think it should not, mainly because SCR should actually replace the old bound ServiceImpl with the new one that was created in step 3.
> When you will start the test, you will see the following logs:
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: Sleeping 500 ms ...
>    Client: bound Service : service.impl.ServiceImpl@1bca5f1
>    Client: activated with properties={component.name=Client; component.id=4; SERVICE.target=(foo=bar); }
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar" ...
>    Client: DEACTIVATED !
> Felix, could you please take a look at the sample code and check if my analysis is correct ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (FELIX-1053) SCR: Bound Service Replacement regression ?

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned FELIX-1053:
----------------------------------------

    Assignee: Felix Meschberger

> SCR: Bound Service Replacement regression ?
> -------------------------------------------
>
>                 Key: FELIX-1053
>                 URL: https://issues.apache.org/jira/browse/FELIX-1053
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>         Environment: linux/java version "1.5.0_18"
>            Reporter: Pierre De Rop
>            Assignee: Felix Meschberger
>         Attachments: bound-replacement.tgz
>
>
> With the SCR trunk version, it looks like the "Bound Service Replacement" feature does not work anymore, and
> I think it might be a regression, because it works fine with the SCR version 1.0.6
> I have attached to this issue a sample code which reproduces the problem. In the sample, there are two bundles:
> client-1.0.jar
> =========
> - contains a Client which has a dynamic/required/unary dependency over the "service.Service" interface, with the service property "foo=bar"
> - Here is the serviceComponent.xml description:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Client">
>      <implementation class="client.Client"/>
>      <reference name="SERVICE" 
>        interface="service.Service"
>        policy="dynamic"
>        cardinality="1..1"
>        target="(foo=bar)"
>        bind="bind"/>
>    </component>
> service-1.0.jar
> ==========
> - contains the Service interface: "service.Service"
> - contains the Service implementation: "service.impl.ServiceImpl"
> - contains a ComponentFactory ("service.impl.ServiceFactory") which is in charge of creating component instances of type "ServiceImpl".
> Here is the serviceComponent.xml:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Service" factory="ServiceFactory">
>      <service>
>        <provide interface="service.Service"/>
>      </service>
>      <implementation class="service.impl.ServiceImpl"/>
>    </component>
>    
>    <component name="ServiceFactory">
>      <implementation class="service.impl.ServiceFactory"/>
>      <reference name="COMPONENT_FACTORY" 
>        interface="org.osgi.service.component.ComponentFactory"
>        target="(component.name=Service)"
>        bind="bind"/>
>    </component>
> The ComponentFactory does the following, in a separate thread:
>    while (true) {
>      1- create a ServiceImpl component instance with property "foo=bar2"
>      2- dispose eventual previously created ServiceImpl with property "foo=bar2"
>      3- create a ServiceImpl component instance with property "foo=bar"
>      4- dispose eventual previously created ServiceImpl with property "foo=bar"
>      5- Sleep 500 seconds
>    }
> The issue arises in the step 4: Indeed, when the old ServiceImpl (with property "foo=bar") is disposed, the Client is deactivated, but
> I think it should not, mainly because SCR should actually replace the old bound ServiceImpl with the new one that was created in step 3.
> When you will start the test, you will see the following logs:
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: Sleeping 500 ms ...
>    Client: bound Service : service.impl.ServiceImpl@1bca5f1
>    Client: activated with properties={component.name=Client; component.id=4; SERVICE.target=(foo=bar); }
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar" ...
>    Client: DEACTIVATED !
> Felix, could you please take a look at the sample code and check if my analysis is correct ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-1053) SCR: Bound Service Replacement regression ?

Posted by "Pierre De Rop (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pierre De Rop updated FELIX-1053:
---------------------------------

    Attachment: bound-replacement.tgz

> SCR: Bound Service Replacement regression ?
> -------------------------------------------
>
>                 Key: FELIX-1053
>                 URL: https://issues.apache.org/jira/browse/FELIX-1053
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>         Environment: linux/java version "1.5.0_18"
>            Reporter: Pierre De Rop
>         Attachments: bound-replacement.tgz
>
>
> With the SCR trunk version, it looks like the "Bound Service Replacement" feature does not work anymore, and
> I think it might be a regression, because it works fine with the SCR version 1.0.6
> I have attached to this issue a sample code which reproduces the problem. In the sample, there are two bundles:
> client-1.0.jar
> =========
> - contains a Client which has a dynamic/required/unary dependency over the "service.Service" interface, with the service property "foo=bar"
> - Here is the serviceComponent.xml description:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Client">
>      <implementation class="client.Client"/>
>      <reference name="SERVICE" 
>        interface="service.Service"
>        policy="dynamic"
>        cardinality="1..1"
>        target="(foo=bar)"
>        bind="bind"/>
>    </component>
> service-1.0.jar
> ==========
> - contains the Service interface: "service.Service"
> - contains the Service implementation: "service.impl.ServiceImpl"
> - contains a ComponentFactory ("service.impl.ServiceFactory") which is in charge of creating component instances of type "ServiceImpl".
> Here is the serviceComponent.xml:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Service" factory="ServiceFactory">
>      <service>
>        <provide interface="service.Service"/>
>      </service>
>      <implementation class="service.impl.ServiceImpl"/>
>    </component>
>    
>    <component name="ServiceFactory">
>      <implementation class="service.impl.ServiceFactory"/>
>      <reference name="COMPONENT_FACTORY" 
>        interface="org.osgi.service.component.ComponentFactory"
>        target="(component.name=Service)"
>        bind="bind"/>
>    </component>
> The ComponentFactory does the following, in a separate thread:
>    while (true) {
>      1- create a ServiceImpl component instance with property "foo=bar2"
>      2- dispose eventual previously created ServiceImpl with property "foo=bar2"
>      3- create a ServiceImpl component instance with property "foo=bar"
>      4- dispose eventual previously created ServiceImpl with property "foo=bar"
>      5- Sleep 500 seconds
>    }
> The issue arises in the step 4: Indeed, when the old ServiceImpl (with property "foo=bar") is disposed, the Client is deactivated, but
> I think it should not, mainly because SCR should actually replace the old bound ServiceImpl with the new one that was created in step 3.
> When you will start the test, you will see the following logs:
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: Sleeping 500 ms ...
>    Client: bound Service : service.impl.ServiceImpl@1bca5f1
>    Client: activated with properties={component.name=Client; component.id=4; SERVICE.target=(foo=bar); }
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar" ...
>    Client: DEACTIVATED !
> Felix, could you please take a look at the sample code and check if my analysis is correct ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1053) SCR: Bound Service Replacement regression ?

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703028#action_12703028 ] 

Felix Meschberger commented on FELIX-1053:
------------------------------------------

This is actually a regression introduced with FELIX-993: As for this issue I removed the target filter check on removal. The consequence is that the m_size field is decremented on each service removal, regardless of this makes any sense or not.

Will have to investigate various options with respect to target filters:

(1) add service with matching / non-matching filter   --> no issue works right now
(2) remove service with matching / non-matching filter --> used to work before FELIX-993
(3) change service such that the filter match changes --> used to not work before FELIX-993, does not work correctly now.

The problem really is handling the service properties update and its influence on the target filter matching.... Copying with service properties update requires more work than just removing/adding the service.

> SCR: Bound Service Replacement regression ?
> -------------------------------------------
>
>                 Key: FELIX-1053
>                 URL: https://issues.apache.org/jira/browse/FELIX-1053
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>         Environment: linux/java version "1.5.0_18"
>            Reporter: Pierre De Rop
>            Assignee: Felix Meschberger
>             Fix For: scr-1.0.8
>
>         Attachments: bound-replacement.tgz
>
>
> With the SCR trunk version, it looks like the "Bound Service Replacement" feature does not work anymore, and
> I think it might be a regression, because it works fine with the SCR version 1.0.6
> I have attached to this issue a sample code which reproduces the problem. In the sample, there are two bundles:
> client-1.0.jar
> =========
> - contains a Client which has a dynamic/required/unary dependency over the "service.Service" interface, with the service property "foo=bar"
> - Here is the serviceComponent.xml description:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Client">
>      <implementation class="client.Client"/>
>      <reference name="SERVICE" 
>        interface="service.Service"
>        policy="dynamic"
>        cardinality="1..1"
>        target="(foo=bar)"
>        bind="bind"/>
>    </component>
> service-1.0.jar
> ==========
> - contains the Service interface: "service.Service"
> - contains the Service implementation: "service.impl.ServiceImpl"
> - contains a ComponentFactory ("service.impl.ServiceFactory") which is in charge of creating component instances of type "ServiceImpl".
> Here is the serviceComponent.xml:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <component name="Service" factory="ServiceFactory">
>      <service>
>        <provide interface="service.Service"/>
>      </service>
>      <implementation class="service.impl.ServiceImpl"/>
>    </component>
>    
>    <component name="ServiceFactory">
>      <implementation class="service.impl.ServiceFactory"/>
>      <reference name="COMPONENT_FACTORY" 
>        interface="org.osgi.service.component.ComponentFactory"
>        target="(component.name=Service)"
>        bind="bind"/>
>    </component>
> The ComponentFactory does the following, in a separate thread:
>    while (true) {
>      1- create a ServiceImpl component instance with property "foo=bar2"
>      2- dispose eventual previously created ServiceImpl with property "foo=bar2"
>      3- create a ServiceImpl component instance with property "foo=bar"
>      4- dispose eventual previously created ServiceImpl with property "foo=bar"
>      5- Sleep 500 seconds
>    }
> The issue arises in the step 4: Indeed, when the old ServiceImpl (with property "foo=bar") is disposed, the Client is deactivated, but
> I think it should not, mainly because SCR should actually replace the old bound ServiceImpl with the new one that was created in step 3.
> When you will start the test, you will see the following logs:
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: Sleeping 500 ms ...
>    Client: bound Service : service.impl.ServiceImpl@1bca5f1
>    Client: activated with properties={component.name=Client; component.id=4; SERVICE.target=(foo=bar); }
>    ServiceFactory: creating Service instance with property "foo=bar2" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar2" ...
>    ServiceFactory: creating Service instance with property "foo=bar" ...
>    ServiceFactory: disposing old Service instance with property "foo=bar" ...
>    Client: DEACTIVATED !
> Felix, could you please take a look at the sample code and check if my analysis is correct ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.