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

DefaultEncoder deadlock #7

Closed
GoogleCodeExporter opened this issue May 20, 2015 · 4 comments
Closed

DefaultEncoder deadlock #7

GoogleCodeExporter opened this issue May 20, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

> > This is the code that we were using:
> >     public static String javaScriptEncode(String str){
> >         DefaultEncoder encoder = new DefaultEncoder();
> >         return encoder.encodeForJavaScript(str);
> >     }
> >
> > When two threads attept to instantiate the DefaultEncoder object at
> the same
> > time, one thread seems to wait indefinately, consuming all server
> CPU.  I am
> > not sure exactly where this happens in the OWASP code, but moving
the
> > instantiation of the DefaultEncoder to the class level seems to fix
> this
> > issue.  Please note that this was consuming CPU for other
> applications on
> > the same hardware we are on.


Original issue reported on code.google.com by planetlevel on 20 Dec 2008 at 2:30

@GoogleCodeExporter
Copy link
Author

Confirmed - in ESAPI 1.4 the initialization hangs in a multithreaded 
environment. 
This is due to improper use of static collections from an instance constructor 
during
initialization.  If you use the DefaultEncoder standalone in very fast 
succession it
can deadlock. A test application has been added to the test cases to 
demonstrate.

http://code.google.com/p/owasp-esapi-java/source/browse/trunk/src/test/java/org/
owasp/esapi/reference/EncoderConcurrencyTest.java



Original comment by planetlevel on 20 Dec 2008 at 5:31

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Fixed by moving initialization code into static initializers.

Original comment by planetlevel on 20 Dec 2008 at 5:32

  • Changed title: DefaultEncoder deadlock
  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Which version is this fix available in? I compared last two versions and 
couldn't
find a fix for it. Any help would be appreciated. Thanks.

Original comment by lake...@gmail.com on 6 Nov 2009 at 1:14

@GoogleCodeExporter
Copy link
Author

http://code.google.com/p/owasp-esapi-java/source/detail?r=408

Original comment by planetlevel on 7 Nov 2009 at 2:06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant