Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3775

Concurrency issue causing PropertyModel.getCachedCodec to return null

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.2.0
    • Affects Version/s: 3.12.5
    • Component/s: POJO
    • None
    • Environment:
      java 8, mongodb 4.2.8

      I'm getting a NullPointerException in EncoderContext.encodeWithChildContext when encoding POJO's with many nested objects using multiple threads.

      After a random number of serializations PropertyModel.getCachedCodec keeps returning null and the method fails when it is called by PojoCodecImpl.encodeValue

      • Simplifying the POJO structure reduces the chance on exceptions; as does lowering the amount of threads or adding delays.
      • When running on a single thread no exceptions are thrown

      The issue could be related to / the same asĀ JAVA-3606; however the attached example code reproduces the issue.

        1. example.zip
          171 kB
        2. stacktrace.txt
          4 kB

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            jsikkes@xs4all.nl Jeroen Sikkes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: