Skip to content
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 when a JAXRS API has multiple consume and/or produce MediaTypes #4368

Closed
jhanders34 opened this issue Jul 26, 2018 · 4 comments
Assignees
Labels
release bug This bug is present in a released version of Open Liberty release-18.0.0.3

Comments

@jhanders34
Copy link
Member

When a JAXRS API has multiple consume or produce MediaTypes, the list of MediaTypes is sorted for comparison purposes. The same collection of MediaTypes is being sorted by multiple threads instead of just once.

Below is a stack trace for the reported issue.

java.util.ConcurrentModificationException
at java.util.ArrayList.sort(ArrayList.java:1475)
at java.util.Collections.sort(Collections.java:186)
at org.apache.cxf.jaxrs.utils.JAXRSUtils.sortMediaTypes(JAXRSUtils.java:1744)
at org.apache.cxf.jaxrs.provider.ProviderFactory$MessageBodyReaderComparator.compare(ProviderFactory.java:1181)
at org.apache.cxf.jaxrs.provider.ProviderFactory$MessageBodyReaderComparator.compare(ProviderFactory.java:1166)
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:366)
at java.util.TimSort.sort(TimSort.java:231)
at java.util.Arrays.sort(Arrays.java:1856)
at java.util.ArrayList.sort(ArrayList.java:1473)
at java.util.Collections.sort(Collections.java:186)
at org.apache.cxf.jaxrs.provider.ProviderFactory$AtomicReferenceProviderList.addAndSortProviders(ProviderFactory.java:965)
at org.apache.cxf.jaxrs.provider.ProviderFactory.addAndSortReaders(ProviderFactory.java:907)
at org.apache.cxf.jaxrs.provider.ProviderFactory.setCommonProviders(ProviderFactory.java:828)
at org.apache.cxf.jaxrs.client.ClientProviderFactory.setProviders(ClientProviderFactory.java:77)
at org.apache.cxf.jaxrs.provider.ProviderFactory.setUserProviders(ProviderFactory.java:1162)
at org.apache.cxf.jaxrs.client.spec.ClientImpl$WebTargetImpl.request(ClientImpl.java:336)
at org.apache.cxf.jaxrs.client.spec.ClientImpl$WebTargetImpl.request(ClientImpl.java:421)

@jhanders34 jhanders34 added the release bug This bug is present in a released version of Open Liberty label Jul 26, 2018
@jhanders34 jhanders34 self-assigned this Jul 26, 2018
jhanders34 added a commit that referenced this issue Jul 30, 2018
Issue #4368 Avoid ConcurrentModificationException when sorting media types.
@annaguri
Copy link
Contributor

annaguri commented Aug 1, 2018

@jhanders34 can we have an iFix for 18.0.0.2?

@jim-krueger
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release bug This bug is present in a released version of Open Liberty release-18.0.0.3
Projects
None yet
Development

No branches or pull requests

4 participants