Uploaded image for project: 'Modular Service Container'
  1. Modular Service Container
  2. MSC-106

Dependent.dependencyFailed is called twice by failing dependency

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.0.1.GA
    • None
    • None
    • None
    • Hide

      Run ChangeModeTestCase several times (~2000 times), until changeFailedToStartActiveToRemove test fails.
      Or, use the new race condition test that will be added as part of this Jira.

      Show
      Run ChangeModeTestCase several times (~2000 times), until changeFailedToStartActiveToRemove test fails. Or, use the new race condition test that will be added as part of this Jira.
    • Workaround Exists
    • Hide

      The suggested workaround is just checking for the current state at newDependent() implementation:
      if (failCount > 0 && state != Substate.STARTING) {
      // if starting and failCount is 1, dependents have not been notified yet...
      // hence, skip it to avoid double notification
      dependent.dependencyFailed();
      }
      The original code just checks for failCount > 0, resulting in the duplicate notification we want to avoid.

      Show
      The suggested workaround is just checking for the current state at newDependent() implementation: if (failCount > 0 && state != Substate.STARTING) { // if starting and failCount is 1, dependents have not been notified yet... // hence, skip it to avoid double notification dependent.dependencyFailed(); } The original code just checks for failCount > 0, resulting in the duplicate notification we want to avoid.

      If a call to ServiceRegistrationImpl.newDependent is made at the exact moment a dependency has just failed (i.e., its failCount equals 1, but none of its dependents have been notified yet), the new dependent will get a duplicate dependencyFailed notification.

      The first notification is sent by ServiceControllerImpl.newDependent, the second one, at the moment the new dependency notifies all of its dependents of the failure.

      This Jira includes adding a race condition test to reproduce this scenario.

              flaviarnn Flavia Rainone
              flaviarnn Flavia Rainone
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: