mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
agent: surface websocket errors in logs
The websocket interface used for `alloc exec` has to silently drop client send errors because otherwise those errors would interleave with the streamed output. But we may be able to surface errors that cause terminated websockets a little better in the HTTP server logs.
This commit is contained in:
@@ -556,10 +556,14 @@ func (s *HTTPServer) execStreamImpl(ws *websocket.Conn, args *cstructs.AllocExec
|
||||
handler(handlerPipe)
|
||||
// stop streaming background goroutines for streaming - but not websocket activity
|
||||
cancel()
|
||||
// retreieve any error and/or wait until goroutine stop and close errCh connection before
|
||||
// retrieve any error and/or wait until goroutine stop and close errCh connection before
|
||||
// closing websocket connection
|
||||
codedErr := <-errCh
|
||||
|
||||
// we won't return an error on ws close, but at least make it available in
|
||||
// the logs so we can trace spurious disconnects
|
||||
s.logger.Debug("alloc exec channel closed with error", "error", codedErr)
|
||||
|
||||
if isClosedError(codedErr) {
|
||||
codedErr = nil
|
||||
} else if codedErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user