Description
Problem
I am getting this error quite a bit in production: errorwebsockets.extensions.permessage_deflate in decode errorError -3 while decompressing data: invalid distance too far
My per message deflate settings are:
PerMessageDeflate(remote_no_context_takeover=False, local_no_context_takeover=False, remote_max_window_bits=15, local_max_window_bits=15)
The data to be decompressed is relatively small: [26, 92, 39, 167, 24, 89, 90, 32, 15, 212, 140, 158, 156, 50, 122, 114, 202]
.
I am getting a bunch of those errors and I'm not too sure on how to fix it, help troubleshoot it. Some internet threads suggest that this can be fixed by upgrading zlib. I have a feeling that the bug is more likely to be in my C++ websocket client code.
The client code talking to my websockets based server (cobra)[https://github.com/machinezone/cobra] is written in C++. Here are the zlib bits.
There is a thread about window size of size 8 being bogus. I don't think this is my problem because I am setting
Ideas
- I am thinking about setting a User Agent that report the OS Version + zlib version used, to see if this has anything to do with a platform specific bug.
- Having the server advertize a smaller max_window_bits (14 instead of 15, or 13, etc...)
- Should an exception be caught in the websocket transfer data code ? Should there be a new websockets dedicated 'DeflateDecodingError' ? All the messages contains a platform id. I don't currently have what I'd call a 'global' asyncio exception handler. Maybe I need one to handle that case.
- Making sure that my library (IXWebSocket) is autobahn compliant. I've looked at your compliance sub-folder, but I couldn't find anything related to the zlib extension there.
Thanks for any hints.
Some random links: