Skip to content
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

memory leaks: don't pass process stack via context #4699

Merged
merged 16 commits into from
Feb 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion aiida/engine/transports.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import traceback
from typing import Awaitable, Dict, Hashable, Iterator, Optional
import asyncio
import contextvars

from aiida.orm import AuthInfo
from aiida.transports import Transport
Expand Down Expand Up @@ -96,7 +97,7 @@ def do_open():
transport_request.future.set_result(transport)

# Save the handle so that we can cancel the callback if the user no longer wants it
open_callback_handle = self._loop.call_later(safe_open_interval, do_open)
open_callback_handle = self._loop.call_later(safe_open_interval, do_open, context=contextvars.Context())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment here about why it is (currently) necessary to set a specific context

Copy link
Member

@chrisjsewell chrisjsewell Feb 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it also appears that context is not part of the AbstractEventLoop 🤔 :

aiida/engine/transports.py:100: error: Unexpected keyword argument "context" for "call_later" of "AbstractEventLoop" [call-arg]

you will need to add type: ignore[call-arg]


try:
transport_request.count += 1
Expand Down