fastlane: `cert` and / or `sigh` fails with error: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A

Issue Description

We’ve started to get weird SSL errors when running Fastlane via Jenkins:

SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A
  • We use Fastlane with Jenkins for deploying various apps, and all of them exhibit the same problem.
  • In the log the problem happens in the cert step, but sometimes it happens in the sigh step.
  • When running Fastlane manually from the command line it works most of the time, but not always.
  • I’ve read that this might be related to RVM, but we’re not using RVM or any other Ruby environment manager. I also tried updating OpenSSL, as some have suggested as a workaround for similar issues.
  • Logging in and fetching profiles seems to take extremely long, multiple minutes.
  • I’m surprised to see Fastlane using SSLv2/v3 to connect to Apples servers. I thought they were TSLv1.2 only?
Complete output when running fastlane, including the stack trace and command used
fastlane hockey --verbose
DEBUG [2016-07-18 12:03:41.72]: Checking if there are any plugins that should be loaded...
INFO [2016-07-18 12:03:41.85]: -------------------------------------------------
INFO [2016-07-18 12:03:41.85]: --- Step: Verifying required fastlane version ---
INFO [2016-07-18 12:03:41.85]: -------------------------------------------------
INFO [2016-07-18 12:03:41.85]: fastlane version valid
INFO [2016-07-18 12:03:41.88]: ------------------------------
INFO [2016-07-18 12:03:41.88]: --- Step: default_platform ---
INFO [2016-07-18 12:03:41.88]: ------------------------------
INFO [2016-07-18 12:03:41.92]: Driving the lane 'ios hockey' 🚀
INFO [2016-07-18 12:03:42.02]: ------------------
INFO [2016-07-18 12:03:42.02]: --- Step: cert ---
INFO [2016-07-18 12:03:42.02]: ------------------

+---------------+--------------------------------------------------------+
|                         Summary for cert 1.4.1                         |
+---------------+--------------------------------------------------------+
| development   | false                                                  |
| force         | false                                                  |
| username      | xserver.ci@myCompany.de                                     |
| team_id       | RCURWWDFZV                                             |
| keychain_path | /Users/Shared/Jenkins/Library/Keychains/login.keychain |
+---------------+--------------------------------------------------------+

INFO [2016-07-18 12:03:42.91]: Starting login with user 'xserver.ci@myCompany.de'
INFO [2016-07-18 12:04:45.60]: ---------------------
INFO [2016-07-18 12:04:45.60]: --- Step: hipchat ---
INFO [2016-07-18 12:04:45.60]: ---------------------
WARN [2016-07-18 12:04:46.46]: Variable Dump:
INFO [2016-07-18 12:04:46.46]: {:DEFAULT_PLATFORM=>:ios, :PLATFORM_NAME=>:ios, :LANE_NAME=>"ios hockey"}
ERROR [2016-07-18 12:04:46.46]: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A
INFO [2016-07-18 12:04:46.46]: Successfully generated documentation to path '/Users/Shared/Jenkins/slave1/workspace/myApp_hockey/fastlane/README.md'

+------+-------------------------------------+-------------+
|                     fastlane summary                     |
+------+-------------------------------------+-------------+
| Step | Action                              | Time (in s) |
+------+-------------------------------------+-------------+
| 1    | Verifying required fastlane version | 0           |
| 2    | default_platform                    | 0           |
| 3    | cert                                | 63          |
| 4    | hipchat                             | 0           |
+------+-------------------------------------+-------------+

ERROR [2016-07-18 12:04:46.47]: fastlane finished with errors

Looking for related GitHub issues on fastlane/fastlane...
Search query: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A

URL: https://api.github.com/search/issues?q=SSL_connect%20SYSCALL%20returned=5%20errno=0%20state=SSLv2/v3%20read%20server%20hello%20A+repo:fastlane/fastlane
➡️  Intermittent SSL errors
   https://github.com/fastlane/fastlane/issues/2075 [closed] 35 💬
   4 weeks ago

/Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/net/http.rb:918:in `connect': [!] SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A (Faraday::SSLError)
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/net/http.rb:918:in `block in connect'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/net/http.rb:918:in `connect'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/net/http.rb:851:in `start'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/net/http.rb:1367:in `request'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:82:in `perform_request'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/faraday-cookie_jar-0.0.6/lib/faraday/cookie_jar.rb:22:in `call'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response_middleware.rb:30:in `call'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response_middleware.rb:30:in `call'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response_middleware.rb:30:in `call'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/faraday-0.9.2/lib/faraday/connection.rb:177:in `post'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/spaceship-0.27.2/lib/spaceship/client.rb:411:in `block in send_request'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/spaceship-0.27.2/lib/spaceship/client.rb:329:in `with_retry'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/spaceship-0.27.2/lib/spaceship/client.rb:410:in `send_request'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/spaceship-0.27.2/lib/spaceship/client.rb:386:in `request'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/spaceship-0.27.2/lib/spaceship/portal/portal_client.rb:51:in `teams'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/spaceship-0.27.2/lib/spaceship/portal/ui/select_team.rb:35:in `select_team'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/spaceship-0.27.2/lib/spaceship/portal/portal_client.rb:73:in `select_team'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/spaceship-0.27.2/lib/spaceship/portal/spaceship.rb:37:in `select_team'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/spaceship-0.27.2/lib/spaceship/portal/spaceship.rb:81:in `select_team'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/cert-1.4.1/lib/cert/runner.rb:18:in `login'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/cert-1.4.1/lib/cert/runner.rb:27:in `run'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/cert-1.4.1/lib/cert/runner.rb:6:in `launch'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/actions/cert.rb:19:in `run'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/runner.rb:197:in `block (2 levels) in execute_action'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/actions/actions_helper.rb:35:in `execute_action'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/runner.rb:182:in `block in execute_action'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/runner.rb:181:in `chdir'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/runner.rb:181:in `execute_action'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/runner.rb:107:in `trigger_action_by_name'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/fast_file.rb:140:in `method_missing'
    from Fastfile:94:in `block (2 levels) in parsing_binding'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/lane.rb:33:in `call'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/lane.rb:33:in `call'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/runner.rb:50:in `block in execute'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/runner.rb:46:in `chdir'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/runner.rb:46:in `execute'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/lane_manager.rb:46:in `cruise_lane'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/command_line_handler.rb:30:in `handle'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/commands_generator.rb:51:in `block (2 levels) in run'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/commander-4.3.5/lib/commander/command.rb:178:in `call'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/commander-4.3.5/lib/commander/command.rb:178:in `call'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/commander-4.3.5/lib/commander/command.rb:153:in `run'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/commander-4.3.5/lib/commander/runner.rb:428:in `run_active_command'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane_core-0.48.1/lib/fastlane_core/ui/fastlane_runner.rb:26:in `run!'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/commander-4.3.5/lib/commander/delegates.rb:15:in `run!'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/commands_generator.rb:244:in `run'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/commands_generator.rb:20:in `start'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/lib/fastlane/cli_tools_distributor.rb:47:in `take_off'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/fastlane-1.97.2/bin/fastlane:5:in `<top (required)>'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/bin/fastlane:22:in `load'
    from /Users/Shared/Jenkins/.rbenv/versions/2.0.0-p481/bin/fastlane:22:in `<main>'

Configuration Files

Please copy the complete content of your Fastfile and any other configuration files you use below:

Fastfile:

def pods
  # change to root directory and install pods
  # needs to be in root dir to successfully run post_install task (copy acknowledgements to app settings)
  system "cd ..;pod install 2<&1"
end

def deploymate
  # run deploymate
  system '/Applications/Deploymate.app/Contents/MacOS/Deploymate --cli -t myApp ../myApp.xcworkspace -x -v'
end

def sign_all_the_things (app_identifier)

    #https://github.com/fastlane/fastlane/blob/master/docs/CodeSigning.md
    sigh(app_identifier: "#{app_identifier}.watchkitapp.watchkitext")
    ENV["PROFILE_WATCHKIT_EXT"] = lane_context[SharedValues::SIGH_UDID]

    sigh(app_identifier: "#{app_identifier}.watchkitapp")
    ENV["PROFILE_WATCHKIT_APP"] = lane_context[SharedValues::SIGH_UDID]

    sigh(app_identifier: "#{app_identifier}")
    ENV["PROFILE_APP"] = lane_context[SharedValues::SIGH_UDID]
end

def config ()
  ENV["HIPCHAT_API_TOKEN"] = "1234"
  ENV["HIPCHAT_API_VERSION"] = "1"

  scheme = "myApp"

  configuration = "Develop"
  hockey_public_id = "1234"

  if ENV["FASTLANE_LANE_NAME"] == "testflight"
    configuration = "Release"
    hockey_public_id = "1234"
  end 

  ENV["SCAN_SCHEME"] = scheme
  ENV["SCAN_CONFIGURATION"] = configuration
  ENV["SCAN_CLEAN"] = "true"

  ENV["GYM_SCHEME"] = scheme
  ENV["GYM_CONFIGURATION"] = configuration

  ENV["FL_HOCKEY_API_TOKEN"] = "1234"
  ENV["FL_HOCKEY_PUBLIC_IDENTIFIER"] = hockey_public_id
  ENV["FL_HOCKEY_REPOSITORY_URL"] = `git config --get remote.origin.url`
  ENV["FL_HOCKEY_COMMIT_SHA"] = `git log --format="%H" -n 1`

  ENV["PILOT_SKIP_SUBMISSION"] = "true"
  ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"] = "-t DAV"

  build_number = `git rev-list HEAD | wc -l | tr -d ' ' | tr -d '\n'`
  ENV["GIT_TAG"] = "#{ENV['FASTLANE_LANE_NAME']}/#{build_number}"
end

fastlane_version "1.37.0"

default_platform :ios

platform :ios do
  before_all do
    config
  end

  desc "Clean"
  lane :clean do 
    `rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"`
    `rm -rf ~/Library/Developer/Xcode/DerivedData`
    `rm -rf ~/Library/Caches/com.apple.dt.Xcode`
    `git clean -xdf`
  end

  desc "Build"
  lane :build do
    # run pod install
    pods

    # run deploymate
    deploymate

    # run tests
    scan

    # build the ipa
    gym
  end

  desc "Develop: Build, Test, Sign and upload to HockeyApp"
  lane :hockey do
    cert

    sign_all_the_things "de.myCompany.myApp"

    build

    hockey
  end

  desc "Release: Build, Test, Sign and upload to Testflight"
  lane :testflight do
    cert

    sign_all_the_things "com.myApp.myApp"

    build

    pilot

    hockey(upload_dsym_only: true)

    add_git_tag(tag: ENV["GIT_TAG"])
    push_git_tags

  end

  after_all do |lane|
    hipchat({channel: "myApp", message: "#{lane}: Build successful", success: true });
  end

  error do |lane, exception|
    hipchat({channel: "myApp", message: "#{lane}: Build failed with error #{exception}", success: false });
  end
end

Environment

fastlane version (run fastlane -v): 1.97.2

Do you use bundler to execute fastlane (i.e. bundle exec fastlane)? nope

Do you use a Ruby environment manager (e.g. chruby, rbenv, rvm)? nope

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (5 by maintainers)

Most upvoted comments

@mcapelle Thanks for letting me know. Yes, we’ve seen some issues with system ruby lately. We are looking into a longer term plan for this. Thanks!

I am almost certain now that this is an issue caused by having ruby 2.0.0 in combination with Apple recently dropping SSL in favor of TLS. Testing this now.

have this problem. please help in time delivery

Same as @teeqemm, it magically started working again. I guess it was a problem with Apples servers.

Hm, is it possible to make those error messages more helpful? Or would i have to submit an issue to the faraday (that’s the library throwing the error, right?) project?

@TKBurner keychain was/is unlocked… anyway, now it is working again without any changes on my side. Maybe this was a temporary issue on Apple’s side?

@KrauseFx Yes, updated OpenSSL from 0.9.8 to 1.0.2.

@TKBurner I did update fastlane (i usually run update on everything that seems related when these kind of things happen). Will try the keychain unlock first thing in the morning.