mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
thread.c: disable VM events when stack overflow
* thread.c (ruby_thread_stack_overflow): disable VM events when stack overflow occurred; it causes another stack overflow again in making backtrace object, and crashes. [ruby-core:80662] [Bug #13425] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1b5acc876b
commit
38174633e2
2 changed files with 16 additions and 0 deletions
|
@ -59,4 +59,19 @@ class TestTrace < Test::Unit::TestCase
|
||||||
a.any? {true}
|
a.any? {true}
|
||||||
}.value, bug2722)
|
}.value, bug2722)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_trace_stackoverflow
|
||||||
|
assert_normal_exit("#{<<-"begin;"}\n#{<<~"end;"}")
|
||||||
|
begin;
|
||||||
|
require 'tracer'
|
||||||
|
class HogeError < StandardError
|
||||||
|
def to_s
|
||||||
|
message.upcase # disable tailcall optimization
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Tracer.stdout = open(IO::NULL, "w")
|
||||||
|
Tracer.on
|
||||||
|
HogeError.new.to_s
|
||||||
|
end;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
1
thread.c
1
thread.c
|
@ -2169,6 +2169,7 @@ NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
|
||||||
void
|
void
|
||||||
ruby_thread_stack_overflow(rb_thread_t *th)
|
ruby_thread_stack_overflow(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
|
ruby_vm_event_flags = 0;
|
||||||
th->raised_flag = 0;
|
th->raised_flag = 0;
|
||||||
#ifdef USE_SIGALTSTACK
|
#ifdef USE_SIGALTSTACK
|
||||||
if (!rb_threadptr_during_gc(th)) {
|
if (!rb_threadptr_during_gc(th)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue