Skip to content

DEDICATED_DECOMPRESSOR is broken #633

Closed

Description

@jdelk

I saw this issue posted here: uNetworking/uWebSockets#1347

I tried using DEDICATED_DECOMPRESSOR in node like this (using uWebsockets.js 20.1.0 with Node.js 16.12.0):

uWS.App().ws('/*', {
    idleTimeout: 0,
    maxBackpressure: 100 * 1024 * 1024,
    maxPayloadLength: 100 * 1024 * 1024,
    compression: (uWS.DEDICATED_COMPRESSOR_3KB | uWS.DEDICATED_DECOMPRESSOR),

    upgrade: (res, req, context) => {
    res.upgrade({
        "cookie": req.getHeader("cookie"),
        "user-agent": req.getHeader("user-agent")
    },
        req.getHeader('sec-websocket-key'),
        req.getHeader('sec-websocket-protocol'),
        req.getHeader('sec-websocket-extensions'),
        context);
    },

    message: (ws, message, isBinary) => {
        ws.send(message, true, true);
    },

    close: (ws, code, message) => {
        console.log("disconnected:", code, Buffer.from(message).toString());
    }

After the client sends 2 messages to the server, the server disconnects the client

Here's the message when the websocket closes:

1006 Received too big message, or other inflation error

Am I just using DEDICATED_DECOMPRESSOR wrong?

Thanks

Activity

  1. jdelk commented on Oct 28, 2021

    @jdelk
    Author

    Here's the full code that still reproduces it:

    const uWS = require('uWebSockets.js');
    
    uWS.App().ws('/*', {
        idleTimeout: 0,
        maxBackpressure: 100 * 1024 * 1024,
        maxPayloadLength: 100 * 1024 * 1024,
        compression: (uWS.DEDICATED_COMPRESSOR_3KB | uWS.DEDICATED_DECOMPRESSOR),
    
        message: (ws, message, isBinary) => {
          ws.send(message, true, true);
        },
    
        close: (ws, code, message) => {
            console.log("disconnected user:", code, Buffer.from(message).toString());
        }
        
      }).listen(9001, (listenSocket) => {
      
        if (listenSocket) {
          console.log('Listening to port 9001');
        }
        
      });
    

    Tested this using uWebsockets 20.2.0 as well, same version of Node (16.12.0), using Safari 15.1 on MacOS Monterey as the client.

    The same issue happens in Chrome as well if compression is set to (uWS.DEDICATED_COMPRESSOR_3KB | uWS.DEDICATED_DECOMPRESSOR), so the client doesn't matter here. It's just using these options as the compression that causes the issue.

    I'm still getting this when a 2nd message is sent:

    disconnected user: 1006 Received too big message, or other inflation error

    It doesn't seem to happen for all messages I send for some reason, but it's consistently reproducible when you send the message "1111111" twice; the 2nd message will always fail and show the above 1006 reason for closing the websocket.

  2. ghost added
    bugSomething isn't working
    on Oct 28, 2021
  3. ghost changed the title [-]Compression broken in Safari 15[/-] [+]DEDICATED_DECOMPRESSOR is broken[/+] on Oct 28, 2021
  4. ghost closed this as completedon Oct 30, 2021
  5. jdelk commented on Oct 31, 2021

    @jdelk
    Author

    Thanks for looking at this so quickly

    After retrying the same code I used above, I get the error Segmentation fault (core dumped) after sending a few messages (of any length).

    The client also never receives any message sent from the server.

    Using uWebsockets 20.3.0 on Node.js 16.12.0

    I've tried with the following compression options:

    compression: uWS.DEDICATED_COMPRESSOR_3KB,

    compression: (uWS.DEDICATED_COMPRESSOR_3KB | uWS.DEDICATED_DECOMPRESSOR),

    It seems that compression is broken completely now, if I use uWS.DISABLED it works fine.

  6. jdelk commented on Oct 31, 2021

    @jdelk
    Author

    v20.4.0 works perfectly

    Thanks for fixing it so quickly.

    Love all the work you're doing with uWS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions