[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-04-08 Thread STINNER Victor
STINNER Victor added the comment: > Also, someone did manage to investigate and identify a likely cause: > https://bugs.python.org/issue33608#msg342791 I made many changes in Python internals since bpo-33608 was reported. I am not aware of any recent issue with pending calls and so close the

[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-04-08 Thread STINNER Victor
STINNER Victor added the comment: I removed _pending_calls.finishing for multiple reasons: * _PyEval_AddPendingCall() used the C API whereas the caller may not hold the GIL. * bpo-40082: trip_signal() can be called from a thread which has no Python thread state. On Windows, CTRL+C calls trip

[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-04-08 Thread STINNER Victor
STINNER Victor added the comment: New changeset cfc3c2f8b34d3864717ab584c5b6c260014ba55a by Victor Stinner in branch 'master': bpo-37127: Remove _pending_calls.finishing (GH-19439) https://github.com/python/cpython/commit/cfc3c2f8b34d3864717ab584c5b6c260014ba55a --

[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-04-08 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-40082: trip_signal() gets NULL tstate on Windows on CTRL+C. -- ___ Python tracker ___ __

[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-04-08 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18793 pull_request: https://github.com/python/cpython/pull/19439 ___ Python tracker ___ __

[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-03-18 Thread STINNER Victor
STINNER Victor added the comment: New changeset 8849e5962ba481d5d414b3467a256aba2134b4da by Victor Stinner in branch 'master': bpo-39984: trip_signal() uses PyGILState_GetThisThreadState() (GH-19061) https://github.com/python/cpython/commit/8849e5962ba481d5d414b3467a256aba2134b4da -

[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-03-18 Thread STINNER Victor
STINNER Victor added the comment: trip_signal() has another problem. If pending->finishing is non-zero, _PyEval_AddPendingCall() uses the C API whereas the current thread may not hold the GIL. That's forbidden by the C API. The more I think about it, the more I think that pending->finishing

[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-03-18 Thread STINNER Victor
STINNER Victor added the comment: My notes on Python finalization: https://pythondev.readthedocs.io/finalization.html -- ___ Python tracker ___ __

[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-03-18 Thread STINNER Victor
STINNER Victor added the comment: > pending->finishing was addd in bpo-33608 by the change: commit > 842a2f07f2f08a935ef470bfdaeef40f87490cfc Since this change, Py_AddPendingCall() now requires the thread to have a Python thread state: it is used if pending->finishing is non-zero. The functi

[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-03-18 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +18415 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/19061 ___ Python tracker __

[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-03-17 Thread STINNER Victor
STINNER Victor added the comment: > In bpo-33608 I moved the pending calls to per-interpreter state. We saw > failures (sometimes sporadic) on a few buildbots (e.g. FreeBSD) during > runtime finalization. However, nearly all of the buildbots were fine, so it > may be a question of architec

[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-03-17 Thread STINNER Victor
STINNER Victor added the comment: In the master branch of Python, trip_signal() calls _PyEval_AddPendingCall(tstate) and tstate is get using _PyRuntimeState_GetThreadState(runtime). trip_signal() can be called while the GIL is not held: tstate is NULL in this case. For example, it's the cas

[issue37127] Handling pending calls during runtime finalization may cause problems.

2020-03-09 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue37127] Handling pending calls during runtime finalization may cause problems.

2019-06-01 Thread Eric Snow
Eric Snow added the comment: Also, someone did manage to investigate and identify a likely cause: https://bugs.python.org/issue33608#msg342791 -- ___ Python tracker ___ _

[issue37127] Handling pending calls during runtime finalization may cause problems.

2019-06-01 Thread Eric Snow
New submission from Eric Snow : In Python/lifecycle.c (Py_FinalizeEx) we call _Py_FinishPendingCalls(), right after we stop all non-daemon Python threads but before we've actually started finalizing the runtime state. That call looks for any remaining pending calls (for the main interpreter)