fix(connect): Remove erroneous event error message (#1500)
When a session is terminated by the user, the cancel session path is
triggered, in this path the websocket connection is closed. If the
connection is already closed, an EOF is returned. In this situation an
EOF is expected and should not be logged to the user.
Example log line:
{
"id": "ezqk6w9dOQ",
"source": "https://hashicorp.com/boundary/dev-controller/boundary-dev",
"specversion": "1.0",
"type": "error",
"data": {
"error": "failed to close WebSocket: failed to read frame header: EOF",
"error_fields": {},
"id": "e_n60YPsDkaj",
"version": "v0.1",
"op": "worker.(Worker).handleProxy",
"info": {
"msg": "error closing client connection"
}
},
"datacontentype": "text/plain",
"time": "2021-09-02T10:05:46.587513-07:00"
}
This commit is contained in:
1 parent
2c61bd4963
commit
4cdce29a84
1 file changed
+3
-2
@@ -3,6 +3,7 @@ package worker
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -152,12 +153,12 @@ func (w *Worker) handleProxy() http.HandlerFunc {
|
||||
_, err := session.Cancel(ctx, sessClient, sessionId)
|
||||
if err != nil {
|
||||
event.WriteError(ctx, op, err, event.WithInfoMsg("unable to cancel session"))
|
||||
if err = conn.Close(websocket.StatusInternalError, "unable to cancel session"); err != nil {
|
||||
if err = conn.Close(websocket.StatusInternalError, "unable to cancel session"); err != nil && !errors.Is(err, io.EOF) {
|
||||
event.WriteError(ctx, op, err, event.WithInfoMsg("error closing client connection"))
|
||||
}
|
||||
return
|
||||
}
|
||||
if err = conn.Close(websocket.StatusNormalClosure, "session canceled"); err != nil {
|
||||
if err = conn.Close(websocket.StatusNormalClosure, "session canceled"); err != nil && !errors.Is(err, io.EOF) {
|
||||
event.WriteError(ctx, op, err, event.WithInfoMsg("error closing client connection"))
|
||||
}
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user