Project

General

Profile

Actions

Bug #17536

closed

Segfault in `CFUNC :define_method`

Added by vo.x (Vit Ondruch) over 3 years ago. Updated about 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [s390x-linux]
[ruby-core:102065]

Description

Trying to run test suite of shoulda-matchers, I observe the following issue:

... snip ...

          if the given value is present in the store
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:317: [BUG] Segmentation fault at 0x0024b9040035c000
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [s390x-linux]
-- Control frame information -----------------------------------------------
c:0096 p:---- s:0560 e:000559 CFUNC  :define_method
c:0095 p:0028 s:0555 E:001db8 METHOD /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:317
c:0094 p:0128 s:0544 e:000543 METHOD /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:114
c:0093 p:0113 s:0535 e:000534 METHOD /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:586
c:0092 p:0222 s:0528 e:000527 METHOD /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:1956
c:0091 p:0064 s:0510 e:000509 METHOD /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:1927
c:0090 p:0066 s:0496 e:000495 BLOCK  /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:1891 [FINISH]
c:0089 p:---- s:0491 e:000490 CFUNC  :each
c:0088 p:0290 s:0487 e:000486 METHOD /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:1885
c:0087 p:0210 s:0473 e:000472 METHOD /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:1633
c:0086 p:0031 s:0463 e:000462 METHOD /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:751
c:0085 p:0011 s:0455 e:000454 METHOD /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:712
c:0084 p:0006 s:0449 e:000448 BLOCK  /usr/share/gems/gems/railties-6.0.3.4/lib/rails/application/finisher.rb:77 [FINISH]
c:0083 p:---- s:0446 e:000445 CFUNC  :instance_exec
c:0082 p:0037 s:0442 e:000441 METHOD /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:426
c:0081 p:0006 s:0436 e:000435 BLOCK  /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:443 [FINISH]
c:0080 p:---- s:0432 e:000431 CFUNC  :each
c:0079 p:0035 s:0428 e:000427 METHOD /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:443
c:0078 p:0008 s:0424 e:000423 METHOD /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:407
c:0077 p:0019 s:0419 e:000418 METHOD /builddir/build/BUILD/spec/support/unit/rails_application.rb:56
c:0076 p:0010 s:0414 e:000411 METHOD /builddir/build/BUILD/spec/support/unit/helpers/controller_builder.rb:19
c:0075 p:0075 s:0407 E:000828 METHOD /builddir/build/BUILD/spec/support/unit/helpers/controller_builder.rb:32
c:0074 p:0007 s:0398 E:0000d0 METHOD /builddir/build/BUILD/spec/support/unit/shared_examples/set_session_or_flash.rb:352
c:0073 p:0010 s:0392 e:000391 BLOCK  /builddir/build/BUILD/spec/support/unit/shared_examples/set_session_or_flash.rb:156 [FINISH]
c:0072 p:---- s:0386 e:000385 CFUNC  :instance_exec
c:0071 p:0015 s:0381 e:000380 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:262
c:0070 p:0003 s:0376 e:000375 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:508
c:0069 p:0003 s:0373 e:000372 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:465
c:0068 p:0003 s:0370 e:000369 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:486
c:0067 p:0003 s:0367 e:000366 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:626
c:0066 p:0018 s:0364 e:000363 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:350
c:0065 p:0040 s:0358 e:000357 BLOCK  /usr/share/gems/gems/rspec-rails-4.0.1/lib/rspec/rails/example/controller_example_group.rb:191 [FINISH]
c:0064 p:---- s:0353 e:000352 CFUNC  :instance_exec
c:0063 p:0013 s:0348 e:000347 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:455
c:0062 p:0010 s:0342 e:000341 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:390
c:0061 p:0010 s:0336 e:000335 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:628
c:0060 p:0018 s:0333 e:000332 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:350
c:0059 p:0009 s:0327 e:000326 BLOCK  /usr/share/gems/gems/rspec-rails-4.0.1/lib/rspec/rails/adapters.rb:75 [FINISH]
c:0058 p:---- s:0323 e:000322 CFUNC  :instance_exec
c:0057 p:0013 s:0318 e:000317 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:455
c:0056 p:0010 s:0312 e:000311 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:390
c:0055 p:0010 s:0306 e:000305 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:628
c:0054 p:0018 s:0303 e:000302 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:350
c:0053 p:0058 s:0297 E:002548 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:629
c:0052 p:0108 s:0290 E:000528 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:486
c:0051 p:0011 s:0283 E:0004b8 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:465
c:0050 p:0019 s:0278 E:001c48 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:508
c:0049 p:0111 s:0273 E:0024e8 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:259
c:0048 p:0044 s:0266 e:000265 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:644 [FINISH]
c:0047 p:---- s:0260 e:000259 CFUNC  :map
c:0046 p:0011 s:0256 e:000255 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:640
c:0045 p:0067 s:0251 e:000250 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:606
c:0044 p:0007 s:0242 e:000241 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607 [FINISH]
c:0043 p:---- s:0238 e:000237 CFUNC  :map
c:0042 p:0080 s:0234 e:000233 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607
c:0041 p:0007 s:0225 e:000224 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607 [FINISH]
c:0040 p:---- s:0221 e:000220 CFUNC  :map
c:0039 p:0080 s:0217 e:000216 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607
c:0038 p:0007 s:0208 e:000207 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607 [FINISH]
c:0037 p:---- s:0204 e:000203 CFUNC  :map
c:0036 p:0080 s:0200 e:000199 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607
c:0035 p:0007 s:0191 e:000190 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607 [FINISH]
c:0034 p:---- s:0187 e:000186 CFUNC  :map
c:0033 p:0080 s:0183 e:000182 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607
c:0032 p:0007 s:0174 e:000173 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607 [FINISH]
c:0031 p:---- s:0170 e:000169 CFUNC  :map
c:0030 p:0080 s:0166 e:000165 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607
c:0029 p:0008 s:0157 e:000156 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:121 [FINISH]
c:0028 p:---- s:0153 e:000152 CFUNC  :map
c:0027 p:0030 s:0149 e:000148 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:121
c:0026 p:0019 s:0146 e:000145 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/configuration.rb:2067
c:0025 p:0007 s:0142 e:000141 BLOCK  /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:116
c:0024 p:0009 s:0138 e:000137 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/reporter.rb:74
c:0023 p:0019 s:0133 e:000132 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:115
c:0022 p:0042 s:0126 e:000125 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:89
c:0021 p:0065 s:0120 e:000119 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:71
c:0020 p:0020 s:0112 e:000111 METHOD /usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:45
c:0019 p:0025 s:0107 e:000106 TOP    /usr/share/gems/gems/rspec-core-3.10.1/exe/rspec:4 [FINISH]
c:0018 p:---- s:0104 e:000103 CFUNC  :load
c:0017 p:0112 s:0099 e:000098 TOP    /usr/bin/rspec:23 [FINISH]
c:0016 p:---- s:0094 e:000093 CFUNC  :load
c:0015 p:0107 s:0089 e:000088 METHOD /usr/share/gems/gems/bundler-2.2.3/lib/bundler/cli/exec.rb:63
c:0014 p:0071 s:0083 e:000082 METHOD /usr/share/gems/gems/bundler-2.2.3/lib/bundler/cli/exec.rb:28
c:0013 p:0024 s:0078 e:000077 METHOD /usr/share/gems/gems/bundler-2.2.3/lib/bundler/cli.rb:497
c:0012 p:0054 s:0073 e:000072 METHOD /usr/share/gems/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor/command.rb:27
c:0011 p:0040 s:0065 e:000064 METHOD /usr/share/gems/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127
c:0010 p:0239 s:0058 e:000057 METHOD /usr/share/gems/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor.rb:392
c:0009 p:0008 s:0045 e:000044 METHOD /usr/share/gems/gems/bundler-2.2.3/lib/bundler/cli.rb:30
c:0008 p:0066 s:0040 e:000039 METHOD /usr/share/gems/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor/base.rb:485
c:0007 p:0008 s:0033 e:000032 METHOD /usr/share/gems/gems/bundler-2.2.3/lib/bundler/cli.rb:24
c:0006 p:0109 s:0028 e:000027 BLOCK  /usr/share/gems/gems/bundler-2.2.3/libexec/bundle:49
c:0005 p:0014 s:0022 e:000021 METHOD /usr/share/gems/gems/bundler-2.2.3/lib/bundler/friendly_errors.rb:130
c:0004 p:0162 s:0017 E:001d58 TOP    /usr/share/gems/gems/bundler-2.2.3/libexec/bundle:37 [FINISH]
c:0003 p:---- s:0013 e:000012 CFUNC  :load
c:0002 p:0112 s:0008 E:001690 EVAL   /usr/bin/bundle:23 [FINISH]
c:0001 p:0000 s:0003 E:002480 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
/usr/bin/bundle:23:in `<main>'
/usr/bin/bundle:23:in `load'
/usr/share/gems/gems/bundler-2.2.3/libexec/bundle:37:in `<top (required)>'
/usr/share/gems/gems/bundler-2.2.3/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
/usr/share/gems/gems/bundler-2.2.3/libexec/bundle:49:in `block in <top (required)>'
/usr/share/gems/gems/bundler-2.2.3/lib/bundler/cli.rb:24:in `start'
/usr/share/gems/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/share/gems/gems/bundler-2.2.3/lib/bundler/cli.rb:30:in `dispatch'
/usr/share/gems/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/share/gems/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/share/gems/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/share/gems/gems/bundler-2.2.3/lib/bundler/cli.rb:497:in `exec'
/usr/share/gems/gems/bundler-2.2.3/lib/bundler/cli/exec.rb:28:in `run'
/usr/share/gems/gems/bundler-2.2.3/lib/bundler/cli/exec.rb:63:in `kernel_load'
/usr/share/gems/gems/bundler-2.2.3/lib/bundler/cli/exec.rb:63:in `load'
/usr/bin/rspec:23:in `<top (required)>'
/usr/bin/rspec:23:in `load'
/usr/share/gems/gems/rspec-core-3.10.1/exe/rspec:4:in `<top (required)>'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:45:in `invoke'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:71:in `run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:89:in `run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:115:in `run_specs'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/reporter.rb:74:in `report'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:116:in `block in run_specs'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/configuration.rb:2067:in `with_suite_hooks'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:121:in `map'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `map'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `block in run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `map'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `block in run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `map'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `block in run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `map'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `block in run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `map'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:607:in `block in run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:606:in `run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:640:in `run_examples'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:640:in `map'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example_group.rb:644:in `block in run_examples'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:259:in `run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:508:in `with_around_and_singleton_context_hooks'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:465:in `with_around_example_hooks'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:486:in `run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:629:in `run_around_example_hooks_for'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:350:in `call'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:390:in `execute_with'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:455:in `instance_exec'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:455:in `instance_exec'
/usr/share/gems/gems/rspec-rails-4.0.1/lib/rspec/rails/adapters.rb:75:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:350:in `call'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:390:in `execute_with'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:455:in `instance_exec'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:455:in `instance_exec'
/usr/share/gems/gems/rspec-rails-4.0.1/lib/rspec/rails/example/controller_example_group.rb:191:in `block (2 levels) in <module:ControllerExampleGroup>'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:350:in `call'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:626:in `block in run_around_example_hooks_for'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/hooks.rb:486:in `block in run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:465:in `block in with_around_example_hooks'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:508:in `block in with_around_and_singleton_context_hooks'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:262:in `block in run'
/usr/share/gems/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:262:in `instance_exec'
/builddir/build/BUILD/spec/support/unit/shared_examples/set_session_or_flash.rb:156:in `block (6 levels) in <top (required)>'
/builddir/build/BUILD/spec/support/unit/shared_examples/set_session_or_flash.rb:352:in `controller_with_store'
/builddir/build/BUILD/spec/support/unit/helpers/controller_builder.rb:32:in `build_fake_response'
/builddir/build/BUILD/spec/support/unit/helpers/controller_builder.rb:19:in `define_routes'
/builddir/build/BUILD/spec/support/unit/rails_application.rb:56:in `draw_routes'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:407:in `draw'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:443:in `clear!'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:443:in `each'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:443:in `block in clear!'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:426:in `eval_block'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:426:in `instance_exec'
/usr/share/gems/gems/railties-6.0.3.4/lib/rails/application/finisher.rb:77:in `block (2 levels) in <module:Finisher>'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:712:in `get'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:751:in `map_method'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:1633:in `match'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:1885:in `map_match'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:1885:in `each'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:1891:in `block in map_match'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:1927:in `decomposed_match'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:1956:in `add_route'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:586:in `add_route'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:114:in `add'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:317:in `define_url_helper'
/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:317:in `define_method'
-- C level backtrace information -------------------------------------------
/lib64/libruby.so.3.0(0x3ff93674958) [0x3ff93674958]
/lib64/libruby.so.3.0(0x3ff934b754a) [0x3ff934b754a]
/lib64/libruby.so.3.0(0x3ff935dced8) [0x3ff935dced8]
[0x2aa199e87c8]
/lib64/libruby.so.3.0(0x3ff936500ce) [0x3ff936500ce]
/lib64/libruby.so.3.0(0x3ff93462f26) [0x3ff93462f26]
/lib64/libruby.so.3.0(0x3ff9365be5c) [0x3ff9365be5c]
/lib64/libruby.so.3.0(0x3ff9366b53c) [0x3ff9366b53c]
/lib64/libruby.so.3.0(0x3ff93588d9a) [0x3ff93588d9a]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(rb_yield+0xa2) [0x3ff936677d2]
/lib64/libruby.so.3.0(rb_ary_each+0x4c) [0x3ff9343e05c]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(0x3ff93666836) [0x3ff93666836]
/lib64/libruby.so.3.0(0x3ff93666a46) [0x3ff93666a46]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(rb_yield+0xa2) [0x3ff936677d2]
/lib64/libruby.so.3.0(rb_ary_each+0x4c) [0x3ff9343e05c]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(0x3ff93666836) [0x3ff93666836]
/lib64/libruby.so.3.0(0x3ff93666a46) [0x3ff93666a46]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(0x3ff93666836) [0x3ff93666836]
/lib64/libruby.so.3.0(0x3ff93666a46) [0x3ff93666a46]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(0x3ff93666836) [0x3ff93666836]
/lib64/libruby.so.3.0(0x3ff93666a46) [0x3ff93666a46]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(rb_yield+0xa2) [0x3ff936677d2]
/lib64/libruby.so.3.0(0x3ff934450da) [0x3ff934450da]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(rb_yield+0xa2) [0x3ff936677d2]
/lib64/libruby.so.3.0(0x3ff934450da) [0x3ff934450da]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(rb_yield+0xa2) [0x3ff936677d2]
/lib64/libruby.so.3.0(0x3ff934450da) [0x3ff934450da]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(rb_yield+0xa2) [0x3ff936677d2]
/lib64/libruby.so.3.0(0x3ff934450da) [0x3ff934450da]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(rb_yield+0xa2) [0x3ff936677d2]
/lib64/libruby.so.3.0(0x3ff934450da) [0x3ff934450da]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(rb_yield+0xa2) [0x3ff936677d2]
/lib64/libruby.so.3.0(0x3ff934450da) [0x3ff934450da]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(rb_yield+0xa2) [0x3ff936677d2]
/lib64/libruby.so.3.0(0x3ff934450da) [0x3ff934450da]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d4bc) [0x3ff9365d4bc]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(0x3ff9350e27e) [0x3ff9350e27e]
/lib64/libruby.so.3.0(0x3ff9350f50c) [0x3ff9350f50c]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d43a) [0x3ff9365d43a]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(0x3ff9350e27e) [0x3ff9350e27e]
/lib64/libruby.so.3.0(0x3ff9350f50c) [0x3ff9350f50c]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d43a) [0x3ff9365d43a]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(0x3ff9350e27e) [0x3ff9350e27e]
/lib64/libruby.so.3.0(0x3ff9350f50c) [0x3ff9350f50c]
/lib64/libruby.so.3.0(0x3ff9365781e) [0x3ff9365781e]
/lib64/libruby.so.3.0(0x3ff93659cbc) [0x3ff93659cbc]
/lib64/libruby.so.3.0(0x3ff9365d43a) [0x3ff9365d43a]
/lib64/libruby.so.3.0(rb_vm_exec+0x1f4) [0x3ff93662af4]
/lib64/libruby.so.3.0(0x3ff934bd49c) [0x3ff934bd49c]
/lib64/libruby.so.3.0(ruby_run_node+0x70) [0x3ff934c13a0]
/usr/bin/rspec spec/unit(0x2aa17b80a30) [0x2aa17b80a30]
/lib64/libc.so.6(__libc_start_main+0xe4) [0x3ff9322bd34]
/usr/bin/rspec spec/unit(0x2aa17b80a94) [0x2aa17b80a94]

... snip ...

For more information, you can check the build.log here:

https://koschei.fedoraproject.org/package/rubygem-shoulda-matchers

Updated by vo.x (Vit Ondruch) over 3 years ago

This is part of the backtrace:

#0  lookup_method_table (id=349648, klass=93825096550280) at vm_method.c:690
#1  search_method (defined_class_ptr=<optimized out>, id=<optimized out>, klass=93825096550280) at vm_method.c:970
#2  complemented_callable_method_entry (id=<optimized out>, klass=<optimized out>) at vm_method.c:1050
#3  clear_method_cache_by_id_in_class (klass=<optimized out>, mid=349648) at vm_method.c:163
#4  0x00007ffff7c9cb2d in rb_class_foreach_subclass (klass=<optimized out>, f=0x7ffff7e74b90 <clear_iclass_method_cache_by_id>, arg=349648) at class.c:133
#5  0x00007ffff7e8d7f2 in rb_method_entry_make (klass=klass@entry=93825019862880, mid=mid@entry=349648, defined_class=defined_class@entry=93825019862880, visi=METHOD_VISI_PUBLIC, 
    type=type@entry=VM_METHOD_TYPE_BMETHOD, def=0x55555b8626e0, def@entry=0x0, original_id=349648, opts=0x55555b8d03f0) at vm_method.c:834
#6  0x00007ffff7e8da8a in rb_add_method (klass=klass@entry=93825019862880, mid=mid@entry=349648, type=type@entry=VM_METHOD_TYPE_BMETHOD, opts=<optimized out>, visi=<optimized out>) at vm_method.c:891
#7  0x00007ffff7dbb633 in rb_mod_define_method (argc=1, argv=<optimized out>, mod=93825019862880) at proc.c:2236
#8  0x00007ffff7e7b485 in vm_call_cfunc_with_frame (ec=0x55555555bc80, reg_cfp=0x7ffff779e168, calling=<optimized out>) at vm_insnhelper.c:2898
#9  0x00007ffff7e7d7e6 in vm_sendish (ec=0x55555555bc80, reg_cfp=0x7ffff779e168, cd=0x555556ffb890, block_handler=<optimized out>, method_explorer=<optimized out>) at vm_callinfo.h:336
#10 0x00007ffff7e804e7 in vm_exec_core (ec=0x55555555bc80, initial=21853) at insns.def:770
#11 0x00007ffff7e85805 in rb_vm_exec (ec=0x55555555bc80, mjit_enable_p=<optimized out>) at vm.c:2172
#12 0x00007ffff7e8a0a6 in vm_yield (kw_splat=0, argv=0x7fffffffac80, argc=1, ec=<optimized out>) at vm.c:1398
#13 rb_yield_0 (argv=0x7fffffffac80, argc=1) at vm_eval.c:1171
#14 rb_yield_1 (val=<optimized out>) at vm_eval.c:1177
#15 rb_yield (val=93825006465680) at vm_eval.c:1187
#16 0x00007ffff7c7aa1c in rb_ary_each (ary=<optimized out>) at array.c:2523
#17 rb_ary_each (ary=93825096559840) at array.c:2517
#18 0x00007ffff7e7b485 in vm_call_cfunc_with_frame (ec=0x55555555bc80, reg_cfp=0x7ffff779e2f0, calling=<optimized out>) at vm_insnhelper.c:2898
#19 0x00007ffff7e7d7e6 in vm_sendish (ec=0x55555555bc80, reg_cfp=0x7ffff779e2f0, cd=0x555557a32fe0, block_handler=<optimized out>, method_explorer=<optimized out>) at vm_callinfo.h:336
#20 0x00007ffff7e804e7 in vm_exec_core (ec=0x55555555bc80, initial=21853) at insns.def:770
#21 0x00007ffff7e85805 in rb_vm_exec (ec=0x55555555bc80, mjit_enable_p=<optimized out>) at vm.c:2172
#22 0x00007ffff7e891e5 in vm_yield_with_cref (is_lambda=0, cref=<optimized out>, kw_splat=0, argv=0x7ffff769f8d0, argc=0, ec=0x55555555bc80) at vm.c:1390
#23 yield_under (under=93825096561040, self=<optimized out>, argc=0, argv=0x7ffff769f8d0, kw_splat=0) at vm_eval.c:1816
#24 0x00007ffff7e7b485 in vm_call_cfunc_with_frame (ec=0x55555555bc80, reg_cfp=0x7ffff779e440, calling=<optimized out>) at vm_insnhelper.c:2898
#25 0x00007ffff7e7d7e6 in vm_sendish (ec=0x55555555bc80, reg_cfp=0x7ffff779e440, cd=0x555556ffc440, block_handler=<optimized out>, method_explorer=<optimized out>) at vm_callinfo.h:336
#26 0x00007ffff7e804e7 in vm_exec_core (ec=0x55555555bc80, initial=21853) at insns.def:770
#27 0x00007ffff7e85805 in rb_vm_exec (ec=0x55555555bc80, mjit_enable_p=<optimized out>) at vm.c:2172
#28 0x00007ffff7e8a0a6 in vm_yield (kw_splat=0, argv=0x7fffffffb570, argc=1, ec=<optimized out>) at vm.c:1398
#29 rb_yield_0 (argv=0x7fffffffb570, argc=1) at vm_eval.c:1171
#30 rb_yield_1 (val=<optimized out>) at vm_eval.c:1177
#31 rb_yield (val=93825027150960) at vm_eval.c:1187
#32 0x00007ffff7c7aa1c in rb_ary_each (ary=<optimized out>) at array.c:2523
#33 rb_ary_each (ary=93825019862280) at array.c:2517

... snip ...

Updated by ufuk (Ufuk Kayserilioglu) over 3 years ago

This looks like the segvs we were observing, which was fixed by https://bugs.ruby-lang.org/issues/17539 (and PR https://github.com/ruby/ruby/pull/4066).

@tenderlovemaking (Aaron Patterson) can you confirm?

Updated by byroot (Jean Boussier) over 3 years ago

This looks like the segvs we were observing

I'm not certain. Ours was failing inside the GC code. Here it fails in vm_method.

@vo.x (Vit Ondruch) are you able to trigger this bug consistently?

Updated by vo.x (Vit Ondruch) over 3 years ago

Yes, I can hit it every time. And I am testing the patch efcdf68e6443ab70fbff1703b9dabbfc5090df31 and it does not fix the issue.

Updated by vo.x (Vit Ondruch) over 3 years ago

Just FTR, the reproducer I have is trying to execute shoulda-matchers [1] test suite such as:

$ bundle exec rspec spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb

I guess the reproducer should be possible to reduce further down to the Rails app, which is constructed via these test cases, but it is unfortunately quite complex. Maybe I should propose to add ruby-head to shoulda-matchers upstream.

[1] https://github.com/thoughtbot/shoulda-matchers/tree/v4.1.2

Updated by tenderlovemaking (Aaron Patterson) over 3 years ago

vo.x (Vit Ondruch) wrote in #note-5:

Just FTR, the reproducer I have is trying to execute shoulda-matchers [1] test suite such as:

$ bundle exec rspec spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb

I guess the reproducer should be possible to reduce further down to the Rails app, which is constructed via these test cases, but it is unfortunately quite complex. Maybe I should propose to add ruby-head to shoulda-matchers upstream.

[1] https://github.com/thoughtbot/shoulda-matchers/tree/v4.1.2

Does this reproduce on any platform besides s390x?

Updated by tenderlovemaking (Aaron Patterson) over 3 years ago

vo.x (Vit Ondruch) wrote in #note-5:

Just FTR, the reproducer I have is trying to execute shoulda-matchers [1] test suite such as:

$ bundle exec rspec spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb

I guess the reproducer should be possible to reduce further down to the Rails app, which is constructed via these test cases, but it is unfortunately quite complex. Maybe I should propose to add ruby-head to shoulda-matchers upstream.

[1] https://github.com/thoughtbot/shoulda-matchers/tree/v4.1.2

When I try to run the command, this happens on Linux:

aaron@whiteclaw ~/g/shoulda-matchers ((v4.1.2))> bundle exec rspec spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb
/home/aaron/.gem/ruby/3.0.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:29: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/aaron/.gem/ruby/3.0.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:118: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/aaron/.gem/ruby/3.0.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:118: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/aaron/.gem/ruby/3.0.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:35: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/aaron/.gem/ruby/3.0.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:35: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/aaron/.gem/ruby/3.0.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:44: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/aaron/.gem/ruby/3.0.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:118: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
/home/aaron/.gem/ruby/3.0.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:35: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.

An error occurred while loading ./spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb.
Failure/Error: raise AppraisalNotSpecified, message

Tests::CurrentBundle::AppraisalNotSpecified:


  Please run tests starting with `appraisal <appraisal_name>`.
  Possible appraisals are: ["rails_4_2", "rails_5_0", "rails_5_1", "rails_5_2", "rails_6_0"]
# ./spec/support/tests/current_bundle.rb:19:in `assert_appraisal!'
# ./spec/support/unit/load_environment.rb:4:in `<top (required)>'
# ./spec/unit_spec_helper.rb:1:in `require_relative'
# ./spec/unit_spec_helper.rb:1:in `<top (required)>'
# ./spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb:1:in `require'
# ./spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb:1:in `<top (required)>'
No examples found.


Finished in 0.00012 seconds (files took 0.0828 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

aaron@whiteclaw ~/g/shoulda-matchers ((v4.1.2)) [1]> ruby -v
ruby 3.0.0p0 (2021-01-14 revision 29777cb32a) [x86_64-linux]
aaron@whiteclaw ~/g/shoulda-matchers ((v4.1.2))>

Is this error the expected behavior?

Updated by vo.x (Vit Ondruch) over 3 years ago

It is reproducible on every platform.

We had to hack the test suite a bit to make it work on Fedora. The full script is here 1, but the relevant part should be this:

# It is easier to recreate the Gemfile to use local versions of gems.
cat << GF > Gemfile
source 'https://rubygems.org'
 
gem 'bcrypt'
gem 'rails'
gem 'rails-controller-testing'
gem 'rspec'
gem 'rspec-rails'
gem 'sqlite3'
gem 'spring'
GF
	
# Pry is useless for our purposes.
sed -i "/require 'pry/ s/^/#/" spec/spec_helper.rb
 
# Avoid Appraisal and Bundler.
sed -i "/current_bundle/ s/^/#/" spec/acceptance_spec_helper.rb
sed -i "/assert_appraisal/ s/^/#/" spec/acceptance_spec_helper.rb
sed -i "/current_bundle/ s/^/#/" spec/support/unit/load_environment.rb
sed -i "/assert_appraisal/ s/^/#/" spec/support/unit/load_environment.rb
 
# Avoid bootsnap, listen, puma and sprockets dependencies.
sed -i "/def rails_new_command/,/^    end$/ {
  /\]/i\          '--skip-listen',
}" spec/support/unit/rails_application.rb
sed -i "/def rails_new_command/,/^      else$/ {
  /\]/i\          '--skip-action-mailbox',
}" spec/support/unit/rails_application.rb
sed -i '/rails new/ s/"$/ --skip-bootsnap --skip-listen --skip-puma --skip-sprockets --skip-javascript --skip-action-mailbox"/' \
  spec/support/acceptance/helpers/step_helpers.rb
 
bundle exec rspec spec/unit

It removes some dependencies and dependencies on specific versions and I think the seds should take care about the appraisals.

Updated by vo.x (Vit Ondruch) over 3 years ago

I should also mention that there is currently Rails 6.0.3.4.

Updated by tenderlovemaking (Aaron Patterson) about 3 years ago

I was able to reproduce this, but it's hard to make a small script to reproduce the issue.

Here is the program I used to reproduce the issue:

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'rails', '= 6.0.3.4'
end

require "action_controller/railtie"

class App < Rails::Application
  config.eager_load = false
  routes.append do
    get "/hello/world" => "hello#world"
  end
end

App.initialize!

500.times do |i|
  controller_class = Class.new(ActionController::Base)

  controller_class.new

  controller_class = nil
  Rails.application.reload_routes!
end

The bug is that Ruby is trying to clear method caches on an ICLASS during incremental sweeping. But the ICLASS is actually a garbage object (the ICLASS will be swept during incremental sweeping).

Here is the backtrace:

aaron@whiteclaw ~/g/wow (master)> lldb (which ruby) -c core.2363226
(lldb) target create "/home/aaron/.rubies/ruby-trunk/bin/ruby" --core "core.2363226"
Core file '/home/aaron/git/wow/core.2363226' (x86_64) was loaded.
(lldb) bt 20
* thread #1, name = 'ruby', stop reason = signal SIGABRT
  * frame #0: 0x00007f0068d8f18b libc.so.6`raise + 203
    frame #1: 0x00007f0068d6e859 libc.so.6`abort + 299
    frame #2: 0x000055aab19d0c79 ruby`die at error.c:750:5
    frame #3: 0x000055aab19d0e5c ruby`rb_bug_for_fatal_signal(default_sighandler=0x0000000000000000, sig=11, ctx=0x000055aab2a0a000, fmt="") at error.c:790:5
    frame #4: 0x000055aab180d89f ruby`sigsegv(sig=11, info=0x000055aab2a0a130, ctx=0x000055aab2a0a000) at signal.c:960:5
    frame #5: 0x00007f00690ed3c0 libpthread.so.0`__restore_rt
    frame #6: 0x000055aab18bd265 ruby`lookup_method_table(klass=0x000055aab4752858, id=271264) at vm_method.c:688:33
    frame #7: 0x000055aab18bfe14 ruby`search_method(klass=0x000055aab4752858, id=271264, defined_class_ptr=0x00007ffd71805190) at vm_method.c:970:19
    frame #8: 0x000055aab18ec63e ruby`complemented_callable_method_entry(klass=0x000055aab481bc80, id=271264) at vm_method.c:1050:29
    frame #9: 0x000055aab18bb022 ruby`clear_method_cache_by_id_in_class(klass=0x000055aab481bc80, mid=271264) at vm_method.c:163:49
    frame #10: 0x000055aab18bac6e ruby`clear_iclass_method_cache_by_id(iclass=0x000055aab481bc80, d=0x00000000000423a0) at vm_method.c:213:5
    frame #11: 0x000055aab1957394 ruby`rb_class_foreach_subclass(klass=0x000055aab3d17cd0, f=(ruby`clear_iclass_method_cache_by_id at vm_method.c:210), arg=0x00000000000423a0) at class.c:133:2
    frame #12: 0x000055aab18ba957 ruby`rb_clear_method_cache(klass_or_module=0x000055aab3d17cd0, mid=271264) at vm_method.c:236:9
    frame #13: 0x000055aab18bd886 ruby`rb_method_entry_make(klass=0x000055aab3d17cd0, mid=271264, defined_class=0x000055aab3d17cd0, visi=METHOD_VISI_PUBLIC, type=VM_METHOD_TYPE_BMETHOD, def=0x000055aab4771000, original_id=271264, opts=0x000055aab47af008) at vm_method.c:834:5
    frame #14: 0x000055aab18bbd99 ruby`rb_add_method(klass=0x000055aab3d17cd0, mid=271264, type=VM_METHOD_TYPE_BMETHOD, opts=0x000055aab47af008, visi=METHOD_VISI_PUBLIC) at vm_method.c:891:5
    frame #15: 0x000055aab178784f ruby`rb_mod_define_method(argc=1, argv=0x00007f006895f548, mod=0x000055aab3d17cd0) at proc.c:2236:2
    frame #16: 0x000055aab18ed542 ruby`ractor_safe_call_cfunc_m1(recv=0x000055aab3d17cd0, argc=1, argv=0x00007f006895f548, func=(ruby`rb_mod_define_method at proc.c:2172)) at vm_insnhelper.c:2708:12
    frame #17: 0x000055aab18e886f ruby`vm_call_cfunc_with_frame(ec=0x000055aab2911710, reg_cfp=0x00007f0068a5ea60, calling=0x00007ffd71805780) at vm_insnhelper.c:2898:11
    frame #18: 0x000055aab18d70fc ruby`vm_sendish(ec=0x000055aab2911710, reg_cfp=0x00007f0068a5ea60, cd=0x000055aab3a07dd0, block_handler=0x00007f0068a5ea79, method_explorer=mexp_search_method) at vm_insnhelper.c:4499:15
    frame #19: 0x000055aab18a9cd4 ruby`vm_exec_core(ec=0x000055aab2911710, initial=0x0000000000000000) at insns.def:770:11

If we go to frame 9 and look at the object that is having it's cache cleared, it looks like this:

(lldb) command script import -r ~/git/ruby/misc/lldb_cruby.py
lldb scripts for ruby has been installed.
(lldb) f 9
frame #9: 0x000055aab18bb022 ruby`clear_method_cache_by_id_in_class(klass=0x000055aab481bc80, mid=271264) at vm_method.c:163:49
   160 	        RB_DEBUG_COUNTER_INC(cc_invalidate_leaf);
   161 	    }
   162 	    else {
-> 163 	        const rb_callable_method_entry_t *cme = complemented_callable_method_entry(klass, mid);
   164 	
   165 	        if (cme) {
   166 	            // invalidate cme if found to invalidate the inline method cache.
(lldb) rp klass
bits [     ]
T_ICLASS: (struct RClass) $1 = {
  basic = (flags = 0x000000010000005c, klass = 0x000055aab3d17cd0)
  super = 0x000055aab4752858
  ptr = 0x000055aab4828110
  class_serial = 6254
}
(lldb)

Note that the object has no flags. In other words, this class object is not marked. If we examine object space, we can see that the GC is currently in mode 2:

(lldb) p ruby_current_vm_ptr->objspace->flags
(rb_objspace::(anonymous struct)) $2 = {
  mode = 2
  immediate_sweep = 0
  dont_gc = 0
  dont_incremental = 0
  during_gc = 0
  during_compacting = 0
  gc_stressful = 0
  has_hook = 0
  during_minor_gc = 1
  during_incremental_marking = 0
}

Mode 2 is lazy sweeping. So the GC is currently sweeping pages. If we check the page that this object lives on, it looks like this:

(lldb) heap_page klass
(struct heap_page *) $4 = 0x000055aab4815bf0
(struct heap_page) $5 = {
  total_slots = 409
  free_slots = 0
  pinned_slots = 0
  final_slots = 0
  flags = {
    before_sweep = 1
    has_remembered_objects = 0
    has_uncollectible_shady_objects = 1
    in_tomb = 0
  }
  free_next = 0x000055aab47fe040
  start = 0x000055aab4818008
  freelist = 0x0000000000000000
  page_node = {
    next = 0x000055aab4828a28
    prev = 0x000055aab47fe068
  }
  wb_unprotected_bits = ([0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 1048576)
  mark_bits = ([0] = 17887750712806752255, [1] = 13114482114902867966, [2] = 18445585177834129919, [3] = 14877641359354736639, [4] = 18304601297856232382, [5] = 4758088225044815998, [6] = 16676486)
  uncollectible_bits = ([0] = 17887750712806752255, [1] = 13114482114902867966, [2] = 8933982764827640319, [3] = 14859626960845254652, [4] = 18304601297856232382, [5] = 4758088225044815998, [6] = 16676486)
  marking_bits = ([0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0)
  pinned_bits = ([0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0)
}

The page that this object lives on has its "before_sweep" flag set to true. This means that the GC hasn't swept this page yet, but it will sweep this page. Any objects that are on this page that aren't marked are garbage objects. In other words, the iclass object that lives on this page is garbage. We should not be invalidating cache on objects that are garbage (and that is the bug).

I've pushed a fix here: https://github.com/ruby/ruby/pull/4077

If CI comes back green I'll merge it in.

Thanks!

Actions #11

Updated by tenderlovemaking (Aaron Patterson) about 3 years ago

  • Status changed from Open to Closed

Applied in changeset git|0ed71b37fa9af134fdd5a7fd1cebd171eba83541.


Don't try to clear cache on garbage objects

Method cache can be cleared during lazy sweeping. An object that will
be collected during lazy sweep should not have it's method cache
cleared. Soon-to-be-collected objects can be in an inconsistent state and
this can lead to a crash. This patch just leaves early if the object is
going to be collected.

Fixes [Bug #17536]

Co-Authored-By: John Hawthorn
Co-Authored-By: Alan Wu

Updated by vo.x (Vit Ondruch) about 3 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN to 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: REQUIRED

Wow, thx for the effort to reduce the reproducer. I have applied this patch in Fedora and it fixes the segfault. Thx.

Updated by naruse (Yui NARUSE) about 3 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: REQUIRED to 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: DONE

ruby_3_0 138f0ba6da2a1ecf80729be3065310c5c0cfdb9a merged revision(s) 0ed71b37fa9af134fdd5a7fd1cebd171eba83541.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0