You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def_log_telemetry_imported_packages(self) -> None:
ifself._log_imported_packages_in_telemetry:
# filter out duplicates caused by submodules# and internal modules with names starting with an underscore
> imported_modules = {
k.split(".", maxsplit=1)[0]
for k in sys.modules.keys()
ifnot k.startswith("_")
}
E RuntimeError: dictionary changed size during iteration
This thing can happen if you are running in a multithreaded environment. If another thread is importing a new package such that sys.modules is mutated while a new SnowflakeConnection is established this will raise such an exception. I haven't tried to reproduce it.
Converting the keys view to a list or set in the dictionary comprehension should guard against this
github-actionsbot
changed the title
Dictionary changed size during iteration when running in a multithreaded environment
SNOW-870802: Dictionary changed size during iteration when running in a multithreaded environment
Jul 18, 2023
Python version
3.10
Operating system and processor architecture
OSX
Installed packages
What did you do?
We encountered an exception in our dask-snowflake CI, see https://github.com/coiled/dask-snowflake/actions/runs/5581071003/jobs/10198820063
This thing can happen if you are running in a multithreaded environment. If another thread is importing a new package such that
sys.modules
is mutated while a newSnowflakeConnection
is established this will raise such an exception. I haven't tried to reproduce it.Converting the keys view to a list or set in the dictionary comprehension should guard against this
For example,
What did you expect to see?
No exception
Can you set logging to DEBUG and collect the logs?
No response
The text was updated successfully, but these errors were encountered: