-
Notifications
You must be signed in to change notification settings - Fork 17
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
use weakref in PROCESS_STACK #201
base: master
Are you sure you want to change the base?
Conversation
A weak reference to the process is used in order to avoid that the 'process stack' context variable itself can keep the process in memory. Asynchronous function executions scheduled by asyncio's `call_soon`, `call_later` or `call_at` get individual copies of the context, which stay in memory as long as the corresponding handler stays in memory (even if the execution was cancelled).
@muhrin I haven't looked through plumpy's test framework so far- I just checked and there didn't yet seem to be use cases of Perhaps you could suggest a short test that I can add here - i.e. using |
As I noted in aiidateam/aiida-core#4698 (comment), I'm not convinced this is a good solution |
It seems the tests agree with @chrisjsewell's sentiment... they're hanging Is it expected that processes simply hang when they encounter an issue like a missing reference? |
Hi @ltalirz , nice work in digging around for the cause of this. I do have to agree with @chrisjsewell , weak references should not be used in situations where they can result in an incorrect state which is clearly the case here. The stack here is just a symptom, not the cause. Would the |
fix aiidateam/aiida-core#4698 with suggestion by @greschd
A weak reference to the process is used in order to avoid that the
'process stack' context variable itself can keep the process in memory.
Asynchronous function executions scheduled by asyncio's
call_soon
,call_later
orcall_at
get individual copies of the context, whichstay in memory as long as the corresponding handler stays in memory
(even if the execution was cancelled).