Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
While I was chasing down a leaked thread, I gathered a few improvements. These mostly affect tests that finish too fast, my test case was: ```ruby RSpec.describe "A short-lived thread" do it 'lives for a really short while' do Thread.new { } end end ``` Improvements: * Set the `@caller` before the thread actually starts running. This works fine (we're using a similar construct in the profiler), and ensures that the `@caller` is available from the moment the thread gets created, instead of being a race. I observed that if a test run too fast, it was possible that `@caller` was not set because the thread still hadn't run by the time the detector started working. * Call `Thread.pass` whenever a backtrace is not available -- this tries to give newly-created threads a chance to run, so that we can have a backtrace for them. * Detect when a backtrace is missing because a thread has died.
- Loading branch information