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
There are a number of potential issues with InternalPool, particularly in relation to #create being public, #each, #to_a, #busy_size, and #idle_size being unsynchronized, and #busy_size and #idle_size creating intermediate arrays rather than using Array#count.
The text was updated successfully, but these errors were encountered:
Yes, this is bad, and I feel bad. I'm not sure how I didn't notice this in the PRs that changed this code. InternalPool's contract is definitely to be thread safe, and it's not honoring that.
#create should probably be private and never be called in an unsynchronized context
#to_a should do something like acquire the mutex then duplicate the original list of threads
#each could use #to_a to obtain its own copy of the thread list, then iterate it unsynchronized
#busy_size and #idle_size should probably just keep memoized counters which can be safely read without synchronizing
There are a number of potential issues with InternalPool, particularly in relation to
#create
being public,#each
,#to_a
,#busy_size
, and#idle_size
being unsynchronized, and#busy_size
and#idle_size
creating intermediate arrays rather than usingArray#count
.The text was updated successfully, but these errors were encountered: