Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] more clear error hint when number of open files exceeds the OS limit #979

Open
msyyc opened this issue Apr 1, 2024 · 1 comment

Comments

@msyyc
Copy link

msyyc commented Apr 1, 2024

There is a scenario we need to create many connection in Linux, but the error happens:

image

Here is simple code to reproduce:

import websocket

def create_client(idx):
    ws = websocket.create_connection(
        url="wss://xxxxxx",
        subprotocols=["xxx"],
    )
    print(f"{idx} done")
    return ws

ws_list = [create_client(i) for i in range(10000)]
for item in ws_list:
    item.close()

print("done")

The error hint is not clear so we don't know what's wrong. Finally, we infer that we may meet the file descriptor limit in Linux. Then we use ulimit -n xxx to increase the limit and the issue is fixed.

Here is aiohttp error hint in same scenario which is more clear:
image

So I expect websocket-client could promote the error hint in this scenario.

@engn33r
Copy link
Collaborator

engn33r commented Apr 10, 2024

This is a reasonable idea. I do not see this ulimit configuration in the docs but it has been mentioned in some past issues here and here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants