Bug #16177
closedSome `*.rb` files on builddir cause Segmentation fault
Description
How to reproduce:
- Create dummy files by
./miniruby -e '%w[a b foo bar test zzz].each{|basename|File.write("#{basename}.rb", "raise %(do not load #{basename}.rb)")}'
- Run
ruby/test_autoload.rb
likemake test-all TESTS='ruby/test_autoload.rb'
Error log from raw logs:
2019-09-24T09:48:24.3773590Z 2) Failure:
2019-09-24T09:48:24.3773760Z TestAutoload#test_autoload_same_file [/Users/runner/runners/2.158.0/work/ruby/ruby/test/ruby/test_autoload.rb:332]:
2019-09-24T09:48:24.3773930Z pid 39572 killed by SIGABRT (signal 6)
2019-09-24T09:48:24.3774450Z | #<Thread:0x00007f8851176ac0@-:9 run> terminated with exception (report_on_exception is true):
2019-09-24T09:48:24.3775010Z | /Users/runner/runners/2.158.0/work/ruby/ruby/b.rb:1:in `<top (required)>': do not load b.rb (RuntimeError)
2019-09-24T09:48:24.3775480Z | from -:9:in `require'
2019-09-24T09:48:24.3775910Z | from -:9:in `block in <main>'
2019-09-24T09:48:24.3776390Z | -:10: [BUG] Segmentation fault at 0x0000000000000019
attached full raw logs of https://github.com/ruby/ruby/pull/2482/checks?check_run_id=233890903#step:11:1
Files
Updated by znz (Kazuhiro NISHIYAMA) about 5 years ago
- File bug-in-docker.txt bug-in-docker.txt added
How to reproduce:
echo 'raise %(do not load b.rb)' > b.rb
cat >x.rb <<EOF
autoload :Foo, 'b'
autoload :Bar, 'b'
t1 = Thread.new do Foo end
t2 = Thread.new do Bar end
t1.join
t2.join
EOF
ruby -w --disable=gems -I. x.rb
ruby -w --disable=gems -I. x.rb
sometimes causes x.rb:4: [BUG] Segmentation fault at 0x0000000000000019
.
I confirmed on macos and ubuntu.
It can reproduce in Docker.
Dockerfile example is https://github.com/znz/ruby-16177/blob/master/Dockerfile.
Updated by ko1 (Koichi Sasada) about 5 years ago
- Status changed from Open to Closed
Applied in changeset git|a5fe08fdd9d11f12a6837291ee588ab933a823b6.
care about TAG_FATAL.
TAG_FATAL represents interpreter closing state and ec->errinfo
contains FIXNUM (eTerminateSignal, etc). If we need to change the
state, then errinfo is also changed because TAG_RAISE assumes that
ec->errinfo contains a Exception object.
Without this patch, TAG_FATAL is ignored and no ec->errinfo change
so that it causes critical issue.
[Bug #16177]
Updated by ko1 (Koichi Sasada) about 5 years ago
I fixed this issue, but no test. can anyone write it?