tmm1 / stackprof

a sampling call-stack profiler for ruby 2.2+
MIT License
2.08k stars 128 forks source link

Segmentation fault on Ruby 2.7.6p219 #185

Open ms-ati opened 2 years ago

ms-ati commented 2 years ago

Calling rack-mini-profiler with the ?pp=flamegraph, this used to work well on earlier Ruby versions.

/usr/packages/ruby-2.7.6/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/route_set.rb:176: [BUG] Segmentation fault at 0x0000000011110003
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0110 p:0014 s:0841 e:000839 BLOCK  /app/config/routes.rb:195
c:0109 p:0288 s:0837 e:000836 METHOD /usr/packages/ruby-2.7.6/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/mapper.rb:901
c:0108 p:0269 s:0828 e:000827 BLOCK  /app/config/routes.rb:191 [FINISH]
c:0107 p:---- s:0825 e:000824 CFUNC  :instance_exec
c:0106 p:0037 s:0821 e:000820 METHOD /usr/packages/ruby-2.7.6/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/route_set.rb:427
c:0105 p:0015 s:0815 e:000814 METHOD /usr/packages/ruby-2.7.6/gems/actionpack-6.1.5.1/lib/action_dispatch/routing/route_set.rb:409
c:0104 p:0028 s:0810 E:001230 TOP    /app/config/routes.rb:7 [FINISH]
c:0103 p:---- s:0807 e:000806 CFUNC  :load
c:0102 p:0009 s:0801 e:000800 BLOCK  /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/dependencies.rb:326
c:0101 p:0068 s:0798 e:000797 METHOD /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/dependencies.rb:299
c:0100 p:0014 s:0791 e:000790 METHOD /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/dependencies.rb:326
c:0099 p:0006 s:0784 e:000783 BLOCK  /usr/packages/ruby-2.7.6/gems/railties-6.1.5.1/lib/rails/application/routes_reloader.rb:47 [FINISH]
c:0098 p:---- s:0780 e:000779 CFUNC  :each
c:0097 p:0006 s:0776 e:000775 METHOD /usr/packages/ruby-2.7.6/gems/railties-6.1.5.1/lib/rails/application/routes_reloader.rb:47
c:0096 p:0007 s:0772 e:000771 METHOD /usr/packages/ruby-2.7.6/gems/railties-6.1.5.1/lib/rails/application/routes_reloader.rb:21
c:0095 p:0004 s:0768 e:000767 BLOCK  /usr/packages/ruby-2.7.6/gems/railties-6.1.5.1/lib/rails/application/routes_reloader.rb:35
c:0094 p:0020 s:0765 e:000764 METHOD /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/file_update_checker.rb:83
c:0093 p:0017 s:0761 e:000760 METHOD /usr/packages/ruby-2.7.6/gems/railties-6.1.5.1/lib/rails/application/routes_reloader.rb:10
c:0092 p:0009 s:0753 e:000752 BLOCK  /usr/packages/ruby-2.7.6/gems/railties-6.1.5.1/lib/rails/application/finisher.rb:208 [FINISH]
c:0091 p:---- s:0750 e:000749 CFUNC  :instance_exec
c:0090 p:0034 s:0746 e:000745 BLOCK  /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/callbacks.rb:427
c:0089 p:0010 s:0738 e:000737 BLOCK  /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/callbacks.rb:198
c:0088 p:0005 s:0735 e:000734 BLOCK  /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/callbacks.rb:604 [FINISH]
c:0087 p:---- s:0732 e:000731 CFUNC  :catch
c:0086 p:0011 s:0727 e:000726 BLOCK  /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/callbacks.rb:603
c:0085 p:0040 s:0721 E:001e78 BLOCK  /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/callbacks.rb:199
c:0084 p:0007 s:0712 e:000711 BLOCK  /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/callbacks.rb:512 [FINISH]
c:0083 p:---- s:0708 e:000707 CFUNC  :each
c:0082 p:0006 s:0704 e:000703 METHOD /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/callbacks.rb:512
c:0081 p:0066 s:0699 e:000698 METHOD /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/callbacks.rb:105
c:0080 p:0025 s:0690 e:000689 METHOD /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/execution_wrapper.rb:114
c:0079 p:0004 s:0686 e:000685 METHOD /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/reloader.rb:114
c:0078 p:0008 s:0682 e:000681 BLOCK  /usr/packages/ruby-2.7.6/gems/activesupport-6.1.5.1/lib/active_support/execution_wrapper.rb:77 [FINISH]
c:0077 p:---- s:0677 e:000676 CFUNC  :tap

... (goes on) ...

This crash is observed in a Docker container with the following underlying Linux system:

$ uname -a

Linux e095b352e16a 5.10.109-0-virt #1-Alpine SMP Mon, 28 Mar 2022 11:20:52 +0000 x86_64 x86_64 x86_64 GNU/Linux

$ ldd --version

ldd (Ubuntu GLIBC 2.27-3ubuntu1.6) 2.27
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:    18.04
Codename:   bionic
ms-ati commented 2 years ago

See also #182

ms-ati commented 2 years ago

Reported also to Ruby-lang Bugs as Ruby issue 18967

ms-ati commented 2 years ago

Rails: 6.1.5.1 Puma: 5.6.4

eregon commented 2 years ago

I think we can close this, https://github.com/tmm1/stackprof/pull/186 should fix it.