Query.Exec: Log error when talking to job process fails
authorNiklas Hambuechen <niklash@google.com>
Thu, 7 Aug 2014 17:17:13 +0000 (19:17 +0200)
committerPetr Pudlak <pudlak@google.com>
Tue, 17 Mar 2015 17:48:18 +0000 (18:48 +0100)
When the forked (Python) job process dies for any reason, then the next `read`
from its pipe will fail, giving an unhelpful error like:

   GenericError "<file descriptor: 13>: hWaitForInput: end of file"

This commit adds an error log message when reading or writing the
pipe fails.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Signed-off-by: Klaus Aehlig <aehlig@google.com>

Conflicts:
src/Ganeti/Query/Exec.hs - merge changes from both branches

Cherry-picked-from: 208c6166d9176e36495ce3d8dff9a649662e72f5
Signed-off-by: Petr Pudlak <pudlak@google.com>
Signed-off-by: Klaus Aehlig <aehlig@google.com>

src/Ganeti/Query/Exec.hs

index 73ae68c..23830ca 100644 (file)
@@ -249,7 +249,13 @@ forkJobProcess jid luxiLivelock update = do
       . (`mplus` (onError >> mzero))
       $ do
       let recv = liftIO $ recvMsg master
-          send = liftIO . sendMsg master
+                   `onException`
+                   logError "recv from ganeti job process pipe failed"
+
+          send x = liftIO $ sendMsg master x
+                     `onException`
+                     logError "send to ganeti job process pipe failed"
+
       logDebugJob "Getting the lockfile of the client"
       lockfile <- recv `orElse` mzero