Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-2204

LearnerSnapshotThrottlerTest.testHighContentionWithTimeout fails occasionally

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Test
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.5.0
    • 3.5.1, 3.6.0
    • None
    • None
    • Patch

    Description

      The LearnerSnapshotThrottler will only allow 2 concurrent snapshots to be taken, and if there are already 2 snapshots in progress it will wait up to 200ms for one to complete. This isn't enough time for testHighContentionWithTimeout to consistently pass - on a cold JVM running just the one test I was able to get it to fail 3 times in around 50 runs. This 200ms timeout will be hit if there is a delay between a thread calling LearnerSnapshot snap = throttler.beginSnapshot(false); and throttler.endSnapshot();.
      This also erroneously fails on the build server, see https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/2747/testReport/org.apache.zookeeper.server.quorum/LearnerSnapshotThrottlerTest/testHighContentionWithTimeout/ for an example.

      I have bumped the timeout up to 5 seconds (which should be more than enough for warmup / gc pauses), as well as added logging to the catch (Exception e) block to assist in debugging any future issues.

      An alternate approach would be to separate out results gathered from the threads, because although we only record true/false there are really three outcomes:
      1. The snapshotNumber was <= 2, meaning the individual call operated correctly
      2. The snapshotNumber was > 2, meaning the test should definitely fail
      3. We were unable to snapshot in the time given, so we can't determine if we should fail or pass (although if we have "enough" successes from #1 with no failures from #2 maybe we would pass the test anyway).
      Bumping up the timeout is easier.

      Attachments

        1. ZOOKEEPER-2204.patch
          2 kB
          Donny Nadolny
        2. ZOOKEEPER-2204.patch
          2 kB
          Donny Nadolny

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            dnadolny Donny Nadolny
            dnadolny Donny Nadolny
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment