google-cloud-ruby: Segmentation fault on stackdriver + ruby 2.5 + rails

I got segmentation fault when using stackdriver gem with rails application

ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] rails 5.2.1

The app is deployed on unicorn

/home/admin/.rbenv/versions/2.5.1/lib/ruby/2.5.0/monitor.rb:147: [BUG] Segmentation fault at 0x000000000000003c
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0077 p:---- s:0537 e:000536 CFUNC  :broadcast
c:0076 p:0015 s:0533 e:000532 METHOD /home/admin/.rbenv/versions/2.5.1/lib/ruby/2.5.0/monitor.rb:147
c:0075 p:0007 s:0529 e:000528 BLOCK  /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/google-cloud-logging-1.5.4/lib/google/cloud/logging/async_writer.rb
c:0074 p:0007 s:0526 e:000525 METHOD /home/admin/.rbenv/versions/2.5.1/lib/ruby/2.5.0/monitor.rb:226
c:0073 p:0005 s:0522 e:000521 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/google-cloud-logging-1.5.4/lib/google/cloud/logging/async_writer.rb
c:0072 p:0004 s:0518 e:000517 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/stackdriver-core-1.3.2/lib/stackdriver/core/async_actor.rb:344
c:0071 p:0060 s:0514 e:000513 BLOCK  /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/stackdriver-core-1.3.2/lib/stackdriver/core/async_actor.rb:312 [FINISH]
c:0070 p:---- s:0511 e:000510 CFUNC  :synchronize
c:0069 p:0022 s:0507 e:000506 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/stackdriver-core-1.3.2/lib/stackdriver/core/async_actor.rb:306
c:0068 p:0004 s:0503 e:000502 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/google-cloud-logging-1.5.4/lib/google/cloud/logging/async_writer.rb
c:0067 p:0120 s:0494 e:000493 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/google-cloud-logging-1.5.4/lib/google/cloud/logging/logger.rb:553
c:0066 p:0079 s:0485 e:000484 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/google-cloud-logging-1.5.4/lib/google/cloud/logging/logger.rb:317
c:0065 p:0031 s:0478 e:000477 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/google-cloud-logging-1.5.4/lib/google/cloud/logging/logger.rb:211
c:0064 p:0032 s:0472 e:000471 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/rack/logger.rb:37
c:0063 p:0009 s:0462 e:000461 BLOCK  /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/rack/logger.rb:26
c:0062 p:0004 s:0459 e:000458 BLOCK  /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/tagged_logging.rb:71
c:0061 p:0013 s:0456 e:000455 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/tagged_logging.rb:28
c:0060 p:0012 s:0450 e:000449 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/tagged_logging.rb:71
c:0059 p:0041 s:0445 e:000444 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/rack/logger.rb:26
c:0058 p:0092 s:0439 e:000438 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/newrelic_rpm-5.4.0.347/lib/new_relic/agent/instrumentation/middlewa
c:0057 p:0049 s:0430 e:000429 METHOD /home/admin/rails_app/shared/bundle/ruby/2.5.0/gems/google-cloud-logging-1.5.4/lib/google/cloud/logging/middleware.rb:9

full log: https://gist.github.com/uiureo/ba3cd795134dfec41410d92f801323d4

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (12 by maintainers)

Most upvoted comments

@axalix this works for me:

apk add build-base
gem install google-cloud-logging --platform ruby

I’ve tried the latest version of the gem, and it works perfectly in our environment with ruby 2.5.3 + rails 5.2.2. I don’t run into this problem anymore.

Thanks!

Hi, I’m facing the same segmentation issue on GAE, I’m able to deploy and run my migrations (via the appengine gem) without any issues, but it responds with a 503 when trying to access it.

The app is running on Ruby 2.5.3 and Rails 5.2.0, appengine 0.4.6

Logs and Gemfile.lock are available in this gist: https://gist.github.com/paulpyrb/1161a24ba970391a2f8a94f85207a494

@blowmage I tried the workaround you’ve linked above by adding BUNDLE_FORCE_RUBY_PLATFORM as a variable in my app.yaml file, but it didn’t fix the issue.

entrypoint: bundle exec rackup --port $PORT
env: flex
runtime: ruby

env_variables:
  BUNDLE_FORCE_RUBY_PLATFORM: 1 # segmentation fix

beta_settings:
  cloud_sql_instances:

Later edit: Adding require: false for the appengine gem fixes the segmentation issue for me.

@uiureo Thank you for the detailed information. We will look into this.