Skip to content

Fix FileExistsError when several processes make a tile cache at once - #2787

Open
jmineau wants to merge 1 commit into
SciTools:mainfrom
jmineau:fix-tile-cache-mkdir-race
Open

jmineau wants to merge 1 commit into
SciTools:mainfrom
jmineau:fix-tile-cache-mkdir-race

Conversation

@jmineau

@jmineau jmineau commented Oct 29, 2026

Copy link
Copy Markdown

Rationale

Closes #2782. Replaces #2783 (see the comment there).

GoogleWTS._load_cache checked that the cache directory was missing and then made it, so a process that lost the race to another one raised FileExistsError. This makes the directory and treats an existing one as already made. Unlike exist_ok=True, only the process that actually made the directory gives the "Cartopy created the following directory" warning.

Implications

None for a single process. The new test runs without the network: it makes the directory appear just before mkdir, and checks that no error or warning comes out.

I used Claude Code (an AI coding agent) for this change; I directed it and reviewed the diff.

GoogleWTS._load_cache checked that the cache directory was missing and
then made it, so a process that lost the race to another one raised
FileExistsError. Make the directory and treat an existing one as made,
so only the process that made it warns.

Closes SciTools#2782
@CLAassistant

CLAassistant commented Oct 29, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: FileExistsError when several processes create a cached tiler at once

2 participants