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

C client calculates invalid time interval for pings et al

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.4.0, 3.4.8, 3.5.0, 3.5.1, 3.6.0
    • None
    • c client
    • None

    Description

      The C-client has a function called calculate_interval() in zookeeper.c, whose purpose is to determine the number of milliseconds difference between a start and end time.

      Unfortunately its logic is invalid, if the number of microseconds of the end time happens to be less than the number of microseconds of the start time - which it will be about half the time, since the end time could be in the next second interval. Such a case would yield a very big negative number, making the function return an invalid value.

      Instead of re-creating the wheel, the calculate_interval() should use the timersub() function from time.h if it's available - if it's not #define'd, then #define it. (it's a macro, and the source code for it is readily available)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Hadriel Hadriel Kaplan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: