VCR's rack middleware is not threadsafe #58

myronmarston opened this Issue Apr 20, 2011 · 0 comments


None yet
1 participant

myronmarston commented Apr 20, 2011

VCR as a whole is not threadsafe. It wasn't built with threadsafety in mind as it was meant to be used in a test environment.

This was fine until you start using the provided rack middle ware in a development environment where a browser makes multiple HTTP requests in parallel to your rack app...your server may have multiple threads servicing the requests, and as such, the lack of thread safety causes problems.

The easy solution for now is to put a mutex around VCR.use_cassette in the rack middleware, so multiple threads cannot use VCR simultaneously.

Down the road it might be worthwhile to make VCR threadsafe, but I don't think it's worth the effort right now.

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