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

libvncserver: fix hanging on connection if fd limit is too high. #626

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ethan-vanderheijden
Copy link

@ethan-vanderheijden ethan-vanderheijden commented Jul 24, 2024

Fixes #600

Before a connection is established, libvncserver will loop from 0 -> <max possible file descriptor> and count how many file descriptors are currently in use. The file descriptor limit is usually 1024, so this doesn't take too long, but when you run this inside a Docker container, Docker will set the limit to one million or one billion.

This is similar to a bug in Red Hat Package Manager (rpm), and their solution was to count the number of files inside /proc/self/fd instead (see rpm-software-management/rpm#444). This solution only works on Linux, but then again, the current behavior of looping over file descriptors and calling fctnl isn't particularly portable either.

If you need, I can add fallback code for non-Linux machines.

@ethan-vanderheijden ethan-vanderheijden changed the title libvncserver: fix hanging on connecction if fd limit is too high. libvncserver: fix hanging on connection if fd limit is too high. Jul 25, 2024
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

Successfully merging this pull request may close these issues.

Incredibly high RLIMIT_NOFILE results in minutes of initial connection delay
1 participant