[jira] [Commented] (FELIX-4190) The framework should not hold any lock while calling ServiceFactory#unget

2014-03-11 Thread David Jencks (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-4190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13930818#comment-13930818
 ] 

David Jencks commented on FELIX-4190:
-

I'm ok with the duplicated loop.


> The framework should not hold any lock while calling ServiceFactory#unget
> -
>
> Key: FELIX-4190
> URL: https://issues.apache.org/jira/browse/FELIX-4190
> Project: Felix
>  Issue Type: Bug
>  Components: Framework
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: framework-4.4.0
>
>




--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (FELIX-4190) The framework should not hold any lock while calling ServiceFactory#unget

2014-03-11 Thread Richard S. Hall (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-4190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13930291#comment-13930291
 ] 

Richard S. Hall commented on FELIX-4190:


I believe duplicating the loop would work. The first loop tries to be friendly, 
then the call to invalidate() makes it impossible to get the service object 
again, and then finally the second loop deals more harshly with clients who 
won't let go.

> The framework should not hold any lock while calling ServiceFactory#unget
> -
>
> Key: FELIX-4190
> URL: https://issues.apache.org/jira/browse/FELIX-4190
> Project: Felix
>  Issue Type: Bug
>  Components: Framework
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: framework-4.4.0
>
>




--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (FELIX-4190) The framework should not hold any lock while calling ServiceFactory#unget

2014-02-24 Thread Guillaume Nodet (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-4190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13910322#comment-13910322
 ] 

Guillaume Nodet commented on FELIX-4190:


So I come back to my earlier proposal which is to duplicate the loop at the end 
after having invalidted the registration.
I.e. 

{code}
// Now forcibly unget the service object for all stubborn clients.
Bundle[] clients = getUsingBundles(reg.getReference());
for (int i = 0; (clients != null) && (i < clients.length); i++)
{
while (ungetService(clients[i], reg.getReference()))
; // Keep removing until it is no longer possible
}
((ServiceRegistrationImpl) reg).invalidate();
for (int i = 0; (clients != null) && (i < clients.length); i++)
{
while (ungetService(clients[i], reg.getReference()))
; // Keep removing until it is no longer possible
}
{code}

The call to getUsingBundles does not need to be synchronized, as the method 
itself synchronizes on this.
At this point, no new bundles can acquire a service reference, so we can keep 
the list of bundles and iterator on it safely.
Then, we do a first pass on ungetService which should remove most of the 
references, except if a bundle is re-acquiring the service.
We then invalidate the registration, which will prevent any further call to 
getService.
We iterate another time on the bundles in case a bundle has acquired the 
service during the first loop.


> The framework should not hold any lock while calling ServiceFactory#unget
> -
>
> Key: FELIX-4190
> URL: https://issues.apache.org/jira/browse/FELIX-4190
> Project: Felix
>  Issue Type: Bug
>  Components: Framework
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: framework-4.4.0
>
>




--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (FELIX-4190) The framework should not hold any lock while calling ServiceFactory#unget

2013-08-06 Thread David Jencks (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-4190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13731347#comment-13731347
 ] 

David Jencks commented on FELIX-4190:
-

I agree with Richard that this is not a satisfactory patch.  This is a 
duplicate of FELIX-3687 where I proposed another unsatisfactory patch and 
determined that Richard's suggestion wouldn't work.  I have a further proposal 
there that I still think might work.

> The framework should not hold any lock while calling ServiceFactory#unget
> -
>
> Key: FELIX-4190
> URL: https://issues.apache.org/jira/browse/FELIX-4190
> Project: Felix
>  Issue Type: Bug
>  Components: Framework
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: framework-4.4.0
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (FELIX-4190) The framework should not hold any lock while calling ServiceFactory#unget

2013-08-02 Thread Richard S. Hall (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-4190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13728122#comment-13728122
 ] 

Richard S. Hall commented on FELIX-4190:


I won't revert it, since I don't expect it will cause any issues in normal 
usage. We can just think about how to fix it when you are back. It is a little 
tricky, though.

> The framework should not hold any lock while calling ServiceFactory#unget
> -
>
> Key: FELIX-4190
> URL: https://issues.apache.org/jira/browse/FELIX-4190
> Project: Felix
>  Issue Type: Bug
>  Components: Framework
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: framework-4.4.0
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (FELIX-4190) The framework should not hold any lock while calling ServiceFactory#unget

2013-08-02 Thread Guillaume Nodet (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-4190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13728091#comment-13728091
 ] 

Guillaume Nodet commented on FELIX-4190:


I suggest you revert the patch if you want until further discussed as I'll be 
in vacation for the next weeks and won't be able to actually do anything nor 
discuss that further.

Another option might be to duplicate the loop after having invalidated the 
registration to get rid of possible new references acquired while processing 
the ServiceEvent.UNREGISTERING or just before the service registration has been 
invalidated.  That would avoid grabbing the lock again I think.

> The framework should not hold any lock while calling ServiceFactory#unget
> -
>
> Key: FELIX-4190
> URL: https://issues.apache.org/jira/browse/FELIX-4190
> Project: Felix
>  Issue Type: Bug
>  Components: Framework
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: framework-4.4.0
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (FELIX-4190) The framework should not hold any lock while calling ServiceFactory#unget

2013-08-02 Thread Richard S. Hall (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-4190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13727714#comment-13727714
 ] 

Richard S. Hall commented on FELIX-4190:


Reiterating a comment from email:

Technically, I think this patch is not correct.

We specifically allow for bundles that already hold the service reference to 
acquire the service object while a service is being unregistered (see comments 
in ServiceRegistry.unregisterService()). This means that a bundle that already 
holds the service reference could, technically, acquire the unregistering 
service just after you call getUsingBundles(), thus we wouldn't be forcing it 
to unget.

The only way I think we can do what you want is to somehow acquire the registry 
lock (i.e., this) again and put us into some new state that doesn't allow any 
more bundles to acquire the unregistering service...or perhaps by adding 
something to the service registration to put it into a new state where it won't 
return anything from getService. Then we could release the registry lock and 
continue with what you have. 

> The framework should not hold any lock while calling ServiceFactory#unget
> -
>
> Key: FELIX-4190
> URL: https://issues.apache.org/jira/browse/FELIX-4190
> Project: Felix
>  Issue Type: Bug
>  Components: Framework
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: framework-4.4.0
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira