[jira] [Commented] (FELIX-5199) Race condition in HttpServiceFactory.getService() causing exception

2016-02-26 Thread David Bosschaert (JIRA)

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

David Bosschaert commented on FELIX-5199:
-

I improved the thread-safety in the fix after feedback from [~cziegeler] in 
this commit: https://svn.apache.org/viewvc?view=revision=1732453

> Race condition in HttpServiceFactory.getService() causing exception
> ---
>
> Key: FELIX-5199
> URL: https://issues.apache.org/jira/browse/FELIX-5199
> Project: Felix
>  Issue Type: Bug
>  Components: HTTP Service
>Affects Versions: http.base-3.0.6
>Reporter: David Bosschaert
>Assignee: David Bosschaert
> Fix For: http.base-3.0.8
>
> Attachments: felix-5199.patch
>
>
> The HttpServiceFactory.getService() is as follows:
> {code}
> public HttpService getService(final Bundle bundle, final 
> ServiceRegistration reg)
> {
> final ServletContext servletContext = this.context;
> if ( servletContext != null ) {
> return new PerBundleHttpServiceImpl(bundle,
> this.sharedHttpService,
> this.context,
> this.contextAttributeListenerManager,
> this.sharedContextAttributes,
> this.requestListenerManager,
> this.requestAttributeListenerManager);
> }
> return null;
> }{code}
> However it is possible that this.context is set to {{null}} after the check 
> for {{null}} is done but before the constructor is called causing a null 
> servlet context to be passed to {{PerBundleHttpServiceImpl}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Resolved] (FELIX-5198) Service should not be available while being unregistered

2016-02-26 Thread Carsten Ziegeler (JIRA)

 [ 
https://issues.apache.org/jira/browse/FELIX-5198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carsten Ziegeler resolved FELIX-5198.
-
   Resolution: Won't Fix
Fix Version/s: (was: framework-5.6.0)

Just had a chat with David and he pointed out that the service reference itself 
is not gettable when unregistering is called, e.g. getServiceReferences() does 
not return it.
I think this is good enough

> Service should not be available while being unregistered
> 
>
> Key: FELIX-5198
> URL: https://issues.apache.org/jira/browse/FELIX-5198
> Project: Felix
>  Issue Type: Bug
>  Components: Framework
>Affects Versions: framework-5.4.0
>Reporter: Carsten Ziegeler
>Assignee: David Bosschaert
> Attachments: felix-5198.patch
>
>
> Currently it is possible to get a service while it is  being unregistered - 
> if the service is get during processing of the unregistering event. This is 
> the order of events:
> a) a service (factory) is unregistered in the framework
> b) the UNREGISTERING event is sent before the service is actually 
> unregistered (this is as defined in the spec)
> c) the above event is handled synchronously, reactivating dependent components
> d) during this reactivation, some component looks up the service that is 
> unregistered in a). as this service is still registered and marked as valid, 
> it gets it
> According to ServiceRegistration.unregister the service should not be 
> available anymore while the events are sent



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Resolved] (FELIX-5199) Race condition in HttpServiceFactory.getService() causing exception

2016-02-26 Thread David Bosschaert (JIRA)

 [ 
https://issues.apache.org/jira/browse/FELIX-5199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

David Bosschaert resolved FELIX-5199.
-
   Resolution: Fixed
Fix Version/s: http.base-3.0.8

Fixed in https://svn.apache.org/viewvc?view=revision=1732445 using 
flag as suggested.

> Race condition in HttpServiceFactory.getService() causing exception
> ---
>
> Key: FELIX-5199
> URL: https://issues.apache.org/jira/browse/FELIX-5199
> Project: Felix
>  Issue Type: Bug
>  Components: HTTP Service
>Affects Versions: http.base-3.0.6
>Reporter: David Bosschaert
>Assignee: David Bosschaert
> Fix For: http.base-3.0.8
>
> Attachments: felix-5199.patch
>
>
> The HttpServiceFactory.getService() is as follows:
> {code}
> public HttpService getService(final Bundle bundle, final 
> ServiceRegistration reg)
> {
> final ServletContext servletContext = this.context;
> if ( servletContext != null ) {
> return new PerBundleHttpServiceImpl(bundle,
> this.sharedHttpService,
> this.context,
> this.contextAttributeListenerManager,
> this.sharedContextAttributes,
> this.requestListenerManager,
> this.requestAttributeListenerManager);
> }
> return null;
> }{code}
> However it is possible that this.context is set to {{null}} after the check 
> for {{null}} is done but before the constructor is called causing a null 
> servlet context to be passed to {{PerBundleHttpServiceImpl}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (FELIX-5199) Race condition in HttpServiceFactory.getService() causing exception

2016-02-26 Thread David Bosschaert (JIRA)

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

David Bosschaert commented on FELIX-5199:
-

Thanks for the feedback, [~cziegeler]. I didn't think of checking for the other 
objects as {{PerBundleHttpServiceImpl}} only seems to require the Bundle and 
the ServletContext to be non-null. As this is a service factory which is called 
by the framework the Bundle can never be null...

I agree that a started/stopped flag would cover the overall case. Let me rework 
the patch for that...

> Race condition in HttpServiceFactory.getService() causing exception
> ---
>
> Key: FELIX-5199
> URL: https://issues.apache.org/jira/browse/FELIX-5199
> Project: Felix
>  Issue Type: Bug
>  Components: HTTP Service
>Affects Versions: http.base-3.0.6
>Reporter: David Bosschaert
>Assignee: David Bosschaert
> Attachments: felix-5199.patch
>
>
> The HttpServiceFactory.getService() is as follows:
> {code}
> public HttpService getService(final Bundle bundle, final 
> ServiceRegistration reg)
> {
> final ServletContext servletContext = this.context;
> if ( servletContext != null ) {
> return new PerBundleHttpServiceImpl(bundle,
> this.sharedHttpService,
> this.context,
> this.contextAttributeListenerManager,
> this.sharedContextAttributes,
> this.requestListenerManager,
> this.requestAttributeListenerManager);
> }
> return null;
> }{code}
> However it is possible that this.context is set to {{null}} after the check 
> for {{null}} is done but before the constructor is called causing a null 
> servlet context to be passed to {{PerBundleHttpServiceImpl}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)