Uploaded image for project: 'Ratis'
  1. Ratis
  2. RATIS-1923

Netty: atomic operations require side-effect-free functions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • Netty
    • None

    Description

      • The update methods in AtomicReference run in a loop and may call the update function multiple time. The old values created by the update function may be discarded without cleaning up. In NettyClientStreamRpc.Connection the connect method is not side-effect-free. Although it passes a MemoizedSupplier to getAndUpdate, it still is possible that a value is supplied but then discarded in the AtomicReference loop.
      • -Similarly, the computeIfAbsent in ConcurrentHashMap also runs in a loop and may call the mapping function multiple times. DataStreamMap is implemented using a ConcurrentHashMap. However, the mapping function is not side-effect-free although it uses a MemoizedSupplier.-
        (Update: tanxinyu pointed out that this was not a problem.  Thanks!  The computeIfAbsent method does not require side-effect-free as described in the javadoc; see also the comments below.)

      Attachments

        1. for-loop.jpg
          88 kB
          Tsz-wo Sze
        2. screenshot-1.png
          333 kB
          Xinyu Tan

        Issue Links

          Activity

            People

              szetszwo Tsz-wo Sze
              szetszwo Tsz-wo Sze
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m