diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-30 13:54:02 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-30 13:54:02 -0400 |
commit | b47e621749257331788e82e44d1565cf4d32d04b (patch) | |
tree | d6c3445be85b05fc58675552fc1bfb4f0ceb375d /Role/Watcher.hs | |
parent | 89d4e18cdb6ed1c3e7916dd66cf907bedf58a549 (diff) | |
download | debug-me-b47e621749257331788e82e44d1565cf4d32d04b.tar.gz |
fix probable race in use of restoreHashes
I think there was a race where a SessionKey message had been drained
from the TChan, but not yet added to the developer state, which was
resonsible for recent instability at startup.
It manifested as protocol errors where the prevActivity hash was wrongly
Nothing.
Fixed by adding a MissingHashes type to tag things whose hashes have
been stripped, and adding back the hashes when needed, which always
happens inside atomically blocks, so won't have such a race.
Diffstat (limited to 'Role/Watcher.hs')
-rw-r--r-- | Role/Watcher.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Role/Watcher.hs b/Role/Watcher.hs index 0867da1..8ed59d5 100644 --- a/Role/Watcher.hs +++ b/Role/Watcher.hs @@ -14,7 +14,7 @@ import Control.Concurrent.STM.TMChan run :: WatchOpts -> IO () run = run' watcher . watchUrl -watcher :: TMVar (TVar DeveloperState) -> TMChan (Message Entered) -> TMChan AnyMessage -> SessionID -> IO () +watcher :: TMVar (TVar DeveloperState) -> TMChan (Message Entered) -> TMChan (MissingHashes AnyMessage) -> SessionID -> IO () watcher dsv _ichan ochan sid = withSessionLogger (Just "remote") sid $ \logger -> inRawMode $ do sk <- genMySessionKey (st, startoutput) <- processSessionStart sk ochan logger dsv |