aws / amazon-ssm-agent

An agent to enable remote management of your EC2 instances, on-premises servers, or virtual machines (VMs).
https://aws.amazon.com/systems-manager/
Apache License 2.0
1.06k stars 326 forks source link

Session manger dropping websocket connection after idling for around 5 minutes on mac #496

Open iamdavidmt opened 1 year ago

iamdavidmt commented 1 year ago

Hi

Having issues with ssm dropping connections after being idle for a few minutes. maybe worth noting we use a VPN and shared IP of multiple people; although linux users have no issues

command

aws ssm start-session \
    --region=$AWS_REGION \
    --target "$BASTION_INSTANCE_ID" \
    --document-name AWS-StartPortForwardingSessionToRemoteHost \
    --parameters "{\"portNumber\":[\"$REMOTE_PORT\"],\"localPortNumber\":[\"$LOCAL_PORT\"],\"host\":[\"$DB_HOST\"]}"

debug logs

2023-01-11 10:26:11 DEBUG An error happened when receiving the message. Retried times: 1, Error: websocket: close 1006 (abnormal closure): unexpected EOF, Messagetype: -1
2023-01-11 10:26:11 DEBUG An error happened when receiving the message. Retried times: 2, Error: websocket: close 1006 (abnormal closure): unexpected EOF, Messagetype: -1
2023-01-11 10:26:11 DEBUG An error happened when receiving the message. Retried times: 3, Error: websocket: close 1006 (abnormal closure): unexpected EOF, Messagetype: -1
2023-01-11 10:26:11 DEBUG An error happened when receiving the message. Retried times: 4, Error: websocket: close 1006 (abnormal closure): unexpected EOF, Messagetype: -1
2023-01-11 10:26:11 ERROR Reach the retry limit 5 for receive messages.
2023-01-11 10:26:11 ERROR Trying to reconnect the session: wss://ssmmessages.eu-west-1.amazonaws.com/v1/data-channel/notareal@email.com-0012f2843d51b1de6?role=publish_subscribe&cell-number=AAEAAXxVmmlUO9az0SCRpKGhs5fz5YUIwUv6w9W4xkT7g43PAAAAAGO+jlKhUFIv9ZcQq52bZU0pumK0xlG6doxUlG8jYWTDAHr9fg== with seq num: 5
2023-01-11 10:26:11 DEBUG Resume Session input parameters: {
  SessionId: "notareal@email.com-0012f2843d51b1de6"
}
2023-01-11 10:26:21 ERROR Resume Session failed: SerializationError: failed to unmarshal response error
    status code: 404, request id: 9b8badfa-4e5f-4f48-b9db-c84772b7a3af
caused by: UnmarshalError: failed decoding error message
    00000000  3c 55 6e 6b 6e 6f 77 6e  4f 70 65 72 61 74 69 6f  |<UnknownOperatio|
00000010  6e 45 78 63 65 70 74 69  6f 6e 2f 3e 0a           |nException/>.|

caused by: invalid character '<' looking for beginning of value