-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Taylor S. Wicksell opened SPR-9166 and commented
The same type of deadlock seen in #13722 can actually be triggered from numerous locations in the framework beyond just converter cache lookup. After the release of 3.1.1 we noticed the same issue being triggered from multiple calls from the Spring Form tag.
"tomcat-http--49" daemon prio=10 tid=0x0000000052868800 nid=0x2ad1 waiting for monitor entry [0x0000000047048000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:417)
- waiting to lock <0x00000005f59f31c0> (a java.util.HashMap)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
at sun.reflect.annotation.AnnotationParser.annotationForMap(AnnotationParser.java:239)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:229)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.reflect.Field.declaredAnnotations(Field.java:1014)
- locked <0x000000072fe2e428> (a java.lang.reflect.Field)
at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:1007)
at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:175)
at org.springframework.core.convert.Property.resolveAnnotations(Property.java:197)
at org.springframework.core.convert.Property.<init>(Property.java:65)
at org.springframework.beans.BeanWrapperImpl.property(BeanWrapperImpl.java:525)
at org.springframework.beans.BeanWrapperImpl.getPropertyTypeDescriptor(BeanWrapperImpl.java:401)
at org.springframework.validation.AbstractPropertyBindingResult.findEditor(AbstractPropertyBindingResult.java:159)
at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:125)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:178)
at org.springframework.web.servlet.tags.form.ErrorsTag.shouldRender(ErrorsTag.java:140)
at org.springframework.web.servlet.tags.form.AbstractHtmlElementBodyTag.writeTagContent(AbstractHtmlElementBodyTag.java:47)
at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
The root issue seems to be the reading of annotations using reflection in the constructor of org.springframework.core.convert.Property. This condition can be recreated fairly easily by calling this constructor from a unit test using multiple threads, as shown here: https://gist.github.com/1894670
It would seem like deferring the parsing of annotations until they are actually requested could help to mitigate this issue greatly.
Affects: 3.0.6, 3.1.1
Issue Links:
- Use concurrent cache to improve performance of GenericTypeResolver [SPR-8701] #13343 Use concurrent cache to improve performance of GenericTypeResolver
- SWF-1528 Webflow upgrade from 2.0.8 to 2.3.0 - 6% CPU Increase On Websphere
- Develop ConcurrentReferenceHashMap [SPR-9796] #14429 Develop ConcurrentReferenceHashMap
Referenced from: commits 02ce826
2 votes, 6 watchers