Skip to content

test_profiling.test_gil_mode_integration_behavior() fails randomly on Windows #139970

@vstinner

Description

@vstinner

Example on the GitHub Action "Windows (free-threading) / Build and test (x64)": https://github.com/python/cpython/actions/runs/18432949393/job/52522695355?pr=139965

FAIL: test_gil_mode_integration_behavior (test.test_profiling.test_sampling_profiler.TestGilModeFiltering.test_gil_mode_integration_behavior)
Integration test: GIL mode should capture GIL-holding threads.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\cpython\cpython\Lib\test\test_profiling\test_sampling_profiler.py", line 2914, in test_gil_mode_integration_behavior
    self.assertIn("gil_holding_work", gil_mode_output)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

AssertionError: 'gil_holding_work' not found in 'Captured 101 samples in 0.50 seconds\n
Sample rate: 201.93 samples/sec\n
Error rate: 0.99%\n
\x1b[1;34mProfile Stats:\x1b[0m\n
\x1b[1;34m       nsamples\x1b[0m  \x1b[1;34m sample%\x1b[0m  \x1b[1;34mtottime (ms)\x1b[0m  \x1b[1;34m  cumul%\x1b[0m  \x1b[1;34mcumtime (ms)\x1b[0m  \x1b[1;34mfilename:lineno(function)\x1b[0m\n
          98/98      98.0       490.000      98.0       490.000  \x1b[32mthreading.py\x1b[0m:\x1b[33m362\x1b[0m(\x1b[36mCondition.wait\x1b[0m)\n
           0/98       0.0         0.000      98.0       490.000  \x1b[32mthreading.py\x1b[0m:\x1b[33m662\x1b[0m(\x1b[36mEvent.wait\x1b[0m)\n
           0/98       0.0         0.000      98.0       490.000  \x1b[32mthreading.py\x1b[0m:\x1b[33m1003\x1b[0m(\x1b[36mThread.start\x1b[0m)\n
           0/98       0.0         0.000      98.0       490.000  \x1b[32m<string>\x1b[0m:\x1b[33m22\x1b[0m(\x1b[36mmain\x1b[0m)\n
           0/98       0.0         0.000      98.0       490.000  \x1b[32m<string>\x1b[0m:\x1b[33m27\x1b[0m(\x1b[36m<module>\x1b[0m)\n
            1/1       1.0         5.000       1.0         5.000  \x1b[32m<frozen importlib._bootstrap_external>\x1b[0m:\x1b[33m1405\x1b[0m(\x1b[36mFileFinder.find_spec\x1b[0m)\n
            0/1       0.0         0.000       1.0         5.000  \x1b[32m<frozen importlib._bootstrap_external>\x1b[0m:\x1b[33m1278\x1b[0m(\x1b[36mPathFinder._get_spec\x1b[0m)\n
            0/1       0.0         0.000       1.0         5.000  \x1b[32m<frozen importlib._bootstrap_external>\x1b[0m:\x1b[33m1304\x1b[0m(\x1b[36mPathFinder.find_spec\x1b[0m)\n
            0/1       0.0         0.000       1.0         5.000  \x1b[32m<frozen importlib._bootstrap>\x1b[0m:\x1b[33m1267\x1b[0m(\x1b[36m_find_spec\x1b[0m)\n
            0/1       0.0         0.000       1.0         5.000  \x1b[32m<frozen importlib._bootstrap>\x1b[0m:\x1b[33m1341\x1b[0m(\x1b[36m_find_and_load_unlocked\x1b[0m)\n
            0/1       0.0         0.000       1.0         5.000  \x1b[32m<frozen importlib._bootstrap>\x1b[0m:\x1b[33m1379\x1b[0m(\x1b[36m_find_and_load\x1b[0m)\n
            1/1       1.0         5.000       1.0         5.000  \x1b[32m<frozen importlib._bootstrap>\x1b[0m:\x1b[33m75\x1b[0m(\x1b[36m_WeakValueDictionary.__init__.<locals>.KeyedRef.__new__\x1b[0m)\n
\n
\x1b[1;34mLegend:\x1b[0m\n
  \x1b[33mnsamples\x1b[0m: Direct/Cumulative samples (direct executing / on call stack)\n
  \x1b[33msample%\x1b[0m: Percentage of total samples this function was directly executing\n
  \x1b[33mtottime\x1b[0m: Estimated total time spent directly in this function\n
  \x1b[33mcumul%\x1b[0m: Percentage of total samples when this function was on the call stack\n
  \x1b[33mcumtime\x1b[0m: Estimated cumulative time (including time in called functions)\n
  \x1b[33mfilename:lineno(function)\x1b[0m: Function location and name\n'

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions