Skip to content

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

Closed

Description

@tiran
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']

    Activity

    1. tiran commented on May 6, 2008

      @tiran
      MemberAuthor

      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.

    2. self-assigned this
      on May 6, 2008
    3. added
      testsTests in the Lib/test dir
      type-bugAn unexpected behavior, bug, or error
      on May 6, 2008
    4. benjaminp commented on Jul 28, 2008

      @benjaminp
      Contributor

      What's the status of this?

    5. briancurtin commented on Nov 12, 2009

      @briancurtin
      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.

    6. briancurtin commented on Jan 7, 2010

      @briancurtin
      Member

      Minor patch change

    7. florentx commented on Feb 8, 2010

      florentxmannequin
      Mannequin

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

    8. florentx commented on Feb 27, 2010

      florentxmannequin
      Mannequin

      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.

    9. florentx commented on Feb 27, 2010

      florentxmannequin
      Mannequin

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

    10. florentx commented on Mar 4, 2010

      florentxmannequin
      Mannequin

      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.

    11. florentx commented on Mar 4, 2010

      florentxmannequin
      Mannequin

      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
    12. florentx commented on Mar 4, 2010

      florentxmannequin
      Mannequin
    13. florentx commented on Mar 8, 2010

      florentxmannequin
      Mannequin

      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.

    14. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions