You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was going to pick this one up and add a mutex to the `AtForkMonkeyPatch, but actually I think it's no longer needed, especially after #3834 .
That is, in its current state we have:
moduleAtForkMonkeyPatchAT_FORK_CHILD_BLOCKS=[]# rubocop:disable Style/MutableConstant Used to store blocks to run, mutable by design.#...defself.run_at_fork_blocks(stage)raise(ArgumentError,"Unsupported stage #{stage}")unlessstage == :childAT_FORK_CHILD_BLOCKS.each(&:call)enddefself.at_fork(stage, &block)raise(ArgumentError,"Unsupported stage #{stage}")unlessstage == :childraise(ArgumentError,'Missing block argument')unlessblockAT_FORK_CHILD_BLOCKS << blocktrueend
...and:
Initialization is correct: it's done at require-time, and before requires are done there won't be any attempt to use the feature
There can't be concurrency between run_at_fork_blocks and at_fork: By design, run_at_fork_blocks is called by our monkey patch just after fork, and "just after fork" there won't exist other threads running that can be accessing this
Since we're the only users of this API, and we're not calling at_fork in background threads, there's also no concurrency between calls to at_fork.
Thus, while we could trivially add a Mutex here (I was half-way through doing it), I don't think we actually need one, given the current state of the code and how it's used.
I'm going to go ahead and close the issue, but ping me if you're not convinced by my hand-waving ;) :D
As discussed in #3829 (comment) .
The text was updated successfully, but these errors were encountered: