Project

General

Profile

Actions

Bug #13163

closed

Uncaught exceptions may not be reported when Thread#report_on_exception=true and Thread#abort_on_exception=true

Added by tagomoris (Satoshi Tagomori) about 7 years ago. Updated about 6 years ago.

Status:
Closed
Target version:
-
[ruby-core:79280]

Description

When we set true on both of Thread#report_on_exception and Thread#abort_on_exception, it just works as Thread#abort_on_exception and raised error will be re-raised in main thread.
But in our case, main thread sometimes in begin-rescue clause, or sometimes out of begin-rescue clause.
When main thread in begin-rescue clause (and main thread code may raise errors in their own business), we cannot know that threads are dead by errors.

What I expected by specifying both of Thread#report_on_exception=true and Thread#abort_on_exception=true:

  • "Thread terminated with exception" is reported always (even if Thread#abort_on_exception is set)
  • Raised error is re-raised in main thread if Thread#abort_on_exception is true

How do you think about this idea?

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Description updated (diff)
  • Status changed from Open to Feedback

Updated by Eregon (Benoit Daloze) over 6 years ago

+1
The patch looks good.
The message of the assert_warn should be changed though.

Updated by naruse (Yui NARUSE) over 6 years ago

  • Tracker changed from Misc to Bug
  • Status changed from Feedback to Assigned
  • Assignee set to nobu (Nobuyoshi Nakada)
  • Backport set to 2.2: DONTNEED, 2.3: REQUIRED, 2.4: REQUIRED

Hmm, indeed this seems considered a bug.
@nobu (Nobuyoshi Nakada) Could you commit it?

Actions #5

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Assigned to Closed

Applied in changeset trunk|r59963.


thread.c: report then abort

Updated by Eregon (Benoit Daloze) over 6 years ago

  • Backport changed from 2.2: DONTNEED, 2.3: REQUIRED, 2.4: REQUIRED to 2.2: DONTNEED, 2.3: DONTNEED, 2.4: REQUIRED

I believe we only need a 2.4 backport, Thread#report_on_exception is only defined from Ruby 2.4+.

Updated by nagachika (Tomoyuki Chikanaga) about 6 years ago

  • Backport changed from 2.2: DONTNEED, 2.3: DONTNEED, 2.4: REQUIRED to 2.2: DONTNEED, 2.3: DONTNEED, 2.4: DONE

ruby_2_4 r62711 merged revision(s) 59963.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0