Skip to content

bpo-46709: fix race conditions in unittest/test_brake #31273

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

Closed
wants to merge 1 commit into from

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Feb 11, 2022

Affected tests:

  • ./python.exe -m test -m unittest.test.test_break.TestBreakDefaultIntHandler.testInterruptCaught test_unittest -F
  • ./python.exe -m test -m unittest.test.test_break.TestBreakDefaultIntHandler.testSecondInterrupt test_unittest -F
  • ./python.exe -m test -m unittest.test.test_break.TestBreakDefaultIntHandler.testTwoResults test_unittest -F
  • ./python.exe -m test -m unittest.test.test_break.TestBreakDefaultIntHandler.testHandlerReplacedButCalled test_unittest -F

Before:
Снимок экрана 2022-02-11 в 12 05 51

After (manually terminated):
Снимок экрана 2022-02-11 в 12 05 35

I simply re-arranged assert statements to make this pass: https://docs.python.org/3/library/signal.html#execution-of-python-signal-handlers

Maybe there's something more clever to do instead? 🙂

https://bugs.python.org/issue46709

@kumaraditya303
Copy link
Contributor

The tests were passing before so I guess it might have be caused due to a missing eval breaker in ceval.c in specialised bytecode to check for signals. Perhaps you can git bisect to see if this is the case?

@sobolevn
Copy link
Member Author

The tests were passing before

They are still passing. Take a look:

Снимок экрана 2022-02-11 в 13 12 24

But, they are flaky.

it might have be caused due to a missing eval breaker in ceval.c in specialised bytecode to check for signals. Perhaps you can git bisect to see if this is the case?

I will take a look if there were recent changes. Thanks for the idea! 👍

@sobolevn
Copy link
Member Author

sobolevn commented Feb 11, 2022

git bisect shows that this is the first failing commit: 3163e68

» git bisect good
3163e68c342434db37c69669017f96a4bb2d5f13 is the first bad commit
commit 3163e68c342434db37c69669017f96a4bb2d5f13
Author: Ken Jin <[email protected]>
Date:   Wed Oct 20 07:16:36 2021 +0800

    [bpo-44525](https://bugs.python.org/issue44525): Specialize ``CALL_FUNCTION`` for C function calls (GH-26934)

 Include/internal/pycore_code.h                     |   1 +
 Include/opcode.h                                   |  51 +++----
 Lib/opcode.py                                      |   5 +
 .../2021-06-28-22-23-59.[bpo-44525](https://bugs.python.org/issue44525).sSvUKG.rst       |  10 ++
 Python/ceval.c                                     | 147 +++++++++++++++++++++
 Python/opcode_targets.h                            |  54 ++++----
 Python/specialize.c                                | 147 +++++++++++++++++++++
 7 files changed, 365 insertions(+), 50 deletions(-)
 create mode 100644 Misc/NEWS.d/next/Core and Builtins/2021-06-28-22-23-59.[bpo-44525](https://bugs.python.org/issue44525).sSvUKG.rst

CC @Fidget-Spinner

@sobolevn
Copy link
Member Author

I think the proper fix would be adding CHECK_EVAL_BREAKER(); into specialized CALL_NO_KW_ opcodes. Testing this out 🤔

@sobolevn
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants