1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Close the IO from the read loop thread

IO#close and IO#read across threads don't get along so well:

After T1 enters #read and releases the GVL, T2 can call #close on the
IO, thereby both closing the fd and freeing the buffer while T1 is using
them.
This commit is contained in:
Matthew Draper 2016-10-06 10:31:14 +10:30
parent de9a56b66a
commit 4a7c5685c8
2 changed files with 1 additions and 1 deletions

View file

@ -106,7 +106,6 @@ module ActionCable
def clean_rack_hijack
return unless @rack_hijack_io
@event_loop.detach(@rack_hijack_io, self)
@rack_hijack_io.close
@rack_hijack_io = nil
end
end

View file

@ -36,6 +36,7 @@ module ActionCable
@todo << lambda do
@nio.deregister io
@map.delete io
io.close
end
wakeup
end