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

Is this library thread-safe? #47

Closed
coreagile opened this issue Mar 30, 2019 · 2 comments
Closed

Is this library thread-safe? #47

coreagile opened this issue Mar 30, 2019 · 2 comments

Comments

@coreagile
Copy link

I've built a little command-line passphrase generator, and added your library in to calculate entropy for the generated passwords. I've noticed when I try to run multiple estimations in parallel with the same object, I get one of many kinds of errors:

  1. ConcurrentModificationException
  2. java.lang.IllegalStateException: There was an unexpected error and all of the matches put together do not equal the original password.
  3. Entropy of 0.0

Can you chime in on whether this object is thread-safe?

Thanks!

@robin-maxxton
Copy link
Contributor

robin-maxxton commented Nov 15, 2019

I tested the library with Apache Benchmark and came to same conclusion.
The generateMatches method is not thread safe due to the presence of class variables.
I've created a pull request to fix this (see #49)

@Tostino
Copy link
Collaborator

Tostino commented Nov 18, 2019

I just merged the PR, and am working on adding some concurrency tests to fix this going forward. Thanks raising the issue @coreagile, and thank you @robin-maxxton for the work on this!

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

No branches or pull requests

3 participants