Skip to content

Instantly share code, notes, and snippets.

@mbj
Last active December 5, 2018 19:38
Show Gist options
  • Save mbj/e6795ee5e0583c5541ee250e9942279a to your computer and use it in GitHub Desktop.
Save mbj/e6795ee5e0583c5541ee250e9942279a to your computer and use it in GitHub Desktop.
Crash Ruby 2.5.3
system('uname -a')
# not relevant just to make sure we terminate early
# core dumping is expensive.
Thread.abort_on_exception = true
MUTEX = Mutex.new
# You may have to up this on your platform
50.times do
Thread.new do
pid = Process.fork { MUTEX.synchronize {} }
MUTEX.synchronize {}
Process.waitpid(pid)
end
end
@dgollahon
Copy link

dgollahon commented Dec 5, 2018

Darwin MacBook-Pro.local 17.7.0 Darwin Kernel Version 17.7.0: Wed Oct 10 23:06:14 PDT 2018; root:xnu-4570.71.13~1/RELEASE_X86_64 x86_64
crash.rb:13: [BUG] unexpected THREAD_KILLED
ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin17]

Note: did not fail the first time I ran it. It crashes ~80% of the time.

@mbj
Copy link
Author

mbj commented Dec 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment