XStream
  1. XStream
  2. XSTR-748

A data race in com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: 1.4.5
    • Fix Version/s: None
    • Component/s: Converters
    • Labels:
      None

      Description

      Hi,

      We ran a dynamic race detector on Xstream-1.4.5 and found a real data race on the variable pureJavaReflectionProvider in class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.
      An instance of this class's subclass can be shared by multiple threads, and the read and write accesses to pureJavaReflectionProvider at lines 507 and 508 in the method writeValueToImplicitCollection are not properly synchronized, which can be executed by different threads concurrently.

      488    private void writeValueToImplicitCollection(Object value, Map implicitCollections, Object result, String implicitFieldName) {
      ...             
      507                if (pureJavaReflectionProvider == null) {
      508                    pureJavaReflectionProvider = new PureJavaReflectionProvider();
      509                }
      

      However, I am not sure whether this race is intentional or not. It could be benign if new PureJavaReflectionProvider() has no side effect. But it's good to report it here anyway.

      Jeff

        People

        • Assignee:
          Jörg Schaible
          Reporter:
          Jeff Huang
        • Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: