From: tom.enebo@... Date: 2017-12-01T17:23:13+00:00 Subject: [ruby-core:84038] [Ruby trunk Feature#14143] Thread.report_on_exception should be true by default Issue #14143 has been updated by enebo (Thomas Enebo). I think clarification on what the semantics should be would be helpful. Should **ANY** exception raised in a Thread be considered a reasonable way of ending a thread? Yes or No Yes - You execute your program and it does not work right. Wondering why after doing weird stuff like method ensure blocks to print out the backtrace (yes I did that at one time) you find: Thread.abort_on_exception = true. Once enabling and re-running (assuming it is predictable) you realize you made a typo and a NoMethodError killed your thread. No - When your program does not work right you see a stack trace on a thread which died from an exception raise. In No, the semantics is there is no reasonable exception to be thrown which will not generate a backtrace, but compared to Yes we do not get hidden death. Hidden death makes developers frustrated and until they discover abort_on_exception they wonder why this is like this. Even after they learn this they still wonder why this is like this... :) Besides asking a thread to kill we could always add a special exception which allows a thread to go away silently. I personally think that is too much though. ---------------------------------------- Feature #14143: Thread.report_on_exception should be true by default https://bugs.ruby-lang.org/issues/14143#change-68125 * Author: Eregon (Benoit Daloze) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Extracted from #6647 to focus on the default value now that the feature is implemented. I strongly believe we should have Thread.report_on_exception = true by default. It only adds some extra stderr output for apps which let threads die, which is very rarely intended. If it is intended, then one can use Thread.current.report_on_exception = false to clarify it's OK for that thread to die and the failure is handled by the app on Thread#join. I enabled Thread.report_on_exception=true by default in ruby/spec, see https://github.com/ruby/spec/pull/517, the only cases needing Thread.current.report_on_exception=false are the specs testing report_on_exception itself and Thread#join/value/status/raise. Enabling it for test-all shows a fair amount of extra output and failures, which I would bet some of them are bugs in the tests (I already found one, r60854 & r60870), and other tests should simply more carefully test what they expect (for instance assert_raise() inside the Thread just around the code raising an exception and join the Thread). I am willing to help to reduce the extra output and failures in test-all, but I would like a OK from Matz to try enabling Thread.report_on_exception by default. Dear Matz, do you think it is reasonable to show exceptions killing threads on stderr by default, instead of silently swallowing them until Thread#join ? (if there is ever a Thread#join ..., often not or too late, when the rest of the application has crashed) -- https://bugs.ruby-lang.org/ Unsubscribe: