ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: ujihisa@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:99197] [Ruby master Bug#17033] Infinite Traceback when encountering an Exception while catching an Exception
Date: Fri, 17 Jul 2020 00:07:46 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-86577.20200717000744.41765@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-17033.20200715043902.41765@ruby-lang.org

Issue #17033 has been updated by ujihisa (Tatsuhiro Ujihisa).


(Oh I see, this and https://bugs.ruby-lang.org/issues/14566#change-71448 were independent)

----------------------------------------
Bug #17033: Infinite Traceback when encountering an Exception while catching an Exception
https://bugs.ruby-lang.org/issues/17033#change-86577

* Author: NickHackman (Nick Hackman)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
* Backport: 2.5: DONTNEED, 2.6: REQUIRED, 2.7: REQUIRED
----------------------------------------
In Ruby 2.7.1 when an Exception occurs and another occurs when handling the first one it results in an infinite Traceback that doesn't mention the error.

```ruby
class MyException < StandardError
  def initialize(obj)
    @obj = obj
  end

  def to_s
    @obj.to_strm
  end
end

begin
  raise MyException.new('test'), 'message'
rescue StandardError => e
  puts e.to_s
end
```

In the above instance, there's a typo `to_strm` doesn't exist for type String, but instead of a normal case of a typo saying that the method doesn't exist the output is

```
~ λ ruby ruby_traceback_hell.rb
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
...
```
it keeps going without printing any sort of message about the actual error.

It's expected that this would result in a message saying that the method is undefined, and this is the behavior on 2.5.1, and appears to be a regression in 2.7.1



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

  parent reply	other threads:[~2020-07-17  0:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15  4:39 [ruby-core:99172] [Ruby master Bug#17033] Infinite Traceback when encountering an Exception while catching an Exception snickhackman
2020-07-15  4:45 ` [ruby-core:99173] " snickhackman
2020-07-17  0:07 ` ujihisa [this message]
2020-07-18  2:33 ` [ruby-core:99211] " nobu
2020-07-23  3:13 ` [ruby-core:99287] " nagachika00
2021-04-04 22:25 ` [ruby-core:103211] " usa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-86577.20200717000744.41765@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).