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

subprocess unit tests for kill, term and send_signal flaky #47026

Closed
tiran opened this issue May 6, 2008 · 11 comments
Closed

subprocess unit tests for kill, term and send_signal flaky #47026

tiran opened this issue May 6, 2008 · 11 comments
Assignees
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@tiran
Copy link
Member

tiran commented May 6, 2008

BPO 2777
Nosy @tiran, @benjaminp, @ezio-melotti, @briancurtin, @florentx
Files
  • issue2777.patch: patch against trunk r77358
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/tiran'
    closed_at = <Date 2010-03-08.14:26:06.823>
    created_at = <Date 2008-05-06.23:40:54.777>
    labels = ['type-bug', 'tests']
    title = 'subprocess unit tests for kill, term and send_signal flaky'
    updated_at = <Date 2010-03-08.14:26:06.821>
    user = 'https://github.com/tiran'

    bugs.python.org fields:

    activity = <Date 2010-03-08.14:26:06.821>
    actor = 'flox'
    assignee = 'christian.heimes'
    closed = True
    closed_date = <Date 2010-03-08.14:26:06.823>
    closer = 'flox'
    components = ['Tests']
    creation = <Date 2008-05-06.23:40:54.777>
    creator = 'christian.heimes'
    dependencies = []
    files = ['15777']
    hgrepos = []
    issue_num = 2777
    keywords = ['patch', 'needs review']
    message_count = 11.0
    messages = ['66347', '70356', '95157', '97370', '99042', '100189', '100190', '100420', '100425', '100440', '100645']
    nosy_count = 5.0
    nosy_names = ['christian.heimes', 'benjamin.peterson', 'ezio.melotti', 'brian.curtin', 'flox']
    pr_nums = []
    priority = 'critical'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue2777'
    versions = ['Python 2.6', 'Python 3.1', 'Python 2.7', 'Python 3.2']

    @tiran
    Copy link
    Member Author

    tiran commented May 6, 2008

    The unit tests for the kill, term and send_signal methods of the
    subprocess.Popen object are still flaky and sometimes cause the test
    suite to hang. I'm going to disable them for the upcoming alpha until
    I've found a better solution.

    @tiran tiran self-assigned this May 6, 2008
    @tiran tiran added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels May 6, 2008
    @benjaminp
    Copy link
    Contributor

    What's the status of this?

    @briancurtin
    Copy link
    Member

    I re-enabled the tests a few days ago and haven't seen any issues on
    Windows or Linux. I attached a patch against r76222 which enables the
    kill, term, and send_signal tests again, and also did some clean-up and
    updating to the way tests are skipped.

    I also changed the assertNotEqual at the end of the kill, term, and
    send_signal tests to check against None instead of 0. I *think* it
    should be checking against None there to make sure that the subprocess
    isn't live anymore (where None would mean that it is).

    Let me know what you think and if this needs anything else.

    @briancurtin
    Copy link
    Member

    Minor patch change

    @florentx
    Copy link
    Mannequin

    florentx mannequin commented Feb 8, 2010

    The patch looks fine.
    +1 to enable on trunk and follow the buildbots' behavior.

    @florentx
    Copy link
    Mannequin

    florentx mannequin commented Feb 27, 2010

    Patch based on Brian's patch, with additional cleanup, and use new unittest helpers: skipUnless, assertRaises.

    And create a custom helper assertStderrEqual instead of "remove_stderr_debug_decorations" for debug builds.

    @florentx
    Copy link
    Mannequin

    florentx mannequin commented Feb 27, 2010

    Cleanup patch applied on r78508.
    I will probably try to enable the tests on trunk.

    @florentx
    Copy link
    Mannequin

    florentx mannequin commented Mar 4, 2010

    I experienced this hang with Linux AMD64.

    It occurs in test_send_signal.
    It is because signal.SIGINT is not always handled (see bpo-3137).

    As a workaround, there's 2 choices: add a delay between Popen and send_signal, or retry SIGINT 2 or 3 times.

    Windows should not be affected, because it uses signal SIGTERM in the test.

    @florentx
    Copy link
    Mannequin

    florentx mannequin commented Mar 4, 2010

    Re-enabled on r78662 and r78663.
    Buildbots seems happy, except Windows XP + Cygwin buildbot:

    ======================================================================
    FAIL: test_kill (test.test_subprocess.Win32ProcessTestCase)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "D:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_subprocess.py", line 768, in test_kill
        self.assertNotEqual(p.wait(), 0)
    AssertionError: 0 == 0

    ======================================================================
    FAIL: test_send_signal (test.test_subprocess.Win32ProcessTestCase)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "D:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_subprocess.py", line 761, in test_send_signal
        self.assertNotEqual(p.wait(), 0)
    AssertionError: 0 == 0

    ======================================================================
    FAIL: test_terminate (test.test_subprocess.Win32ProcessTestCase)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "D:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_subprocess.py", line 775, in test_terminate
        self.assertNotEqual(p.wait(), 0)
    AssertionError: 0 == 0

    @florentx
    Copy link
    Mannequin

    florentx mannequin commented Mar 4, 2010

    ...and it hangs somewhere on ia64 Ubuntu.
    http://www.python.org/dev/buildbot/all/builders/ia64%20Ubuntu%203.x/builds/557

    @florentx
    Copy link
    Mannequin

    florentx mannequin commented Mar 8, 2010

    All this flakiness is fixed:

    • r78736, r78759, r78761, r78767, r78788, r78789 on 2.x
    • r78797 on 3.x

    Note: because of bpo-3137, the send_signal(SIGINT) is retried 2 times on some platforms.

    @florentx florentx mannequin closed this as completed Mar 8, 2010
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants