Skip to content

Blocking sending via websocket #501

@rakhmaevao

Description

@rakhmaevao

Description

If I display a large image in a script, it leads to the formation of a huge message via websocket.

A large message blocks event loop because the message is compressed using zlib in websockets library. This is CPU bound operation.

I saw that compression is disabled by default in Jupiter_server (see hear). Because of this, there is no such problem in it. I tried to enable compression there. There, the loop element also began to hang.

Thus, I consider it important to disable compression for us too.

Unfortunately I have not found a way to do this other than making corrections in anycorn. I created a issue in hypercorn (see hear).

Please discuss this issue. Is it possible to make a correction in anycorn directly? Need to remove the hardcode of compression extension installation. I checked - it works.

Reproduce

As an example, you can use this code, placing a 10+ MB image next to it.

from PIL import Image
Image.open('/user/image.jpg')

In parallel, you can run a ping to the status handle. It will hang while the image is being sent.

Expected behavior

Pings will work, since event loop will be switched.

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