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

Don't call getpgid() when killing a test #72

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

Conversation

bket
Copy link

@bket bket commented Feb 25, 2020

OpenBSD's getpgid(2) fails with EPERM (PermissionError) because the test is in a different session: https://man.openbsd.org/getpgid.

e.g.:

________________________ CommonTests.test_basic_command ________________________
/usr/local/lib/python3.7/site-packages/tornado/testing.py:451: in tearDown
    super(AsyncHTTPTestCase, self).tearDown()
/usr/local/lib/python3.7/site-packages/tornado/testing.py:222: in tearDown
    self.__rethrow()
/usr/local/lib/python3.7/site-packages/tornado/testing.py:250: in __rethrow
    raise_exc_info(failure)
/usr/local/lib/python3.7/site-packages/tornado/stack_context.py:339: in wrapped
    ret = fn(*args, **kwargs)
/usr/local/lib/python3.7/site-packages/tornado/websocket.py:488: in on_connection_close
    self.on_close()
terminado/websocket.py:96: in on_close
    self.term_manager.client_disconnected(self)
terminado/management.py:281: in client_disconnected
    websocket.terminal.killpg(signal.SIGHUP)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <terminado.management.PtyWithClients object at 0x102077282a10>
sig = <Signals.SIGHUP: 1>

    def killpg(self, sig=signal.SIGTERM):
        """Send a signal to the process group of the process in the pty"""
        if os.name == 'nt':
            return self.ptyproc.kill(sig)
>       pgid = os.getpgid(self.ptyproc.pid)
E       PermissionError: [Errno 1] Operation not permitted

terminado/management.py:73: PermissionError

Use self.ptyproc.pid as the process group ID, because setsid() created a process group with the same ID as the process. See setsid(2) manuals:

OpenBSD's getpgid(2) fails with EPERM (PermissionError) because the test
is in a different session: https://man.openbsd.org/getpgid

Use self.ptyproc.pid as the process group ID, because setsid() created a
process group with the same ID as the process. See setsid(2) manuals:

 - FreeBSD: https://www.freebsd.org/cgi/man.cgi?query=setsid
 - illumos: https://illumos.org/man/setsid
 - Linux: http://man7.org/linux/man-pages/man2/setsid.2.html
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.

1 participant