Issue #17164 has been reported by spraints (Matt Burke).

----------------------------------------
Bug #17164: Threads can ignore kill/interrupt/abort
https://bugs.ruby-lang.org/issues/17164

* Author: spraints (Matt Burke)
* Status: Open
* Priority: Normal
* ruby -v: 2.7.1
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
Threads can opt-out of requests to shut down the thread, including 'thr.kill' and the interrupt that happens when a main thread shuts down. When the interrupt happens, 'ensure' clauses will run in the thread's stack. If one of these clauses raises an error, a higher stack frame can rescue it and then execution proceeds as normal.

My understanding is that, when the main thread exits, all other threads are supposed to exit and then the program will exit. Using this 'ensure-raise-rescue' technique, a thread can delay program shutdown indefinitely.

The attached script reproduces the problem. It is very hard to exit without using 'kill -9'.

---Files--------------------------------
neverexit.rb (422 Bytes)


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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>