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

Race condition in EntityFiltering #4187

Closed
jansupol opened this issue Jul 3, 2019 · 1 comment
Closed

Race condition in EntityFiltering #4187

jansupol opened this issue Jul 3, 2019 · 1 comment
Milestone

Comments

@jansupol
Copy link
Contributor

jansupol commented Jul 3, 2019

The symptom is that when an entity filtering is used, only some fields are returned, not all selected.

The log can contain an exception:

Caused by:
|java.util.ConcurrentModificationException
| at java.util.HashMap$HashIterator.nextNode(HashMap.java:1437)
| at java.util.HashMap$EntryIterator.next(HashMap.java:1471)
| at java.util.HashMap$EntryIterator.next(HashMap.java:1469)
| at org.glassfish.jersey.internal.guava.AbstractMapBasedMultimap$AsMap$AsMapIterator.next(AbstractMapBasedMultimap.java:1348)
| at org.glassfish.jersey.internal.guava.AbstractMapBasedMultimap$AsMap$AsMapIterator.next(AbstractMapBasedMultimap.java:1336)
| at org.glassfish.jersey.internal.guava.TransformedIterator.next(TransformedIterator.java:45)
| at org.glassfish.jersey.internal.guava.AbstractMultimap.containsValue(AbstractMultimap.java:41)
| at org.glassfish.jersey.internal.guava.HashMultimap.containsValue(HashMultimap.java:44)
| at org.glassfish.jersey.message.filtering.EntityGraphImpl.presentInScopes(EntityGraphImpl.java:205)
| at org.glassfish.jersey.message.filtering.DefaultEntityProcessor.process(DefaultEntityProcessor.java:95)
| at org.glassfish.jersey.message.filtering.DefaultEntityProcessor.process(DefaultEntityProcessor.java:79)
| at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspectEntityProperties(EntityInspectorImpl.java:173)
| at org.glassfish.jersey.message.filtering.EntityInspectorImpl.inspect(EntityInspectorImpl.java:104)
| at org.glassfish.jersey.message.filtering.spi.AbstractObjectProvider.getFilteringObject (AbstractObjectProvider.java:90)

@jansupol
Copy link
Contributor Author

jansupol commented Jul 3, 2019

When EntityInspectorImpl.inspect is called, two threads can start to populate the EntityGraph leading to the exception.

Also, if a first thread is still populating the EntityGraph, another thread can invoke the method,
graphProvider.containsEntityGraph will return true, the thread can create an ObjectGraph from the not fully populated EntityGraph in AbstractObjectProvider#getFilteringObject.

@jansupol jansupol added this to the 2.29.1 milestone Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant