Closed professor closed 4 months ago
There is also a discussion in https://github.com/steveklabnik/request_store/issues/96#issuecomment-1974215624 that I think concerns the same underlying issue. Note that request_store 1.6.0 switched from thread local storage to fiber storage, which is what triggered the problem in my case.
Thank you @mattbrictson -- let's ammend the issue title in #96 -- I had assumed it wasn't related.
I'm debugging an issue in PaperTrail and how it uses RequestStore.
I noticed that one of their tests failed with the switch from Ruby 3.1.5 to 3.2.0:
In the test they assert that a new thread would get a new RequestStore:
I'm able to update the test for RequestStore and Fiber like so:
Notice that when a new Fiber is created, by default it "inherits a copy of the storage from the current fiber."
I realize that RequestStore does not specify how Fibers are created, and this made me wonder if there's a potential bug in using RequestStore since it may be hard to see how new Fibers are created in puma or thin. (Currently puma and thin use Thread.new)