{"action":"created","issue":{"url":"https://api.github.com/repos/bundler/bundler/issues/3545","labels_url":"https://api.github.com/repos/bundler/bundler/issues/3545/labels{/name}","comments_url":"https://api.github.com/repos/bundler/bundler/issues/3545/comments","events_url":"https://api.github.com/repos/bundler/bundler/issues/3545/events","html_url":"https://github.com/bundler/bundler/issues/3545","id":66241261,"number":3545,"title":"Paralellized `bundle install` with BUNDLE_JOBS=16 fails with newer Rubies","user":{"login":"tknerr","id":365744,"avatar_url":"https://avatars.githubusercontent.com/u/365744?v=3","gravatar_id":"","url":"https://api.github.com/users/tknerr","html_url":"https://github.com/tknerr","followers_url":"https://api.github.com/users/tknerr/followers","following_url":"https://api.github.com/users/tknerr/following{/other_user}","gists_url":"https://api.github.com/users/tknerr/gists{/gist_id}","starred_url":"https://api.github.com/users/tknerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tknerr/subscriptions","organizations_url":"https://api.github.com/users/tknerr/orgs","repos_url":"https://api.github.com/users/tknerr/repos","events_url":"https://api.github.com/users/tknerr/events{/privacy}","received_events_url":"https://api.github.com/users/tknerr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-03T22:40:20Z","updated_at":"2015-04-04T00:15:17Z","closed_at":null,"body":"I have a weird issue when installing a bundle in parallel using the `BUNDLE_JOBS` configuration. This is on a Windows7 machine (have not tested on my linux box yet).\r\n\r\nUp to now I was using Ruby 2.0.0p451 and everything was fine. \r\n\r\nOnce I switched to Ruby 2.1.5p273 (and same for 2.2.1p85) the parallelized installation of the bundled gems fails at a random gem. Once I repeat this will eventually succeed and fail at another gem. After repeating several times I get all gems installed.\r\n\r\nI suspect is has something to do with multithreading and the http(s) connections. Observations:\r\n\r\n* when I do a single threaded install (i.e. remove `BUNDLE_JOBS` from `~/.bundle/config`) everything works fine - no warnings and it succeeds on the first pass\r\n* during a multithreaded install I get lots of `OpenSSL::SSL::SSLError: SSL_read: cert already in hash table` warnings\r\n\r\nThis is my `~/.bundle/config`:\r\n```\r\n---\r\nBUNDLE_PATH: ~/.gem/ruby/2.2.0\r\nBUNDLE_JOBS: 16\r\nBUNDLE_RETRY: 3\r\n```\r\n\r\nHere's the `Gemfile` I'm trying to install:\r\nhttps://github.com/tknerr/sample-toplevel-cookbook/blob/master/Gemfile\r\n\r\nAnd this is what I get on `bundle install` with Ruby 2.1.5 / 2.2.1:\r\n```\r\n...\r\nInstalling sawyer 0.6.0\r\nInstalling net-ssh-gateway 1.2.0\r\nInstalling net-scp 1.2.1\r\nInstalling stove 3.2.3\r\n\r\nOpenSSL::SSL::SSLError: SSL_read: cert already in hash table\r\nInstalling rspec-mocks 3.2.1\r\nInstalling celluloid-io 0.16.2\r\nInstalling pry 0.10.1\r\nInstalling highline 1.7.1\r\nInstalling rspec-core 3.2.2\r\nInstalling tailor 1.4.1\r\nInstalling net-ssh-multi 1.2.0\r\n\r\nOpenSSL::SSL::SSLError: SSL_read: cert already in hash table\r\nInstalling octokit 3.8.0\r\nInstalling specinfra 2.28.0\r\nInstalling ffi 1.9.8\r\nAn error occurred while installing foodcritic (4.0.0), and Bundler cannot\r\ncontinue.\r\nMake sure that `gem install foodcritic -v '4.0.0'` succeeds before bundling.\r\n```\r\n\r\nHere it fails randomly at the foodcritic gem. Once I try again it would fail on another gem. And I can repeat until everything installed...\r\n\r\nRunning `bundle install --verbose` reveals the stacktrace behind the SSL warnings, e.g.:\r\n```\r\n...\r\nInstalling polyglot 0.3.5\r\n4:  polyglot (0.3.5) from X:/home/.gem/ruby/2.2.0/specifications/polyglot-0.3.5.gemspec\r\n\r\nOpenSSL::SSL::SSLError: SSL_read: cert already in hash table\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/openssl/buffering.rb:182:in `sysread_nonblock'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/openssl/buffering.rb:182:in `read_nonblock'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/net/protocol.rb:153:in `rbuf_fill'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/net/protocol.rb:134:in `readuntil'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/net/protocol.rb:144:in `readline'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/net/http/response.rb:39:in `read_status_line'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/net/http/response.rb:28:in `read_new'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:1414:in `block in transport_request'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:1411:in `catch'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:1411:in `transport_request'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:1384:in `request'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/rubygems/request.rb:154:in `perform_request'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/rubygems/request.rb:109:in `fetch'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/rubygems/remote_fetcher.rb:346:in `request'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/rubygems/remote_fetcher.rb:231:in `fetch_http'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/rubygems/remote_fetcher.rb:247:in `fetch_http'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/rubygems/remote_fetcher.rb:267:in `fetch_path'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/rubygems/remote_fetcher.rb:302:in `cache_update_path'\r\nX:/tools/ruby-2.2.1/lib/ruby/2.2.0/rubygems/remote_fetcher.rb:168:in `download'\r\nX:/tools/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/rubygems_integration.rb:544:in `download_gem'\r\nX:/tools/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/fetcher.rb:63:in `download_gem_from_uri'\r\nX:/tools/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/source/rubygems.rb:370:in `fetch_gem'\r\nX:/tools/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/source/rubygems.rb:98:in `install'\r\nX:/tools/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/installer.rb:107:in `install_gem_from_spec'\r\nX:/tools/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/installer.rb:287:in `block in install_in_parallel'\r\nX:/tools/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/worker.rb:55:in `call'\r\nX:/tools/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/worker.rb:55:in `apply_func'\r\nX:/tools/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/worker.rb:50:in `block in process_queue'\r\nX:/tools/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/worker.rb:47:in `loop'\r\nX:/tools/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/worker.rb:47:in `process_queue'\r\nX:/tools/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/worker.rb:22:in `block (2 levels) in initialize'\r\n...\r\n```\r\n\r\n..however, it does not reveal any details about the failed gem. For example, this is how the 2nd pass (that I started with the --verbose flag) ended:\r\n```\r\n...\r\nInstalling win32console 1.3.2\r\n14:  win32console (1.3.2) from X:/home/.gem/ruby/2.2.0/specifications/win32console-1.3.2.gemspec\r\nInstalling hitimes 1.2.2\r\n5:  hitimes (1.2.2) from X:/home/.gem/ruby/2.2.0/specifications/hitimes-1.2.2.gemspec\r\nInstalling libyajl2 1.2.0\r\n7:  libyajl2 (1.2.0) from X:/home/.gem/ruby/2.2.0/specifications/libyajl2-1.2.0.gemspec\r\nInstalling json 1.8.2\r\n12:  json (1.8.2) from X:/home/.gem/ruby/2.2.0/specifications/json-1.8.2.gemspec\r\nAn error occurred while installing addressable (2.3.8), and Bundler cannot\r\ncontinue.\r\nMake sure that `gem install addressable -v '2.3.8'` succeeds before bundling.\r\n```\r\n\r\nIt's probably not an original bundler issue either. I had tried with differerent bundler versions as well, but it did not have any effect. The Ruby version was the crucial factor (2.0 works, 2.1 + 2.2 fail). \r\n\r\nHowever, since it happens in the context of bundler I thought it makes sense to report it here.\r\n\r\nAny ideas?"},"comment":{"url":"https://api.github.com/repos/bundler/bundler/issues/comments/89471174","html_url":"https://github.com/bundler/bundler/issues/3545#issuecomment-89471174","issue_url":"https://api.github.com/repos/bundler/bundler/issues/3545","id":89471174,"user":{"login":"tknerr","id":365744,"avatar_url":"https://avatars.githubusercontent.com/u/365744?v=3","gravatar_id":"","url":"https://api.github.com/users/tknerr","html_url":"https://github.com/tknerr","followers_url":"https://api.github.com/users/tknerr/followers","following_url":"https://api.github.com/users/tknerr/following{/other_user}","gists_url":"https://api.github.com/users/tknerr/gists{/gist_id}","starred_url":"https://api.github.com/users/tknerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tknerr/subscriptions","organizations_url":"https://api.github.com/users/tknerr/orgs","repos_url":"https://api.github.com/users/tknerr/repos","events_url":"https://api.github.com/users/tknerr/events{/privacy}","received_events_url":"https://api.github.com/users/tknerr/received_events","type":"User","site_admin":false},"created_at":"2015-04-04T00:15:17Z","updated_at":"2015-04-04T00:15:17Z","body":"Reported the bug in ruby core here:\r\nhttps://bugs.ruby-lang.org/issues/11033"}}