DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12519>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12519

Optional package for Validation framework is not thread safe 

           Summary: Optional package for Validation framework is not thread
                    safe
           Product: Struts
           Version: 1.0.2 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Validator Framework
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Symptoms: Hanging threads using up 100% of the cpu and the following stack trace
java.lang.ArrayIndexOutOfBoundsException: -30020
at org.apache.regexp.RE.matchNodes(RE.java(Compiled Code))
at org.apache.regexp.RE.matchNodes(RE.java(Compiled Code))
at org.apache.regexp.RE.matchNodes(RE.java(Compiled Code))
at org.apache.regexp.RE.matchNodes(RE.java(Compiled Code))
at org.apache.regexp.RE.matchNodes(RE.java(Compiled Code))
at org.apache.regexp.RE.matchNodes(RE.java(Compiled Code))
at org.apache.regexp.RE.match(RE.java(Compiled Code))
at org.apache.regexp.RE.match(RE.java(Compiled Code))
at org.apache.regexp.RE.match(RE.java:1468)
at org.apache.regexp.RE.match(RE.java:1561)
at com.wintecinc.struts.validation.GenericValidator.matchRegexp
(GenericValidator.java:97)

Explaination of Issue:
The optional validation framework from 
http://home.earthlink.net/~dwinterfeldt/contact.html uses the jakarta regex 
package. The RE.class and RECompiler.class are not thread safe and since the 
validation occurs within a servlet we would expect to see issues. 
We did not see these issues on every call to the validation framework, only 
when we were running load tests against the system.
Resolution:
Changing the matchRegexp method in the GenericValidator class to be 
synchronized fixed the issues we say with affecting performance noticably.

package com.wintecinc.struts.validation;
public class GenericValidator implements Serializable {
...
public static synchronized boolean matchRegexp(String value, String regexp) 
throws RESyntaxException {

Note: This should be fixed with the latest version of the Validation framework 
because it uses the Perl5Util.class in the ORO package for regular expression 
matching which is thread safe according to the api documentation.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to