Uploaded image for project: 'Blazegraph (by SYSTAP)'
  1. Blazegraph (by SYSTAP)
  2. BLZG-34

Bug in JiniCoreServicesConfiguration.getServiceRegistrars() (infinite wait)

    XMLWordPrintable

    Details

      Description

      A bug was reported via the developers mailing list where the JiniCoreServicesConfiguration.getServiceRegistrars() method could go into a non-timed Object.wait(long timeout). The documentation for Object.wait(long timeout) indicates that a timeout of ZERO is treated as NO timeout rather than an immediate timeout. Since remaining is in nanoseconds, the timeout after conversion to milliseconds, can be ZERO (0).

      Problem code @ line 434.

                  while (registrars.length < maxCount) {
      
                      remaining = nanos - (System.nanoTime() - begin);
      
                      if (remaining <= 0) {
      

      Proposed fix:

                  while (registrars.length < maxCount) {
      
                      remaining = nanos - (System.nanoTime() - begin);
      
                      if (TimeUnit.NANOSECONDS.toMillis(remaining) <= 0) {
      

      The proposed fix addresses the problem by ensuring that the remaining time is at least one millisecond (after conversion from nanoseconds to milliseconds). Hence Object.wait(timeout) never goes into an untimed wait.

        Attachments

          Activity

            People

            Assignee:
            bryanthompson bryanthompson
            Reporter:
            bryanthompson bryanthompson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2 hours
                2h
                Remaining:
                0m
                Logged:
                Time Not Required
                Not Specified