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

NoMethodError: undefined method '_stack_table' for nil #2525

Closed
pil0u opened this issue Jan 26, 2025 · 14 comments · Fixed by #2528
Closed

NoMethodError: undefined method '_stack_table' for nil #2525

pil0u opened this issue Jan 26, 2025 · 14 comments · Fixed by #2528
Assignees

Comments

@pil0u
Copy link

pil0u commented Jan 26, 2025

Issue Description

Disclaimer: I am very unfamiliar with profiling, for context I am plugging Sentry to a new side project and saw this new feature and decided to enable it.

I just setup vernier for my profiling on a new, simple Rails app. My app runs background jobs (via solid_queue), including cron jobs. Some of the cron jobs (not all of them) return this internal error from Vernier. Weirdly, trying to re-run them from MissionControl, again, sometimes it fails, sometimes it passes.

It is not blocking anything on my side at the moment. I will monitor this to share some numbers, but if you already have some questions or ideas at what I should look at to help, let me know.

Note that this error is not reported by Sentry in the issue tracker.

Example of a full stack trace:

/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-ruby-5.22.1/lib/sentry/vernier/output.rb:85:in 'Sentry::Vernier::Output#stack_table_hash'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-ruby-5.22.1/lib/sentry/vernier/output.rb:57:in 'Sentry::Vernier::Output#frames'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-ruby-5.22.1/lib/sentry/vernier/output.rb:22:in 'Sentry::Vernier::Output#to_h'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-ruby-5.22.1/lib/sentry/vernier/profiler.rb:99:in 'Sentry::Vernier::Profiler#to_hash'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-ruby-5.22.1/lib/sentry/transaction_event.rb:63:in 'Sentry::TransactionEvent#populate_profile'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-ruby-5.22.1/lib/sentry/transaction_event.rb:40:in 'Sentry::TransactionEvent#initialize'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-ruby-5.22.1/lib/sentry/client.rb:174:in 'Class#new'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-ruby-5.22.1/lib/sentry/client.rb:174:in 'Sentry::Client#event_from_transaction'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-ruby-5.22.1/lib/sentry/transaction.rb:263:in 'Sentry::Transaction#finish'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-rails-5.22.1/lib/sentry/rails/active_job.rb:66:in 'Sentry::Rails::ActiveJobExtensions::SentryReporter.finish_sentry_transaction'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-rails-5.22.1/lib/sentry/rails/active_job.rb:47:in 'block in Sentry::Rails::ActiveJobExtensions::SentryReporter.record'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-ruby-5.22.1/lib/sentry/hub.rb:59:in 'Sentry::Hub#with_scope'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-ruby-5.22.1/lib/sentry-ruby.rb:396:in 'Sentry.with_scope'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-rails-5.22.1/lib/sentry/rails/active_job.rb:26:in 'Sentry::Rails::ActiveJobExtensions::SentryReporter.record'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/sentry-rails-5.22.1/lib/sentry/rails/active_job.rb:10:in 'Sentry::Rails::ActiveJobExtensions#perform_now'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/activejob-8.0.1/lib/active_job/execution.rb:29:in 'block in ActiveJob::Execution::ClassMethods#execute'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/activesupport-8.0.1/lib/active_support/callbacks.rb:120:in 'block in ActiveSupport::Callbacks#run_callbacks'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/activejob-8.0.1/lib/active_job/railtie.rb:95:in 'block (4 levels) in <class:Railtie>'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/activesupport-8.0.1/lib/active_support/reloader.rb:77:in 'block in ActiveSupport::Reloader.wrap'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/activesupport-8.0.1/lib/active_support/execution_wrapper.rb:87:in 'ActiveSupport::ExecutionWrapper.wrap'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/activesupport-8.0.1/lib/active_support/reloader.rb:74:in 'ActiveSupport::Reloader.wrap'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/activejob-8.0.1/lib/active_job/railtie.rb:94:in 'block (3 levels) in <class:Railtie>'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/activesupport-8.0.1/lib/active_support/callbacks.rb:129:in 'BasicObject#instance_exec'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/activesupport-8.0.1/lib/active_support/callbacks.rb:129:in 'block in ActiveSupport::Callbacks#run_callbacks'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/activesupport-8.0.1/lib/active_support/callbacks.rb:140:in 'ActiveSupport::Callbacks#run_callbacks'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/activejob-8.0.1/lib/active_job/execution.rb:27:in 'ActiveJob::Execution::ClassMethods#execute'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/solid_queue-1.1.2/app/models/solid_queue/claimed_execution.rb:95:in 'SolidQueue::ClaimedExecution#execute'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/solid_queue-1.1.2/app/models/solid_queue/claimed_execution.rb:61:in 'SolidQueue::ClaimedExecution#perform'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/solid_queue-1.1.2/lib/solid_queue/pool.rb:23:in 'block (2 levels) in SolidQueue::Pool#post'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/activesupport-8.0.1/lib/active_support/execution_wrapper.rb:91:in 'ActiveSupport::ExecutionWrapper.wrap'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/solid_queue-1.1.2/lib/solid_queue/app_executor.rb:7:in 'SolidQueue::AppExecutor#wrap_in_app_executor'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/solid_queue-1.1.2/lib/solid_queue/pool.rb:22:in 'block in SolidQueue::Pool#post'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24:in 'block in Concurrent::SafeTaskExecutor#execute'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:48:in 'block in Concurrent::Synchronization::MutexLockableObject#synchronize'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:48:in 'Thread::Mutex#synchronize'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:48:in 'Concurrent::Synchronization::MutexLockableObject#synchronize'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:22:in 'Concurrent::SafeTaskExecutor#execute'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/ivar.rb:170:in 'Concurrent::IVar#safe_execute'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/future.rb:55:in 'block in Concurrent::Future#execute'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:359:in 'Concurrent::RubyThreadPoolExecutor::Worker#run_task'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:350:in 'block (3 levels) in Concurrent::RubyThreadPoolExecutor::Worker#create_worker'
<internal:kernel>:168:in 'Kernel#loop'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:341:in 'block (2 levels) in Concurrent::RubyThreadPoolExecutor::Worker#create_worker'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:in 'Kernel#catch'
/Users/pierreloic/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:in 'block in Concurrent::RubyThreadPoolExecutor::Worker#create_worker'

Reproduction Steps

I'm having a hard time to reproduce, because it is not systematic.

Here is my Gemfile.lock:

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (8.0.1)
      actionpack (= 8.0.1)
      activesupport (= 8.0.1)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
      zeitwerk (~> 2.6)
    actionmailbox (8.0.1)
      actionpack (= 8.0.1)
      activejob (= 8.0.1)
      activerecord (= 8.0.1)
      activestorage (= 8.0.1)
      activesupport (= 8.0.1)
      mail (>= 2.8.0)
    actionmailer (8.0.1)
      actionpack (= 8.0.1)
      actionview (= 8.0.1)
      activejob (= 8.0.1)
      activesupport (= 8.0.1)
      mail (>= 2.8.0)
      rails-dom-testing (~> 2.2)
    actionpack (8.0.1)
      actionview (= 8.0.1)
      activesupport (= 8.0.1)
      nokogiri (>= 1.8.5)
      rack (>= 2.2.4)
      rack-session (>= 1.0.1)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.2)
      rails-html-sanitizer (~> 1.6)
      useragent (~> 0.16)
    actiontext (8.0.1)
      actionpack (= 8.0.1)
      activerecord (= 8.0.1)
      activestorage (= 8.0.1)
      activesupport (= 8.0.1)
      globalid (>= 0.6.0)
      nokogiri (>= 1.8.5)
    actionview (8.0.1)
      activesupport (= 8.0.1)
      builder (~> 3.1)
      erubi (~> 1.11)
      rails-dom-testing (~> 2.2)
      rails-html-sanitizer (~> 1.6)
    activejob (8.0.1)
      activesupport (= 8.0.1)
      globalid (>= 0.3.6)
    activemodel (8.0.1)
      activesupport (= 8.0.1)
    activerecord (8.0.1)
      activemodel (= 8.0.1)
      activesupport (= 8.0.1)
      timeout (>= 0.4.0)
    activestorage (8.0.1)
      actionpack (= 8.0.1)
      activejob (= 8.0.1)
      activerecord (= 8.0.1)
      activesupport (= 8.0.1)
      marcel (~> 1.0)
    activesupport (8.0.1)
      base64
      benchmark (>= 0.3)
      bigdecimal
      concurrent-ruby (~> 1.0, >= 1.3.1)
      connection_pool (>= 2.2.5)
      drb
      i18n (>= 1.6, < 2)
      logger (>= 1.4.2)
      minitest (>= 5.1)
      securerandom (>= 0.3)
      tzinfo (~> 2.0, >= 2.0.5)
      uri (>= 0.13.1)
    ast (2.4.2)
    base64 (0.2.0)
    benchmark (0.4.0)
    bigdecimal (3.1.9)
    bindex (0.8.1)
    blazer (3.1.0)
      activerecord (>= 6.1)
      chartkick (>= 5)
      csv
      railties (>= 7)
      safely_block (>= 0.4)
    bootsnap (1.18.4)
      msgpack (~> 1.2)
    brakeman (7.0.0)
      racc
    builder (3.3.0)
    chartkick (5.1.2)
    concurrent-ruby (1.3.5)
    connection_pool (2.5.0)
    crass (1.0.6)
    csv (3.3.2)
    date (3.4.1)
    debug (1.10.0)
      irb (~> 1.10)
      reline (>= 0.3.8)
    drb (2.2.1)
    erubi (1.13.1)
    et-orbi (1.2.11)
      tzinfo
    fugit (1.11.1)
      et-orbi (~> 1, >= 1.2.11)
      raabro (~> 1.4)
    globalid (1.2.1)
      activesupport (>= 6.1)
    i18n (1.14.7)
      concurrent-ruby (~> 1.0)
    importmap-rails (2.1.0)
      actionpack (>= 6.0.0)
      activesupport (>= 6.0.0)
      railties (>= 6.0.0)
    io-console (0.8.0)
    irb (1.15.1)
      pp (>= 0.6.0)
      rdoc (>= 4.0.0)
      reline (>= 0.4.2)
    jbuilder (2.13.0)
      actionview (>= 5.0.0)
      activesupport (>= 5.0.0)
    json (2.9.1)
    language_server-protocol (3.17.0.3)
    logger (1.6.5)
    loofah (2.24.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.12.0)
    mail (2.8.1)
      mini_mime (>= 0.1.1)
      net-imap
      net-pop
      net-smtp
    marcel (1.0.4)
    mini_mime (1.1.5)
    minitest (5.25.4)
    mission_control-jobs (1.0.1)
      actioncable (>= 7.1)
      actionpack (>= 7.1)
      activejob (>= 7.1)
      activerecord (>= 7.1)
      importmap-rails (>= 1.2.1)
      irb (~> 1.13)
      railties (>= 7.1)
      stimulus-rails
      turbo-rails
    msgpack (1.7.5)
    net-imap (0.5.5)
      date
      net-protocol
    net-pop (0.1.2)
      net-protocol
    net-protocol (0.2.2)
      timeout
    net-smtp (0.5.0)
    nio4r (2.7.4)
    nokogiri (1.18.2-aarch64-linux-gnu)
      racc (~> 1.4)
    nokogiri (1.18.2-aarch64-linux-musl)
      racc (~> 1.4)
    nokogiri (1.18.2-arm-linux-gnu)
      racc (~> 1.4)
    nokogiri (1.18.2-arm-linux-musl)
      racc (~> 1.4)
    nokogiri (1.18.2-arm64-darwin)
      racc (~> 1.4)
    nokogiri (1.18.2-x86_64-darwin)
      racc (~> 1.4)
    nokogiri (1.18.2-x86_64-linux-gnu)
      racc (~> 1.4)
    nokogiri (1.18.2-x86_64-linux-musl)
      racc (~> 1.4)
    parallel (1.26.3)
    parser (3.3.7.0)
      ast (~> 2.4.1)
      racc
    pg (1.5.9)
    pghero (3.6.1)
      activerecord (>= 6.1)
    pp (0.6.2)
      prettyprint
    prettyprint (0.2.0)
    propshaft (1.1.0)
      actionpack (>= 7.0.0)
      activesupport (>= 7.0.0)
      rack
      railties (>= 7.0.0)
    psych (5.2.3)
      date
      stringio
    puma (6.5.0)
      nio4r (~> 2.0)
    raabro (1.4.0)
    racc (1.8.1)
    rack (3.1.8)
    rack-session (2.1.0)
      base64 (>= 0.1.0)
      rack (>= 3.0.0)
    rack-test (2.2.0)
      rack (>= 1.3)
    rackup (2.2.1)
      rack (>= 3)
    rails (8.0.1)
      actioncable (= 8.0.1)
      actionmailbox (= 8.0.1)
      actionmailer (= 8.0.1)
      actionpack (= 8.0.1)
      actiontext (= 8.0.1)
      actionview (= 8.0.1)
      activejob (= 8.0.1)
      activemodel (= 8.0.1)
      activerecord (= 8.0.1)
      activestorage (= 8.0.1)
      activesupport (= 8.0.1)
      bundler (>= 1.15.0)
      railties (= 8.0.1)
    rails-dom-testing (2.2.0)
      activesupport (>= 5.0.0)
      minitest
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.6.2)
      loofah (~> 2.21)
      nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
    railties (8.0.1)
      actionpack (= 8.0.1)
      activesupport (= 8.0.1)
      irb (~> 1.13)
      rackup (>= 1.0.0)
      rake (>= 12.2)
      thor (~> 1.0, >= 1.2.2)
      zeitwerk (~> 2.6)
    rainbow (3.1.1)
    rake (13.2.1)
    rdoc (6.11.0)
      psych (>= 4.0.0)
    regexp_parser (2.10.0)
    reline (0.6.0)
      io-console (~> 0.5)
    rubocop (1.71.0)
      json (~> 2.3)
      language_server-protocol (>= 3.17.0)
      parallel (~> 1.10)
      parser (>= 3.3.0.2)
      rainbow (>= 2.2.2, < 4.0)
      regexp_parser (>= 2.9.3, < 3.0)
      rubocop-ast (>= 1.36.2, < 2.0)
      ruby-progressbar (~> 1.7)
      unicode-display_width (>= 2.4.0, < 4.0)
    rubocop-ast (1.37.0)
      parser (>= 3.3.1.0)
    rubocop-minitest (0.36.0)
      rubocop (>= 1.61, < 2.0)
      rubocop-ast (>= 1.31.1, < 2.0)
    rubocop-performance (1.23.1)
      rubocop (>= 1.48.1, < 2.0)
      rubocop-ast (>= 1.31.1, < 2.0)
    rubocop-rails (2.29.1)
      activesupport (>= 4.2.0)
      rack (>= 1.1)
      rubocop (>= 1.52.0, < 2.0)
      rubocop-ast (>= 1.31.1, < 2.0)
    rubocop-rails-omakase (1.0.0)
      rubocop
      rubocop-minitest
      rubocop-performance
      rubocop-rails
    ruby-progressbar (1.13.0)
    safely_block (0.4.1)
    securerandom (0.4.1)
    sentry-rails (5.22.1)
      railties (>= 5.0)
      sentry-ruby (~> 5.22.1)
    sentry-ruby (5.22.1)
      bigdecimal
      concurrent-ruby (~> 1.0, >= 1.0.2)
    solid_queue (1.1.2)
      activejob (>= 7.1)
      activerecord (>= 7.1)
      concurrent-ruby (>= 1.3.1)
      fugit (~> 1.11.0)
      railties (>= 7.1)
      thor (~> 1.3.1)
    stimulus-rails (1.3.4)
      railties (>= 6.0.0)
    stringio (3.1.2)
    strong_migrations (2.1.0)
      activerecord (>= 6.1)
    tailwindcss-rails (3.3.1)
      railties (>= 7.0.0)
      tailwindcss-ruby (~> 3.0)
    tailwindcss-ruby (3.4.17-aarch64-linux)
    tailwindcss-ruby (3.4.17-arm-linux)
    tailwindcss-ruby (3.4.17-arm64-darwin)
    tailwindcss-ruby (3.4.17-x86_64-darwin)
    tailwindcss-ruby (3.4.17-x86_64-linux)
    thor (1.3.2)
    thruster (0.1.10)
    thruster (0.1.10-aarch64-linux)
    thruster (0.1.10-arm64-darwin)
    thruster (0.1.10-x86_64-darwin)
    thruster (0.1.10-x86_64-linux)
    timeout (0.4.3)
    turbo-rails (2.0.11)
      actionpack (>= 6.0.0)
      railties (>= 6.0.0)
    tzinfo (2.0.6)
      concurrent-ruby (~> 1.0)
    unicode-display_width (3.1.4)
      unicode-emoji (~> 4.0, >= 4.0.4)
    unicode-emoji (4.0.4)
    uri (1.0.2)
    useragent (0.16.11)
    vernier (1.5.0)
    web-console (4.2.1)
      actionview (>= 6.0.0)
      activemodel (>= 6.0.0)
      bindex (>= 0.4.0)
      railties (>= 6.0.0)
    websocket-driver (0.7.7)
      base64
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    zeitwerk (2.7.1)

PLATFORMS
  aarch64-linux
  aarch64-linux-gnu
  aarch64-linux-musl
  arm-linux
  arm-linux-gnu
  arm-linux-musl
  arm64-darwin
  x86_64-darwin
  x86_64-linux
  x86_64-linux-gnu
  x86_64-linux-musl

DEPENDENCIES
  blazer
  bootsnap
  brakeman
  debug
  importmap-rails
  jbuilder
  mission_control-jobs
  pg (~> 1.1)
  pghero
  propshaft
  puma (>= 5.0)
  rails (~> 8.0.1)
  rubocop-rails-omakase
  sentry-rails
  sentry-ruby
  solid_queue
  stimulus-rails
  strong_migrations
  tailwindcss-rails
  thruster
  turbo-rails
  tzinfo-data
  vernier
  web-console

RUBY VERSION
   ruby 3.4.1p0

BUNDLED WITH
   2.6.3

Expected Behavior

Not having this vernier internal error

Actual Behavior

Getting sporadically this error, in dev and in prod.

Ruby Version

3.4.1

SDK Version

5.22.1

Integration and Its Version

Rails 8.0.1 + Solid Queue as ActiveJob backend

Sentry Config

Sentry.init do |config|
  config.dsn = Rails.application.credentials.dig(:sentry, :dsn)

  config.breadcrumbs_logger = [ :sentry_logger, :http_logger, :monotonic_active_support_logger ]
  config.debug = true
  config.traces_sample_rate = 1.0
  config.profiler_class = Sentry::Vernier::Profiler
  config.profiles_sample_rate = 1.0
end
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jan 26, 2025
@pil0u
Copy link
Author

pil0u commented Jan 27, 2025

I have updated to SDK version 5.22.2 with the same result.

Since then, I have a job that ran 46 times, and got that error 18 times. (39%)

Important note: while solid_queue shows the jobs as failed, the logic inside the jobs executed successfully. I basically get data from an API and insert rows in a table, and all 46 jobs inserted the data as expected. So the problem might occur towards the end of the job, I don't know, I have never used Vernier before.

Yet this is what I see in mission_control:

Image

@joaoamarals
Copy link

I encountered the same error, in development environment, with config.active_job.queue_adapter = :inline and config.profiler_class = Sentry::Vernier::Profiler. The error occurred when attempting to destroy a record with an attachment (ActiveStorage).

After some investigation, I identified the possible root causes:

  1. Sentry wraps requests in Sentry::Rails::CaptureExceptions, which starts a transaction. Within this transaction, an ActiveStorage::PurgeJob is triggered to handle the attachment deletion. This job, in turn, is wrapped by Sentry::Rails::ActiveJobExtensions, which starts another transaction.

  2. Both transactions attempt to start a profiler (in my case, Vernier). When the second transaction starts the profile, Vernier raises the error profile already started, stopping.... This happens because the @collector instance variable was already set by the first transaction. As a result, the profiler stops profiling, and the error is rescued in Sentry::Vernier::Profiler#start_profile.

  3. When the first transaction tries to finish, the error NoMethodError: undefined method '_stack_table' for nil is raised. This occurs because Sentry::Vernier::Profiler#result is unset. The result remains unset because Sentry::Vernier::Profiler#stop fails to set it. The failure in #stop happens due to the earlier profile not started error raised when Vernier attempted to start again profiling and the it was stopped prematurely.

I hope that could be useful for this thread.

@solnic solnic self-assigned this Jan 28, 2025
@solnic
Copy link
Collaborator

solnic commented Jan 28, 2025

Thanks for reporting this. Vernier runs globally and it cannot run in isolation on a per job basis. We can prevent it from being started again although that may turn out to be tricky. I'll give this a go and report back here.

@solnic
Copy link
Collaborator

solnic commented Jan 28, 2025

Got a potential fix here #2528

@zackkitzmiller
Copy link

We're running to this bug as well. Until this is released, is there a reasonable workaround?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jan 31, 2025
@pil0u
Copy link
Author

pil0u commented Feb 2, 2025

@zackkitzmiller I'm running on PostgreSQL so the syntax might differ depending on your database, but I created this simple job to purge errors of this nature:

class DeleteVernierErrorsJob < ApplicationJob
  def perform
    SolidQueue::FailedExecution
        .where("(error::jsonb)->>'message' = 'undefined method ''_stack_table'' for nil'")
        .delete_all
  end
end

@pil0u
Copy link
Author

pil0u commented Feb 2, 2025

@solnic I don't know if creating a new issue is required, I just want to point out that I get this message every time I open a rails console, or in the logs of my deployments:

Please make sure to include the 'stackprof' gem in your Gemfile to use Profiling with Sentry.

It is an order of magnitude less impactful, but looks related to Vernier integration as well. I suppose we shouldn't see this message if we plugged in Vernier instead of stackprof.

@solnic
Copy link
Collaborator

solnic commented Feb 3, 2025

@pil0u thanks, would you mind actually reporting an issue about this for tracking purposes? 🙏🏻

@pil0u
Copy link
Author

pil0u commented Feb 3, 2025

Created #2534

@solnic
Copy link
Collaborator

solnic commented Feb 3, 2025

We're running to this bug as well. Until this is released, is there a reasonable workaround?

@zackkitzmiller you could try adding this monkeypatch:

module SentryPatch
  def start_profile
    unless @collector
      super
    end
  end
end

module Vernier
  class << self
    prepend(SentryPatch)
  end
end

The spec from my PR is passing with this patch, FWIW 🙃

@zackkitzmiller
Copy link

@solnic Where should I throw this, I assume in the initializer before the configuration happens.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 3, 2025
@solnic
Copy link
Collaborator

solnic commented Feb 4, 2025

@solnic Where should I throw this, I assume in the initializer before the configuration happens.

yes that's a good place

@felixbuenemann
Copy link

@solnic I am still seeing the undefined method '_stack_table' for nil (NoMethodError) after adding that monkey patch and verified that it is properly loaded in the rails console.

@solnic
Copy link
Collaborator

solnic commented Feb 12, 2025

@felixbuenemann OK thanks for letting me know. I'll try to reproduce this in a spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants