You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/02/22 07:18:01 UTC
DO NOT REPLY [Bug 48791] New: Race condition in class
javax.el.BeanELResolver$BeanProperty field read/write
https://issues.apache.org/bugzilla/show_bug.cgi?id=48791
Summary: Race condition in class
javax.el.BeanELResolver$BeanProperty field read/write
Product: Tomcat 6
Version: 6.0.18
Platform: Other
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Servlet & JSP API
AssignedTo: dev@tomcat.apache.org
ReportedBy: qiyaoltc@gmail.com
In java/javax/el/BeanELResolver.java,
255 private Method read(ELContext ctx) {
256 if (this.read == null) {
257 this.read = getMethod(this.owner,
descriptor.getReadMethod());
258 if (this.read == null) {
259 throw new
PropertyNotFoundException(message(ctx,
260
"propertyNotReadable", new Object[] {
261
type.getName(), descriptor.getName()
}));
262 }
263 }
264 return this.read;
265 }
If two threads execute method write in parallel, the value of this.read is
non-determined.
The output below is what we got from race detector
(http://www.alphaworks.ibm.com/tech/msdk), and this result shows that threads
http-8080-x may access this field in parallel.
One possible fix to this problem is to move line 256-257 to synchronization
block.
---------------------------------------------------------------------------
Data Race 1 : javax.el.BeanELResolver$BeanProperty : read
Thread "http-8080-5" : Tid 36 : WRITE
Lock Set : [ ]
[javax.el.BeanELResolver$BeanProperty :
read(Ljavax/el/ELContext;)Ljava/lang/reflect/Method; : : 257]
[javax.el.BeanELResolver$BeanProperty :
access$000(Ljavax/el/BeanELResolver$BeanProperty;Ljavax/el/ELContext;)Ljava/lang/reflect/Method;
: : 209]
[javax.el.BeanELResolver :
getValue(Ljavax/el/ELContext;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
: : 60]
[javax.el.CompositeELResolver :
getValue(Ljavax/el/ELContext;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
: : 54]
[org.apache.el.parser.AstValue :
getValue(Lorg/apache/el/lang/EvaluationContext;)Ljava/lang/Object; : : 118]
........
Thread "http-8080-1" : Tid 32 : WRITE
Lock Set : [ ]
[javax.el.BeanELResolver$BeanProperty :
read(Ljavax/el/ELContext;)Ljava/lang/reflect/Method; : : 257]
[javax.el.BeanELResolver$BeanProperty :
access$000(Ljavax/el/BeanELResolver$BeanProperty;Ljavax/el/ELContext;)Ljava/lang/reflect/Method;
: : 209]
[javax.el.BeanELResolver :
getValue(Ljavax/el/ELContext;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
: : 60]
[javax.el.CompositeELResolver :
getValue(Ljavax/el/ELContext;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
: : 54]
[org.apache.el.parser.AstValue :
getValue(Lorg/apache/el/lang/EvaluationContext;)Ljava/lang/Object; : : 118]
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 48791] Race condition in class
javax.el.BeanELResolver$BeanProperty field read/write
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48791
Yao Qi <qi...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |qiyaoltc@gmail.com
--- Comment #2 from Yao Qi <qi...@gmail.com> 2010-03-02 02:38:55 UTC ---
(In reply to comment #1)
> It might be inefficient (although I doubt you'd notice it in any realistic
> test), it might be poor coding style (that is arguable) but it isn't a bug.
Can you explain a little bit why it isn't a bug?
If two threads access the following code,
255 private Method read(ELContext ctx) {
256 if (this.read == null) {
257 this.read = getMethod(this.owner,descriptor.getReadMethod());
The value of this.read will be either return value of getMethod invoked by two
threads. Can we change it to this manner,
if (this.read == null) {
synchronized (lock4Read){
if (this.read == null){
this.read = getMethod(this.owner,descriptor.getReadMethod());
}
}
This change is still efficient, and make sure no race in it. How do you think?
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 48791] Race condition in class
javax.el.BeanELResolver$BeanProperty field read/write
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48791
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #1 from Mark Thomas <ma...@apache.org> 2010-02-22 21:30:27 UTC ---
It might be inefficient (although I doubt you'd notice it in any realistic
test), it might be poor coding style (that is arguable) but it isn't a bug.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org