Skip to content

Instantly share code, notes, and snippets.

@elizabrock elizabrock/original_issue.md Secret
Created Apr 7, 2014

Embed
What would you like to do?
The heroku support issue.

SSL issues causing seg fault.

It appears that there is an issue with the linux ssl libraries on my dyno. If you go to inquizator.herokuapp.com and click "Sign In with Github" the callback causes a segmentation fault. The source appears to be an ssl error because due to attempting to download the github avatar. An example URL: "https://avatars3.githubusercontent.com/u/55660?s=460". You can see this segmentation fault in the logs.

I believe that the source of this issue is in the dyno itself (rather than ruby/rails), due in part to the following portions of the backtrace:

2014-04-06T17:50:51.319451+00:00 app[web.1]: /app/vendor/ruby-2.1.1/lib/ruby/2.1.0/net/http.rb:920: [BUG] Segmentation fault at 0x00000000000000
2014-04-06T17:50:51.319451+00:00 app[web.1]: ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
2014-04-06T17:50:51.319451+00:00 app[web.1]: 
2014-04-06T17:50:51.319451+00:00 app[web.1]: -- Control frame information -----------------------------------------------
2014-04-06T17:50:51.319451+00:00 app[web.1]: c:0132 p:---- s:0699 e:000698 CFUNC  :connect
2014-04-06T17:50:51.319451+00:00 app[web.1]: c:0131 p:0008 s:0696 e:000695 BLOCK  /app/vendor/ruby-2.1.1/lib/ruby/2.1.0/net/http.rb:920
2014-04-06T17:50:51.336398+00:00 app[web.1]: -- C level backtrace information -------------------------------------------
2014-04-06T17:50:51.340260+00:00 app[web.1]: ruby(+0x16861a) [0x7ff9eff9361a]
2014-04-06T17:50:51.340260+00:00 app[web.1]: ruby(+0x1c919c) [0x7ff9efff419c]
2014-04-06T17:50:51.340260+00:00 app[web.1]: ruby(rb_bug+0xb8) [0x7ff9efff44a8]
2014-04-06T17:50:51.340260+00:00 app[web.1]: ruby(+0xe7429) [0x7ff9eff12429]
2014-04-06T17:50:51.341001+00:00 app[web.1]: /lib/libpthread.so.0(+0xf8f0) [0x7ff9ef9fb8f0]
2014-04-06T17:50:51.341001+00:00 app[web.1]: /lib/libc.so.6(+0x129e12) [0x7ff9eeec7e12]
2014-04-06T17:50:51.341001+00:00 app[web.1]: ruby(rb_str_cat2+0x1c) [0x7ff9eff272cc]
2014-04-06T17:50:51.341800+00:00 app[web.1]: /app/vendor/ruby-2.1.1/lib/ruby/2.1.0/x86_64-linux/openssl.so(+0x1cfee) [0x7ff9ec8cffee] ossl.c:317
2014-04-06T17:50:51.341800+00:00 app[web.1]: /app/vendor/ruby-2.1.1/lib/ruby/2.1.0/x86_64-linux/openssl.so(ossl_raise+0x88) [0x7ff9ec8d0138] ossl.c:337
2014-04-06T17:50:51.342571+00:00 app[web.1]: /app/vendor/ruby-2.1.1/lib/ruby/2.1.0/x86_64-linux/openssl.so(+0x2f8a7) [0x7ff9ec8e28a7] ossl_ssl.c:1288

If you curl by shelling out of ruby from your local machine, you'll see something like:

elizabrock@Elizas-MacBook-Pro-2:~/Projects/coursewareofthefuture(master)$ irb
2.1.1 :001 > `curl -i https://avatars3.githubusercontent.com/u/55660?s=460`
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 33434  100 33434    0     0  25207      0  0:00:01  0:00:01 --:--:-- 25214
 => "HTTP/1.1 200 OK [the rest of the image encoded]

If you do the same from within the heroku console, you get an ssl error:

elizabrock@Elizas-MacBook-Pro-2:~/Projects/coursewareofthefuture(master)$ heroku run rails c
Running `rails c` attached to terminal... up, run.4614
Loading production environment (Rails 4.0.4)
irb(main):001:0> `curl -i https://avatars3.githubusercontent.com/u/55660?s=460`

curl: (35) error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112)
=> ""

Further investigation seems to indicate that it's an issue in negotiating the ssl version.

If I specify the version of SSL to use, curl is able to successfully download the image. Take a look at this:

elizabrock@Elizas-MacBook-Pro-2:~/Projects/coursewareofthefuture(master)$ heroku run rails c --app coursewareofthefuture
Running `rails c` attached to terminal... up, run.1614
Loading production environment (Rails 4.0.4)
irb(main):001:0> `curl -i https://avatars3.githubusercontent.com/u/55660?s=460`

curl: (35) error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112)
=> ""
irb(main):002:0> `openssl version`
=> "OpenSSL 0.9.8k 25 Mar 2009\n"
irb(main):003:0> `curl -i https://avatars2.githubusercontent.com/u/55660?s=460 --sslv3`
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 33434  100 33434    0     0  31092      0  0:00:01  0:00:01 --:--:-- 32024

Locally I'm running openssl 0.9.8y, which is 4 years newer than the version running on Heroku (0.9.8.k). I suspect that is the root of the issue.

elizabrock@Elizas-MacBook-Pro-2:~/Projects/coursewareofthefuture(master)$ openssl version
OpenSSL 0.9.8y 5 Feb 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.