jaxb
  1. jaxb
  2. JAXB-923

Unmarshalled content interchange between two threads

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.13
    • Fix Version/s: 2.2.3
    • Component/s: None
    • Labels:
      None
    • Environment:

      Java 64-Bit Server 1.6.0_31
      Ubuntu 12.04 64-Bit

      Description

      I have many threads which are unmarshall xmls to objects. There is a map and some other fields in this class.

      I realized that there are some cases where the content in the map is changed.

      I created a simple unit test. Put a String into the map and into a field where the map is. Create 15 threads to marshall and unmarshall my object 1000 times.
      After the test execution I realized that about in the 2% of the calls, the String in the map differs from the value in the field.

      I add my test case.

      There are some interesting things:

              final Unmarshaller[] marshaller = new Unmarshaller[NUMBER_OF_CLIENTS];
              final JAXBContext jaxbContext = JAXBContext.newInstance(Event.class);
              for (int i = 0; i < NUMBER_OF_CLIENTS; i++) {
                  marshaller[i] = jaxbContext.createUnmarshaller();
              }
      

      Here I create unmarshallers for all threads. But if I create new JAXBContext instance for each threads, the test passed, no errors.

              //        @XmlJavaTypeAdapter(MyAdapter.class)
              public final HashMap<String, Object> map = new HashMap<String, Object>() {
                  private static final long serialVersionUID = 1L;
      
                  @Override
                  public Object put(final String key, final Object value) {
                      if ("expected".equals(key) && !value.equals(Event.this.expected)) {
                          System.out.println(Event.this.expected + "  " + value);
                      }
                      return super.put(key, value);
                  }
              };
      

      Here if I uncomment the @XmlJavaTypeAdapter annotation, the test passed, no errors.

        Activity

        Hide
        Martin Grebac added a comment -

        Hi, thanks for submission, however not able to reproduce - is this JDK/OS specific? Would you please verify with latest 2.2.x version as well? Thanks.

        Show
        Martin Grebac added a comment - Hi, thanks for submission, however not able to reproduce - is this JDK/OS specific? Would you please verify with latest 2.2.x version as well? Thanks.
        Hide
        csupi added a comment -

        2.2.x is not an option for me because of the cxf version.

        Anyway the test does not fail, but prints messages to the system out.

        Show
        csupi added a comment - 2.2.x is not an option for me because of the cxf version. Anyway the test does not fail, but prints messages to the system out.
        Hide
        csupi added a comment -

        I tested it with previous versions of 2.1.x:

        2.1.11: passed
        2.1.12: failed

        Show
        csupi added a comment - I tested it with previous versions of 2.1.x: 2.1.11: passed 2.1.12: failed
        Hide
        csupi added a comment -

        Do you have any news about this issue? Could you reproduce this?

        Show
        csupi added a comment - Do you have any news about this issue? Could you reproduce this?
        Hide
        Iaroslav Savytskyi added a comment -

        Hi,

        As I know, we don't have maintenance release for 2.1.x in plan.

        Show
        Iaroslav Savytskyi added a comment - Hi, As I know, we don't have maintenance release for 2.1.x in plan.
        Hide
        Martin Grebac added a comment -

        Isn't this http://java.net/jira/browse/JAXB-596 ? Which is already fixed in 2.2.x codebase?

        Show
        Martin Grebac added a comment - Isn't this http://java.net/jira/browse/JAXB-596 ? Which is already fixed in 2.2.x codebase?
        Hide
        Iaroslav Savytskyi added a comment -

        Was fixed with 3372 revision.

        Show
        Iaroslav Savytskyi added a comment - Was fixed with 3372 revision.
        Hide
        Iaroslav Savytskyi added a comment -

        I'm not sure about the fix version. But fix revision was committed 17.10.2010.
        It could be included into next 2.1.x release (if any would be).

        Show
        Iaroslav Savytskyi added a comment - I'm not sure about the fix version. But fix revision was committed 17.10.2010. It could be included into next 2.1.x release (if any would be).
        Hide
        csupi added a comment -

        Hi,

        I found a bugfix in the release 2.1.14, which looks alike this one:
        Bug 16016894: webservice de-marshalling is corrupting hashMap parameters

        I can not find any detailed information about that bugfix. Is that a fix for this issue also?

        Show
        csupi added a comment - Hi, I found a bugfix in the release 2.1.14, which looks alike this one: Bug 16016894: webservice de-marshalling is corrupting hashMap parameters I can not find any detailed information about that bugfix. Is that a fix for this issue also?

          People

          • Assignee:
            Iaroslav Savytskyi
            Reporter:
            csupi
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: