-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConcurrentModificationException in TypeInfoSetImpl#getXmlNs #1726
Comments
I think it's a multi-threading issue. I don't know if this class is meant to be accessed by multiple threads simultaneously. I think what is happing here
is that
Options could be to
|
We met this issue too in CXF. It looks like creating a ConcurrentHashMap for xmlNsCache is good to go |
I might have misunderstood what @schabe77 is considering as an option here but if getXmlNs can be called concurrently then I don't think that just making xmlNsCache a ConcurrentHashMap would be enough because multiple threads executing in that method at the same time could see |
@tomjenkinson You are right. It is possible that the xmlNsCache is initialized twice. But that's not a (big) problem because it's just a cache. The worst thing that could happen is that a formally cached value would have been re-evaluated. But this fix prevents a RuntimeException, which is much worse. You would probably have to refactor the class to make it really pretty, but I was more interested in the fix. |
I think I am with you, sorry for the noise - not synchronizing access allows the xmlNsCache to be overwritten by a competing thread but IIUC from a JAX-B point of view the result should just be considered that the old xmlNsCache is overwritten and left to the garbage collector to deal with. This observation assumes that for this API, it is well defined that HashMaps returned from the call (that are created at Line 299 in 6b86301
== /!= .
|
Please can I ask for an update on this and whether there is more information that is needed to be reported to help identify an appropriate solution? |
Hi,
I use the BingAds-API that uses CXF that uses jaxb-runtime-4.0.3 and just faced a ConcurrentModificationException.
Unfortunately I don't know what Bing and CXF do in detail, but maybe this stack trace helps:
The environment is
Debian
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
The text was updated successfully, but these errors were encountered: