Open schabe77 opened 1 year ago
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
if(xmlNsCache==null) {
xmlNsCache = new HashMap<>();
...
Map<String, String> m = xmlNsCache.computeIfAbsent(uri, k -> new HashMap<>());
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 xmlNsCache==null
at the same time and thus multiple xmlNsCache = new ConcurrentHashMap<>();
could execute in parallel at the same time, with the latest thread overwriting the variable xmlNsCache
/cc @jimma regarding pull request https://github.com/eclipse-ee4j/jaxb-ri/pull/1806.
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)