[#75225] [Ruby trunk Feature#12324] Support OpenSSL 1.1.0 (and drop support for 0.9.6/0.9.7) — k@...
Issue #12324 has been reported by Kazuki Yamaguchi.
6 messages
2016/04/27
[#78693] Re: [Ruby trunk Feature#12324] Support OpenSSL 1.1.0 (and drop support for 0.9.6/0.9.7)
— Eric Wong <normalperson@...>
2016/12/17
k@rhe.jp wrote:
[#78701] Re: [Ruby trunk Feature#12324] Support OpenSSL 1.1.0 (and drop support for 0.9.6/0.9.7)
— Kazuki Yamaguchi <k@...>
2016/12/17
On Sat, Dec 17, 2016 at 01:31:12AM +0000, Eric Wong wrote:
[#78702] Re: [Ruby trunk Feature#12324] Support OpenSSL 1.1.0 (and drop support for 0.9.6/0.9.7)
— Eric Wong <normalperson@...>
2016/12/17
Kazuki Yamaguchi <k@rhe.jp> wrote:
[ruby-core:75009] [Ruby trunk Bug#12298] Indeterministic ruby behavior when another thread is killed
From:
robert.pankowecki@...
Date:
2016-04-18 13:00:41 UTC
List:
ruby-core #75009
Issue #12298 has been updated by Robert Pankowecki.
Related Honeybadger bug: https://github.com/honeybadger-io/honeybadger-ruby/issues/186
----------------------------------------
Bug #12298: Indeterministic ruby behavior when another thread is killed
https://bugs.ruby-lang.org/issues/12298#change-58139
* Author: Robert Pankowecki
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
```
#!ruby
require 'securerandom'
class MyThread < ::Thread; end
def delay
15
end
def run
loop { work }
rescue Exception => e
puts "#{Time.now} Exception"
ensure
puts "#{Time.now} stopping agent"
end
def work
puts "#{Time.now} start work"
10_000_000.times { SecureRandom.hex }
puts "finished work"
rescue StandardError => e
puts "#{Time.now} Error"
ensure
puts "#{Time.now} start sleep"
sleep(delay)
puts "#{Time.now} finished sleep"
end
t = MyThread.new{ run }
at_exit do
puts "#{Time.now} killing thread"
Thread.kill(t)
puts "#{Time.now} killed thread"
end
sleep(10)
exit
```
I tried running this script multiple times in ruby 2.1.10, 2.2.4, 2.3.0 and I get inconsistent behavior. Sometimes the main thread does not wait for the second thread.
```
2016-04-15 11:07:09 +0200 start work
2016-04-15 11:07:19 +0200 killing thread
2016-04-15 11:07:19 +0200 killed thread
2016-04-15 11:07:19 +0200 stopping agent
```
And sometimes it does.
```
2016-04-15 11:07:26 +0200 start work
2016-04-15 11:07:36 +0200 killing thread
2016-04-15 11:07:36 +0200 killed thread
2016-04-15 11:07:36 +0200 start sleep
2016-04-15 11:07:51 +0200 finished sleep
2016-04-15 11:07:51 +0200 stopping agent
```
I appears that under higher CPU usage the 2nd scenario is more likely. In normal conditions the 1st happens more often probably.
I described [the whole story in my blogpost](http://blog.arkency.com/2016/04/how-i-hunted-the-most-odd-ruby-bug/)
I am not sure which behavior is ruby default (I assume not waiting for other threads) but sometimes apparently ruby does wait for other threads to finish.
--
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>