From eb6d27a74de87599272feb66855f5527d5382b6f Mon Sep 17 00:00:00 2001 From: vondravl Date: Fri, 6 Mar 2026 09:46:43 +0100 Subject: [PATCH] fix: use exist_ok=True in create_directory to prevent race condition `create_directory` uses a check-then-create pattern (`os.path.exists` + `os.makedirs`) which is not atomic. When multiple threads call `load_from_disk` on the same path concurrently (e.g. parallel workspace uploads), they race on creating directories like `analytical_dashboard_extensions`, causing `FileExistsError`. Replace with `os.makedirs(path, exist_ok=True)` which handles this atomically. Co-Authored-By: Claude Opus 4.6 --- packages/gooddata-sdk/src/gooddata_sdk/utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/gooddata-sdk/src/gooddata_sdk/utils.py b/packages/gooddata-sdk/src/gooddata_sdk/utils.py index eb4ea8f32..0586cea9b 100644 --- a/packages/gooddata-sdk/src/gooddata_sdk/utils.py +++ b/packages/gooddata-sdk/src/gooddata_sdk/utils.py @@ -166,8 +166,7 @@ def get_sorted_yaml_files(folder: Path) -> list[Path]: def create_directory(path: Path) -> None: - if not os.path.exists(path): - os.makedirs(path) + os.makedirs(path, exist_ok=True) def recreate_directory(path: Path) -> None: