Fixing race condition resulting in "This connection is still waiting for a result, try again once you have the result"


In our case we have Thread.abort_on_exception as true. (This was set because Mongo gem sets it, not sure why.) This resulted in this subtle race condition, which cause the "still waiting for result" problem.

Added spec, hopefully the spec reproduces for you.