Skip to content

Handling errorError -3 while decompressing data: invalid distance too far error #665

Closed
@bsergean

Description

@bsergean

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

stacktrace

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

  1. 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.
  2. Having the server advertize a smaller max_window_bits (14 instead of 15, or 13, etc...)
  3. 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.
  4. 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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions