PengZheng commented on a change in pull request #399:
URL: https://github.com/apache/celix/pull/399#discussion_r810499938



##########
File path: libs/framework/src/service_registry.c
##########
@@ -277,13 +277,12 @@ celix_status_t 
serviceRegistry_unregisterService(service_registry_pt registry, b
         service_reference_pt ref = refsMap != NULL ?
                                    hashMap_get(refsMap, 
(void*)registration->serviceId) : NULL;
         if (ref != NULL) {
-            serviceReference_invalidate(ref);
+            serviceReference_invalidateCache(ref);
         }
     }
     hashMapIterator_destroy(iter);
+    serviceRegistration_invalidate(registration);
        celixThreadRwlock_unlock(&registry->lock);

Review comment:
       Between unlock and invalidate, there is a window of race condition: 
`serviceRegistry_getServiceReference` will return a reference containing a 
still valid registration (but to be invalidated soon), through which we can get 
a service instance, which has no chance of ungetting once the registration is 
invalidated.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to