Uploaded image for project: 'CXF Distributed OSGi (Retired)'
  1. CXF Distributed OSGi (Retired)
  2. DOSGI-214

Endpoint publication to discovery does not always work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.6.0
    • 1.7.0
    • common
    • None
    • Windows 7, Linux (OpenSuse), seems to happen more often with slower CPU computers

    • Unknown

    Description

      TopologyManager bundle's EndpointListenerNotifier does not call all EndpointListener's at all times correctly and therefore some endpoints don't get published to discovery (zookeeper).

      I found following problems with the current implementation:
      1) TopologyManagerExport.exportServiceUsingRemoteServiceAdmin():
      In the end of the exportServiceUsingRemoteServiceAdmin() notifyListeners() is called before updating endpointregistry. This causes problem in EndpointListenerNotifier, because endpointRepository.getAllEndpoints() does not return correct state before endpoints are updated. Basically problem exists when ServiceTracker's addingService() is called simultaneously for discovery bundle's EndpointLIstener and other thread (call coming from TopologyManagerExport) calls notfiyListeners(). stEndpointListeners.getServiceReferences() does not yet return the endpoint listener of discovery bundle and therefore discovery is not notified. Also, addingService() call does not find endpoint from endpointRegistry and therefore does not publish it.

      FIX: By changing the order of notifyListeners() and addEndpoints() in TopologyManagerExport the above is fixed.

      2) EndpointListenerNotifier is not threadsafe although ServiceTracker is. stEndpointListeners.getServiceReferences() returns just added EndpointListener (the one from discovery bundle) only AFTER whole overrided addingService() method has finished. So following can happen:
      a) addingService() is called with discovery bundle's EPL
      b) super.addingService() call is finished and notifyListener() is called with no new Endpoint because TopologyManagerExport has not yet added it to endPointRepo
      c) TopologyManagerExport calls addEndpoint() and notifyListeners() (in fixed order) and EndpointListenerNotifier does not notify discove EPL, because addingService() call has not yet returned and therefore stEndpointListeners.getServiceReferences() still returns 1 EPL (from topologyManager bundle)

      FIX: Add synchronized (EndpointListenerNotifier.this) to both methods addingService and modifiedService. Also add synchronized (this) to notifyListeners() method so that lock guards call to stdEndpointListeners.getServiceReference().

      Attachments

        Activity

          People

            amichai Amichai Rothman
            zapppp Timo Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: