Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue47219

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:asyncio with two interpreter instances
Type:behaviorStage:
Components:asyncioVersions:
process
Status:openResolution:
Dependencies:Superseder:
Assigned To:Nosy List: asvetlov, eric.snow, mbadaire, yselivanov
Priority:normalKeywords:

Created on2022-04-04 19:57 bymbadaire, last changed2022-04-11 14:59 byadmin.

Messages (1)
msg416694 -(view)Author: Matthias Badaire (mbadaire)Date: 2022-04-04 19:57
Hi,I have an issue when using asyncio and two interpreter instances each launched and used in a seperated thread. I am getting a asyncio loop for each thread .However asyncio is getting me the same loop because of this code in get_running_loop. Indeed when I have two interpreter, the ts_id would be the same for both my threads and therefore I will get the cached value of the first thread. cached_running_holder being static, it is the same value for all instances of interpreter.Maybe we should check if we are in the same interpreter or same thread ,.. I am not sure how it could be fixed. _asynciomodule.c:get_running_loop(PyObject **loop){    PyObject *rl;    PyThreadState *ts = _PyThreadState_GET();    uint64_t ts_id = PyThreadState_GetID(ts);    if (ts_id == cached_running_holder_tsid && cached_running_holder != NULL) {If it does not make sense, I have some sample code but it is not just 10 lines.
History
DateUserActionArgs
2022-04-11 14:59:58adminsetgithub: 91375
2022-04-04 20:38:00JelleZijlstrasetnosy: +eric.snow
2022-04-04 19:57:08mbadairecreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp