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

pytest-server-fixtures: Support large pids in xvfb #250

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

Conversation

s-t-e-v-e-n-k
Copy link
Contributor

Since a large number of 64 bit distributions are now using larger PIDs than 65535 by default, and the xvfb fixtures makes the assumption that PIDs are going to be less than that, check what the maximum is, falling back to 65535 if we can't.

Since a large number of 64 bit distributions are now using larger PIDs
than 65535 by default, and the xvfb fixtures makes the assumption that
PIDs are going to be less than that, check what the maximum is, falling
back to 65535 if we can't.
@@ -43,7 +43,10 @@ class XvfbServer(object):

def __init__(self):
tmpdir = mkdtemp(prefix='XvfbServer.', dir=Workspace.get_base_tempdir())
for servernum in range(os.getpid(), 65536):
pid_max = 65536
with open('/proc/sys/kernel/pid_max') as pid_max_file:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this guaranteed to exist on all Linux distributions? We should probably safely fall back to 65536 if the file doesn't exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do fall back, it's set before we open the /proc file. That /proc file was added sometime in 2.5, so it should exist, but it may throw an exception if /proc isn't mounted -- but we probably have bigger problems in that case.

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.

2 participants