Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Handle execve's on Linux #177
This is a fix for #145, handling
The idea here is to check the result returned when getting the stack trace from the target process to detect the error that the pointer to the ruby thread state, specifically, has become invalid. If it has, we then reinitialize StackTraceGetter on the basis that if we've lost the thread the whole process is invalid.
In the test case I added I'm polling until the reinitialization happens. I did this because when I used a fixed timeout I was sometimes getting the trace before reinitialization (one every 500 test runs or so), and I didn't want to play the timeout tweaking game. With the current polling I still get the error "stack base and cfp address out of sync" once every few thousand test runs but I think that error should be transient and shouldn't impact real usage.