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

Suppress Sonar warning for volatile objects

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.1.0
    • None
    • None

    Description

      Currently, there are about 40 bugs on Sonar for [Ratis|https://sonarcloud.io/summary/new_code?id=apache-ratis], with more than half of these issues stemming from the use of volatile fields to decorate objects rather than primitive data types.

      Theoretically, volatile is indeed intended for use with primitive data types only, as decorating objects can lead to visibility issues. To avoid certain concurrency problems, using AtomicReference is recommended. However, it seems that for certain types of objects that are not modified, this usage does not result in bugs?

      I'm not sure what the Ratis community's stance is on this code style. If there are confirmed rules and some code that could be optimized, I'm willing to undertake these tasks to avoid potential concurrency issues and eliminate Sonar bugs.

      Tsz-wo Sze What's your opinion?

      Attachments

        1. S3077.jpg
          142 kB
          Tsz-wo Sze
        2. peerId.jpg
          27 kB
          Tsz-wo Sze
        3. image-2024-03-22-17-00-53-814.png
          522 kB
          Xinyu Tan

        Activity

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

          People

            tanxinyu Xinyu Tan
            tanxinyu Xinyu Tan
            Votes:
            0 Vote for this issue
            Watchers:
            2 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
                1h

                Slack

                  Issue deployment