Issue seen with websocket connection

Summary

Seeing an issue with websocket connections keepalive (ping/pong)

Steps to reproduce

Send a ping FRAME with arbitrary data payload.

Expected behavior

Server should not try and decode the data payload in the ping

Observed behavior

Serve reports an error

{"level":"debug","ts":1616436915.28949,"caller":"app/web_conn.go:202","msg":"Error while reading message from websocket","error":"error during decoding websocket message: invalid character 'Ð' looking for beginning of value","errorVerbose":"invalid character 'Ð' looking for beginning of value\nerror during decoding websocket message\ngithub.com/mattermost/mattermost-server/v5/app.(*WebConn).ReadMsg\n\tgithub.com/mattermost/mattermost-server/v5/app/web_conn.go:269\ngithub.com/mattermost/mattermost-server/v5/app.(*WebConn).startPoller.func1.1\n\tgithub.com/mattermost/mattermost-server/v5/app/web_conn.go:200\nruntime.goexit\n\truntime/asm_amd64.s:1374"}

Here is the ping() frame sent from the client:

DEBUG:websockets.protocol:client > Frame(fin=True, opcode=9, data=b'\xd0\xe2M\xd4', rsv1=False, rsv2=False, rsv3=False)
client ! timed out waiting for pong

By the way this was reproduced using the latest Team edition version 5.33.1

For more info please take a look at these issues on Github:

1 Like

Confirmed that the issue is not present in 5.32.1

Here is the log from the working ping/pong using that version

client > Frame(fin=True, opcode=9, data=b'\xa27\xd0\x08', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client > Frame(fin=True, opcode=9, data=b'\xa27\xd0\x08', rsv1=False, rsv2=False, rsv3=False)
client - event = data_received(<6 bytes>)
DEBUG:websockets.protocol:client - event = data_received(<6 bytes>)
client < Frame(fin=True, opcode=10, data=b'\xa27\xd0\x08', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client < Frame(fin=True, opcode=10, data=b'\xa27\xd0\x08', rsv1=False, rsv2=False, rsv3=False)
client - received solicited pong: a237d008
DEBUG:websockets.protocol:client - received solicited pong: a237d008

FYI on this @agnivade ^

Related Github issue Websocket handling: client side pings kill ws-connection. · Issue #17197 · mattermost/mattermost-server · GitHub

1 Like

Thanks for the report @attzonko ! I have replied in the linked GitHub issue.

2 Likes