-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Maybe Drop "channels" from _xxsubinterpreters #101524
Comments
This is a bummer. It was one of the few demonstrable benefits of subinterpreters. It seems that we're left with only the most ancient and awkward forms of communcation, shared file descriptors and pipes. Almost nothing in CSP can be readily expressed with those low level tools. Side note: The PEP seems significantly understate the impact of isolating modules, "This situation is limited to modules that use C globals (or use libraries that use C globals) to store internal state.". As Erland Aasland sweeps through standard library making edits, the cost is becoming clear. Even simple stateless modules like So far, this massive effort seems like all cost and no benefit. Gaining Go-like or CSP-like channels would have been the one win. Otherwise, all we left with is the questionable benefit of "looking like one process to the O/S". It isn't clear at all that that is something we want to pay for. The cost/benefit proposition of PEP 554 has changed considerably since the beginning. The code churn is huge and is taking many man-months of time. Meanwhile the proposed benefits are down to "looks like a single process" and "ability to experiment with new concurrency models". |
Note that the changes you mention are needed to properly support
PEP 554 exposes the ancient functionality to Python code. Withoun channels its benefit decreases (or rather, is moved to a future PEP as this one is too long), but the cost is unrelated to PEP 554. So where to express concerns with “isolation” changes? Please read https://docs.python.org/3/howto/isolating-extensions.html, and open a Discourse discussion if you disagree with anything there or if the changes do more than necessary. (FWIW, I do think we should be a little more conservative/careful and invest more in groundwork so the individual changes aren't as invasive -- but on the other hand I don't want to stop people from improving things. The groundwork for fixing static types, for example, would probably be multi-year effort with uncertain results.) |
Thanks for speaking up about this, Raymond. I removed channels from PEP 554 because readers kept getting lost in that part of the proposed API and my descriptions and examples. Ultimately, I'm still not sure the API is quite right. Furthermore, it isn't a good sign that the implementation is so complex. That said, I still think channels (or whatever we call them) are the best primitive for the concurrency model and anticipate they will be part of the stdlib sooner rather than later. I just don't want PEP 554 to be held up by that. In the meantime, we can give the channels design some time to bake on PyPI. FWIW, I'm open to more discussion on this if you think channels are important enough to keep in PEP 554. Just keep in mind that I'm hoping to have PEP 554 accepted in time for 3.12.
Petr has covered everything I would have said. |
I think it is wise to leave channels out of PEP-554, leaving the resulting PEP more focused, especially since it is targeting 3.12.
This sounds like a very good path forward.
+1 |
AFAICS, we can close this. |
Thus far I've only split out an _xxinterpchannels module. I haven't removed it. It might still be worth keeping for testing purposes (it has uncovered various bugs), regardless of PEP 554. |
FWIW, I'm fine with keeping it; having a broad test suite is never a bad idea. |
* main: (50 commits) pythongh-102674: Remove _specialization_stats from Lib/opcode.py (python#102685) pythongh-102660: Handle m_copy Specially for the sys and builtins Modules (pythongh-102661) pythongh-102354: change python3 to python in docs examples (python#102696) pythongh-81057: Add a CI Check for New Unsupported C Global Variables (pythongh-102506) pythonGH-94851: check unicode consistency of static strings in debug mode (python#102684) pythongh-100315: clarification to `__slots__` docs. (python#102621) pythonGH-100227: cleanup initialization of global interned dict (python#102682) doc: Remove a duplicate 'versionchanged' in library/asyncio-task (pythongh-102677) pythongh-102013: Add PyUnstable_GC_VisitObjects (python#102014) pythonGH-102670: Use sumprod() to simplify, speed up, and improve accuracy of statistics functions (pythonGH-102649) pythongh-102627: Replace address pointing toward malicious web page (python#102630) pythongh-98831: Use DECREF_INPUTS() more (python#102409) pythongh-101659: Avoid Allocation for Shared Exceptions in the _xxsubinterpreters Module (pythongh-102659) pythongh-101524: Fix the ChannelID tp_name (pythongh-102655) pythongh-102069: Fix `__weakref__` descriptor generation for custom dataclasses (python#102075) pythongh-98169 dataclasses.astuple support DefaultDict (python#98170) pythongh-102650: Remove duplicate include directives from multiple source files (python#102651) pythonGH-100987: Don't cache references to the names and consts array in `_PyEval_EvalFrameDefault`. (python#102640) pythongh-87092: refactor assemble() to a number of separate functions, which do not need the compiler struct (python#102562) pythongh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (python#102631) ...
…le (pythongh-105258) The _xxsubinterpreters module was meant to only use public API. Some internal C-API usage snuck in over the last few years (e.g. pythongh-28969). This fixes that. (cherry picked from commit e6373c0) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
…-107359) The _xxsubinterpreters module should not rely on internal API. Some of the functions it uses were recently moved there however. Here we move them back (and expose them properly).
From #107359:
To expose unstable API properly, it needs documentation and tests. Are you planning to add those? |
I will. |
See gh-107784. |
Documentation has been split out to a separate issue. IIRC, there is already an issue regarding test coverage for subinterpreters. Given this, I don't see the need for holding this issue open anymore; I recommend closing this issue. |
The
_xxsubinterpreters
module is essentially the low-level implementation of PEP 554. However, we added it a while back for testing purposes, especially to further exercise the runtime relative to subinterpreters. Since then, I've removed "channels" from PEP 554. So it may make sense to drop that part of the implementation. That part of Modules/_xxsubinterpretersmodule.c is much more code and certainly much more complex than the basic functionality the PEP now describes.Linked PRs
The text was updated successfully, but these errors were encountered: