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

java.util.ConcurrentModificationException in X509Store.add_file #14

Closed
mkristian opened this issue Dec 4, 2014 · 3 comments
Closed

Comments

@mkristian
Copy link
Member

this happens occasionally when running with 75 threads:

java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859)
at java.util.ArrayList$Itr.next(ArrayList.java:831)
at org.jruby.ext.openssl.x509store.Store.addLookup(Store.java:247)
at org.jruby.ext.openssl.x509store.Store.loadLocations(Store.java:304)
at org.jruby.ext.openssl.X509Store.add_file(X509Store.java:149)
at org.jruby.ext.openssl.X509Store$INVOKER$i$1$0$add_file.call(X509Store$INVOKER$i$1$0$add_file.gen)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
at rubyjit.HTTPClient::SSLConfig$$add_trust_ca_to_store_d37babffa92813153e8c69ceebf0faad4a5138201658031548.__file__(/srv/backup/releases/1417564834/backup.jar!/gems/httpclient-2.4.0/lib/httpclient/ssl_config.rb:194)
at rubyjit.HTTPClient::SSLConfig$$add_trust_ca_to_store_d37babffa92813153e8c69ceebf0faad4a5138201658031548.__file__(/srv/backup/releases/1417564834/backup.jar!/gems/httpclient-2.4.0/lib/httpclient/ssl_config.rb)
at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:221)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
at rubyjit.HTTPClient::SSLConfig$$add_trust_ca_15517071ac4d7b05eb9ccb0c01dc09b537d9ffdb1658031548.__file__(/srv/backup/releases/1417564834/backup.jar!/gems/httpclient-2.4.0/lib/httpclient/ssl_config.rb:185)
at rubyjit.HTTPClient::SSLConfig$$add_trust_ca_15517071ac4d7b05eb9ccb0c01dc09b537d9ffdb1658031548.__file__(/srv/backup/releases/1417564834/backup.jar!/gems/httpclient-2.4.0/lib/httpclient/ssl_config.rb)
at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
at rubyjit.Faraday::Adapter::HTTPClient$$configure_ssl_3b7637d30c66508da3df3d10b51462ad7679bba41658031548.__file__(/srv/backup/releases/1417564834/backup.jar!/gems/faraday-0.9.0/lib/faraday/adapter/httpclient.rb:73)
at rubyjit.Faraday::Adapter::HTTPClient$$configure_ssl_3b7637d30c66508da3df3d10b51462ad7679bba41658031548.__file__(/srv/backup/releases/1417564834/backup.jar!/gems/faraday-0.9.0/lib/faraday/adapter/httpclient.rb)
at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
@kares
Copy link
Member

kares commented Dec 4, 2014

najs catch ... most of jruby-openssl is either "crazy" sync-ed or not at all, this seems the later :)

we're probably need to make Store behave thread-safely on places such as https://github.com/jruby/jruby-openssl/blob/master/src/main/java/org/jruby/ext/openssl/x509store/Store.java#L259 not sure if just sync-ing or using a copy-on-write list is best, cause I do not know how often if might get called from rubygems etc.

@mkristian
Copy link
Member Author

@kares I found this X509Utils.CRYPTO_LOCK_X509_STORE which was used (not consistently) at other places. so I went for it. if you feel we should go for better synchronized (like the COW you mentioned above) we should do it for the whole X509Store

@kares
Copy link
Member

kares commented Dec 11, 2014

@mkristian probably fine - assuming X509Store.add_file won't be called a lot from "real-world" threads.

mkristian added a commit that referenced this issue Dec 11, 2014
just keep all synchronization inside the Store class and keep
the synchronize "small". removed GLOBAL Store lock. part of fixing #14

Sponsored by Lookout Inc.
mkristian added a commit that referenced this issue Dec 11, 2014
keep the synchronized basically restricted to write operations.
follow up of #14

Sponsored by Lookout Inc.
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

2 participants