steveklabnik / request_store

Per-request global storage for Rack.
https://github.com/steveklabnik/request_store
MIT License
1.47k stars 87 forks source link

Fiber concurrency fix #97

Closed icheishvili closed 4 months ago

icheishvili commented 5 months ago

when using concurrent fibers/threads+fibers, the Fiber object is a global klass; this automatically causes data races and all kinds of bugs to show up in any app that uses 1.6.0

since the intention is for the gem to work with fibers, the best way to fulfill that intention is to patch the Fiber class such that each instance has local storage

icheishvili commented 5 months ago

To be clear on this one, v1.6.0 is horribly broken and doesn't handle concurrency/parallelism at all. It should be pulled until a fix like this one can be merged in. We ran into issues in production and I shudder to think of all the people that don't have change data capture turned on--they are probably dealing with permanent data corruption.

bjorntrondsen commented 5 months ago

Wow! It's been 2 months since release and 1.2m downloads on Rubygems :o

I havent dug into this issue, but I have a bunch of paper_trail related specs that fail on v1.6.0 and this PR fixes them.

steveklabnik commented 4 months ago

I am deciding to take https://github.com/steveklabnik/request_store/pull/99 over this, as I would rather the confidence of a revert than trying to make Fibers work.

Thank you for trying to help, though, and sorry that I have been incommunicado.