From 4a7c5685c86d0349c98b2725ad01aa70ebcc3581 Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Thu, 6 Oct 2016 10:31:14 +1030 Subject: 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. --- actioncable/lib/action_cable/connection/stream_event_loop.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'actioncable/lib/action_cable/connection/stream_event_loop.rb') diff --git a/actioncable/lib/action_cable/connection/stream_event_loop.rb b/actioncable/lib/action_cable/connection/stream_event_loop.rb index eec24638b6..2d1af0ff9f 100644 --- a/actioncable/lib/action_cable/connection/stream_event_loop.rb +++ b/actioncable/lib/action_cable/connection/stream_event_loop.rb @@ -36,6 +36,7 @@ module ActionCable @todo << lambda do @nio.deregister io @map.delete io + io.close end wakeup end -- cgit v1.2.3