fix observed double-deletes of futures interrupt handlers
Summary: The state machine for the interrupt has a has-handler state which holds the handler pointer and a terminal state which holds nothing. When a handler has been stored and an exception is raised, the state machine exchanges the handler and transitions the state from has-handler to terminal, and then invokes the handler and decrements its refcount, possibly deleting it. A concurrent continuation of a future can load the interrupt and, if it is a handler, increment its refcount. There is a possible race: the handler is loaded in both threads, its refcount decremented in the first thread and incremeneted in the second thread, and then the first thread observes an historical refcount of zero and deletes the handler. Fix this race by holding onto the handler until the core is destroyed. Reviewed By: davidtgoldblatt Differential Revision: D30017199 fbshipit-source-id: b6c474c630719ef8fd1cb88fa982045a523590dd
Showing
Please register or sign in to comment