Skip to content

Instantly share code, notes, and snippets.

@benweint
Last active December 16, 2015 23:38
Show Gist options
  • Save benweint/5514906 to your computer and use it in GitHub Desktop.
Save benweint/5514906 to your computer and use it in GitHub Desktop.
Demonstration of nil backtraces in Ruby. nil backtraces show up sometimes in MRI. In JRuby-1.7.3, NullPointerExceptions show up for the backtracing thread.
#!/usr/bin/env ruby
Thread.new do
loop do
Thread.list.each do |t|
puts "Got a nil backtrace for thread #{t}" if t.backtrace.nil?
end
end
end
loop { Thread.new { sleep 0.001 }.join }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment