Project

General

Profile

Bug #13163

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

Added by tagomoris (Satoshi TAGOMORI) over 1 year ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
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?

Associated revisions

Revision ab81cc4d
Added by nobu (Nobuyoshi Nakada) 9 months ago

thread.c: report then abort

  • thread.c (thread_start_func_2): report then abort on exception, if both are set. [Bug #13163]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 59963
Added by nobu (Nobuyoshi Nakada) 9 months ago

thread.c: report then abort

  • thread.c (thread_start_func_2): report then abort on exception, if both are set. [Bug #13163]

Revision 59963
Added by nobu (Nobuyoshi Nakada) 9 months ago

thread.c: report then abort

  • thread.c (thread_start_func_2): report then abort on exception, if both are set. [Bug #13163]

Revision 3c35067c
Added by nagachika (Tomoyuki Chikanaga) 4 months ago

merge revision(s) 59963: [Backport #13163]

thread.c: report then abort

* thread.c (thread_start_func_2): report then abort on exception,
  if both are set.   [Bug #13163]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 62711
Added by nagachika (Tomoyuki Chikanaga) 4 months ago

merge revision(s) 59963: [Backport #13163]

thread.c: report then abort

* thread.c (thread_start_func_2): report then abort on exception,
  if both are set.   [Bug #13163]

History

#2 [ruby-core:82831] Updated by nobu (Nobuyoshi Nakada) 9 months ago

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

#3 [ruby-core:82832] Updated by Eregon (Benoit Daloze) 9 months ago

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

#4 [ruby-core:82854] Updated by naruse (Yui NARUSE) 9 months ago

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

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

#5 Updated by nobu (Nobuyoshi Nakada) 9 months ago

  • Status changed from Assigned to Closed

Applied in changeset trunk|r59963.


thread.c: report then abort

  • thread.c (thread_start_func_2): report then abort on exception, if both are set. [Bug #13163]

#6 [ruby-core:83300] Updated by Eregon (Benoit Daloze) 8 months 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+.

#7 [ruby-core:86069] Updated by nagachika (Tomoyuki Chikanaga) 4 months 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.

Also available in: Atom PDF