[
https://issues.apache.org/jira/browse/LANG-349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
David Ishee updated LANG-349:
-
Description:
I used the ReflectionToStringBuilder on an object to output debugging messages
to Log4j. If this object was picked up by two different threads and the
toString() method was called at the same time in two different threads, a
deadlock occurrs.
Here is a stack trace from using jstack:
Thread 1172: (state = BLOCKED)
- java.util.Vector.hashCode() @bci=0, line=938 (Interpreted frame)
- java.util.HashMap.containsKey(java.lang.Object) @bci=6, line=377 (Compiled
frame)
- org.apache.commons.lang.builder.ReflectionToStringBuilder.toString()
@bci=50, line=522 (Compiled frame)
-
org.apache.commons.lang.builder.ReflectionToStringBuilder.toString(java.lang.Object,
org.apache.commons.lang.builder.ToStringStyle, boolean, java.lang.Class)
@bci=12, line=265 (Interpreted frame)
-
org.apache.commons.lang.builder.ReflectionToStringBuilder.toString(java.lang.Object,
org.apache.commons.lang.builder.ToStringStyle) @bci=4, line=197 (Interpreted
frame)
-
org.apache.commons.lang.builder.ToStringBuilder.reflectionToString(java.lang.Object,
org.apache.commons.lang.builder.ToStringStyle) @bci=2, line=170 (Interpreted
frame)
[...]
Thread 1191: (state = BLOCKED)
- java.util.Vector.hashCode() @bci=0, line=938 (Interpreted frame)
- java.util.HashMap.containsKey(java.lang.Object) @bci=6, line=377 (Compiled
frame)
- org.apache.commons.lang.builder.ReflectionToStringBuilder.toString()
@bci=50, line=522 (Compiled frame)
[...]
was:
I used the ReflectionToStringBuilder on an object to output debugging messages
to Log4j. If this object was picked up by two different threads and the
toString() method was called at the same time in two different threads, a
deadlock occurrs.
Here is a stack trace from using jstack:
{noformat}
Thread 1172: (state = BLOCKED)
- java.util.Vector.hashCode() @bci=0, line=938 (Interpreted frame)
- java.util.HashMap.containsKey(java.lang.Object) @bci=6, line=377 (Compiled
frame)
- org.apache.commons.lang.builder.ReflectionToStringBuilder.toString()
@bci=50, line=522 (Compiled frame)
-
org.apache.commons.lang.builder.ReflectionToStringBuilder.toString(java.lang.Object,
org.apache.commons.lang.builder.ToStringStyle, boolean, java.lang.Class)
@bci=12, line=265 (Interpreted frame)
-
org.apache.commons.lang.builder.ReflectionToStringBuilder.toString(java.lang.Object,
org.apache.commons.lang.builder.ToStringStyle) @bci=4, line=197 (Interpreted
frame)
-
org.apache.commons.lang.builder.ToStringBuilder.reflectionToString(java.lang.Object,
org.apache.commons.lang.builder.ToStringStyle) @bci=2, line=170 (Interpreted
frame)
[...]
{noformat}
{noformat}
Thread 1191: (state = BLOCKED)
- java.util.Vector.hashCode() @bci=0, line=938 (Interpreted frame)
- java.util.HashMap.containsKey(java.lang.Object) @bci=6, line=377 (Compiled
frame)
- org.apache.commons.lang.builder.ReflectionToStringBuilder.toString()
@bci=50, line=522 (Compiled frame)
[...]
{noformat}
Deadlock using ReflectionToStringBuilder
Key: LANG-349
URL: https://issues.apache.org/jira/browse/LANG-349
Project: Commons Lang
Issue Type: Bug
Affects Versions: 2.0
Environment: java version 1.5.0_10
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Java HotSpot(TM) Server VM (build 1.5.0_10-b03, mixed mode)
uname -a
Linux fwjsfimat04 2.4.21-32.EL #1 SMP Fri Apr 15 21:02:58 EDT 2005 x86_64
x86_64 x86_64 GNU/Linux
Reporter: David Ishee
Priority: Critical
I used the ReflectionToStringBuilder on an object to output debugging
messages to Log4j. If this object was picked up by two different threads and
the toString() method was called at the same time in two different threads, a
deadlock occurrs.
Here is a stack trace from using jstack:
Thread 1172: (state = BLOCKED)
- java.util.Vector.hashCode() @bci=0, line=938 (Interpreted frame)
- java.util.HashMap.containsKey(java.lang.Object) @bci=6, line=377 (Compiled
frame)
- org.apache.commons.lang.builder.ReflectionToStringBuilder.toString()
@bci=50, line=522 (Compiled frame)
-
org.apache.commons.lang.builder.ReflectionToStringBuilder.toString(java.lang.Object,
org.apache.commons.lang.builder.ToStringStyle, boolean, java.lang.Class)
@bci=12, line=265 (Interpreted frame)
-
org.apache.commons.lang.builder.ReflectionToStringBuilder.toString(java.lang.Object,
org.apache.commons.lang.builder.ToStringStyle) @bci=4, line=197 (Interpreted
frame)
-
org.apache.commons.lang.builder.ToStringBuilder.reflectionToString(java.lang.Object,
org.apache.commons.lang.builder.ToStringStyle) @bci=2, line=170 (Interpreted
frame)
[...]
Thread 1191: (state = BLOCKED)
- java.util.Vector.hashCode()