Issue #11667 has been updated by tleish (Tony Fenleish).


We recently ran into this same problem in Ruby 2.4.x, however this appears to be fixed in Ruby 2.5.

In the command below you should see an exception in the output, but instead the application crashes with no output.

~~~ text
$ ruby -v 
ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-darwin17]
$ ruby -e 'TracePoint.new(:raise){}.enable; def f(i); f(i-1); end; f(10_000)'
$
~~~

With ruby 5.1, we now see the SystemStackError

~~~ text
$ ruby -v 
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
$ ruby -e 'TracePoint.new(:raise){}.enable; def f(i); f(i-1); end; f(10_000)'
Traceback (most recent call last):
	11913: from -e:1:in `<main>'
	11912: from -e:1:in `f'
	11911: from -e:1:in `f'
	11910: from -e:1:in `f'
	11909: from -e:1:in `f'
	11908: from -e:1:in `f'
	11907: from -e:1:in `f'
	11906: from -e:1:in `f'
	 ... 11901 levels...
	    4: from -e:1:in `f'
	    3: from -e:1:in `f'
	    2: from -e:1:in `f'
	    1: from -e:1:in `f'
-e:1:in `f': stack level too deep (SystemStackError)
~~~


----------------------------------------
Bug #11667: Ruby process crashes when TracePoint.new(:raise) is enabled and SystemStackError is raised
https://bugs.ruby-lang.org/issues/11667#change-74201

* Author: yuki24 (Yuki Nishijima)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.3.0dev (2015-10-23 trunk 52247) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: REQUIRED
----------------------------------------
Let's say a `TracePoint.new(:raise)` is enabled. When a method that recursively calls itself, the Ruby process will just die rather than raising a SystemStackError.

```
$ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
$ irb
2.2.3 :001 > TracePoint.new(:raise){}.enable
 => false 
2.2.3 :002 > def f(i); f(i-1); end; f(10_000)
/usr/local/rvm/rubies/ruby-2.2.3/bin/irb: exception reentered (fatal)
```

```
$ ruby -v
ruby 2.3.0dev (2015-10-23 trunk 52247) [x86_64-linux]
$ irb
head :001 > TracePoint.new(:raise){|tp| tp.raised_exception }.enable
 => false 
head :002 > def f(i); f(i-1); end; f(10_000)
/usr/local/rvm/rubies/ruby-head/bin/irb: exception reentered (fatal)
```

I expect this code to raise `SystemStackError` instead.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>