Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-8671

Two threads calling get and retrieve the same PdxInstance, resulting in corruption

Agile BoardRank to TopRank to BottomAttach filesAttach ScreenshotVotersStop watchingWatchersCreate sub-taskConvert to sub-taskLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments



      Even if copy-on-read is set to true, two threads calling get on a partitioned region can end up with the same PdxInstance object.

      This is problematic because some PdxInstances methods are not thread safe. Although the underlying bytes are immutatable, the PDXInstance has a ByteSource with a position field that changes. That means two threads doing serialization or calling toString on the PdxInstance could result in one or more threads getting a corrupt read.

      It looks like they are ending up with the same instance because of the behavior in LocalRegion.optimizedGetObject. We use futures to make sure there is only 1 get that goes through, and both threads receive the same value.

      Ending up in optimizedGetObject requires a race with the put, because if the value was in the cache at the beginning of the get it would be returned earlier in the get process.

      I put a test that reproduces this issue here - https://github.com/upthewaterspout/geode/pull/new/feature/pdx-instances-shared



          $i18n.getText('security.level.explanation', $currentSelection) Viewable by All Users


            • Assignee:
              jchen21 Jianxia Chen
              upthewaterspout Dan Smith


              • Created:

                Issue deployment