You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible for two exceptions to refer to each other as their cause, resulting in infinite recursion in display_exception_details. Here is a snippet that demonstrates the case:
irb(main):001:0> beginirb(main):002:1* beginirb(main):003:2* require'nope_a'irb(main):004:2> rescueLoadError=>eirb(main):005:2> beginirb(main):006:3* require'nope_b'irb(main):007:3> rescueLoadErrorirb(main):008:3> raiseeirb(main):009:3> endirb(main):010:2> endirb(main):011:1> rescueException=>firb(main):012:1> a=firb(main):013:1> end=>#<LoadError: cannot load such file -- nope_a>irb(main):014:0> a.cause=>#<LoadError: cannot load such file -- nope_b>irb(main):015:0> a.cause.cause=>#<LoadError: cannot load such file -- nope_a>irb(main):016:0> a.cause.cause.cause=>#<LoadError: cannot load such file -- nope_b>irb(main):017:0> a.cause.cause.cause.cause=>#<LoadError: cannot load such file -- nope_a>
I discovered this while using Sequel in a Rake task. That gem uses this construct to load drivers in a particular order and raise the preferred driver when all fail. I'm going to recommend a change over in that project, but this was so easy to replicate, I thought Rake may need to guard against it as well.
The text was updated successfully, but these errors were encountered:
As the result of https://bugs.ruby-lang.org/issues/13043, now
Exception#cause should not have a loop.
In the example jimweirich#272, the
code doesn't seem to intend the loop itself but just re-raising
the first exception instead of the next exception. Therefore I
consider the last assertion superfluous.
As the result of https://bugs.ruby-lang.org/issues/13043, now
Exception#cause should not have a loop.
In the example jimweirich#272, the
code doesn't seem to intend the loop itself but just re-raising
the first exception instead of the next exception. Therefore I
consider the last assertion superfluous.
It is possible for two exceptions to refer to each other as their cause, resulting in infinite recursion in
display_exception_details
. Here is a snippet that demonstrates the case:I discovered this while using Sequel in a Rake task. That gem uses this construct to load drivers in a particular order and raise the preferred driver when all fail. I'm going to recommend a change over in that project, but this was so easy to replicate, I thought Rake may need to guard against it as well.
The text was updated successfully, but these errors were encountered: