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

JavaLogFactory not thread safe #286

Closed
meg23 opened this issue Nov 13, 2014 · 1 comment
Closed

JavaLogFactory not thread safe #286

meg23 opened this issue Nov 13, 2014 · 1 comment

Comments

@meg23
Copy link

meg23 commented Nov 13, 2014

From mike.til...@yahoo.com on July 26, 2012 10:07:44

What steps will reproduce the problem? for (int i = 0; i < 5000; ++i) {
new Thread(new Runnable() {
public void run() {
ESAPI.getLogger(String.valueOf(Math.random()));
}
}).start();
} What is the expected output? What do you see instead? Expect the program to finish, doesn't always finish. Non-synchronized puts/gets to HashMap can result in an infinite loop. What version of the product are you using? On what operating system? esapi-2.0.1.jar
$ java -version
java version "1.6.0_32"
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) Server VM (build 20.7-b02, mixed mode) Please provide any additional information below. Should use Collections.synchronizedMap or ConcurrentHashMap

Original issue: http://code.google.com/p/owasp-esapi-java/issues/detail?id=280

kwwall pushed a commit that referenced this issue Jan 16, 2019
* JavaLogFactory Concurrency Test

Test case showing that in multi-threaded requests for a single reference,
multiple Logger references may be created.

* Logic & Test Updates JavaLogFactory

Extending test to also create Logs by module name.

Updating logic in class to have class delegate to the module name with the
class name reference and synchronizing on the map while the reference is
being retrieved and/or created.
@kwwall
Copy link
Contributor

kwwall commented Jan 16, 2019

Closed via PR #470

@kwwall kwwall closed this as completed Jan 16, 2019
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

2 participants