This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2020年05月06日 15:11 by vstinner, last changed 2022年04月11日 14:59 by admin.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 19958 | closed | vstinner, 2020年05月06日 15:38 | |
| PR 19961 | merged | vstinner, 2020年05月06日 15:57 | |
| Messages (8) | |||
|---|---|---|---|
| msg368262 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年05月06日 15:11 | |
To get one GIL per interpreter (bpo-40512), either PyObject.ob_refcnt member must become an atomic variable, or subinterpreters must not share any object. Right now, subinterpreters share Python objects. For example, PyModule_Type is declared statically and so shared by all interpreters and so PyModule_Type.tp_mro tuple is accessed in parallel by multiple interpreters. If PyObject.ob_refcnt is not atomic, Py_INCREF() and Py_DECREF() are unsafe and tp_mro tuple can be destroyed whereas it is still used. I propose to make PyObject.ob_refcnt atomic for now, when Python is built with EXPERIMENTAL_ISOLATED_SUBINTERPRETERS macro defined. It's a temporary workaround until subinterpreters stop sharing objects. |
|||
| msg368274 - (view) | Author: Eric Snow (eric.snow) * (Python committer) | Date: 2020年05月06日 16:08 | |
Yep, before per-interpreter GIL is official we must get to the point where *no* PyObject objects are shared. Making PyObject.ob_refcnt atomic until then (only as part of the experiment) should be fine. |
|||
| msg368276 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年05月06日 16:20 | |
> Yep, before per-interpreter GIL is official we must get to the point where *no* PyObject objects are shared. I would like to add: "no PyObject objects are shared in the stdlib" ;-) |
|||
| msg368279 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年05月06日 16:25 | |
New changeset d8135e913ab7c694db247c86d0a84c450c32d86e by Victor Stinner in branch 'master': bpo-40533: Disable GC in subinterpreters (GH-19961) https://github.com/python/cpython/commit/d8135e913ab7c694db247c86d0a84c450c32d86e |
|||
| msg380105 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年10月31日 23:05 | |
> For example, PyModule_Type is declared statically and so shared by all interpreters and so PyModule_Type.tp_mro tuple is accessed in parallel by multiple interpreters. Another example of this issue are parallel Py_INCREF/Py_DECREF calls on the tp_bases member of a type. |
|||
| msg388966 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2021年03月17日 20:51 | |
> To get one GIL per interpreter (bpo-40512), either PyObject.ob_refcnt member must become an atomic variable, or subinterpreters must not share any object. The current plan is to not share any object between two interpreters, so this PR is not needed. I close my PR 19958 which marked PyObject.ob_refcnt as atomic. |
|||
| msg408606 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2021年12月15日 14:49 | |
Until all Python stdlib C extensions and all third-party C extensions will be modified to no longer use and define static types and will stop shared Python objects between two interpreters, we can no longer micro-optimize the comparison of two interned strings by only comparing their memory addresse. See bpo-46006. |
|||
| msg410499 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2022年01月13日 17:32 | |
Sharing objects between multiple interpreters can cause complex bugs leading to crashes: https://bugs.python.org/issue46070#msg410493 For this specific bug, I wrote a workaround (GH-30577). |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:30 | admin | set | github: 84713 |
| 2022年01月13日 17:32:56 | vstinner | set | messages: + msg410499 |
| 2021年12月15日 14:49:20 | vstinner | set | messages: + msg408606 |
| 2021年03月17日 20:51:04 | vstinner | set | messages: + msg388966 |
| 2020年10月31日 23:05:40 | vstinner | set | messages: + msg380105 |
| 2020年05月15日 00:36:24 | vstinner | set | components:
+ Subinterpreters, - Interpreter Core title: Subinterpreters: don't share Python objects between interpreters -> [subinterpreters] Don't share Python objects between interpreters |
| 2020年05月06日 16:25:10 | vstinner | set | messages: + msg368279 |
| 2020年05月06日 16:20:33 | vstinner | set | messages: + msg368276 |
| 2020年05月06日 16:08:25 | eric.snow | set | messages: + msg368274 |
| 2020年05月06日 15:59:11 | vstinner | set | nosy:
+ eric.snow |
| 2020年05月06日 15:57:00 | vstinner | set | pull_requests: + pull_request19277 |
| 2020年05月06日 15:38:52 | vstinner | set | keywords:
+ patch stage: patch review pull_requests: + pull_request19274 |
| 2020年05月06日 15:31:45 | shihai1991 | set | nosy:
+ shihai1991 |
| 2020年05月06日 15:11:35 | vstinner | create | |