Skip to content

fix(rest): make RestCatalog safe to share across threads - #22

Open
smaheshwar-pltr wants to merge 1 commit into
fix/rest-http-client-thread-safetyfrom
rest-catalog-thread-safety
Open

smaheshwar-pltr wants to merge 1 commit into
fix/rest-http-client-thread-safetyfrom
rest-catalog-thread-safety

Conversation

@smaheshwar-pltr

@smaheshwar-pltr smaheshwar-pltr commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Closes #21. Depends on #19.

AsCatalog() read and wrote the cached default catalog without a lock. That was the only state RestCatalog changed after Make(), so this guards it with a mutex and documents RestCatalog as thread-safe.

The new test shares one catalog between 16 threads. Under ASan it failed 6 of 8 runs without the mutex (use-after-free or failed calls) and passed 8 of 8 with it. CI doesn't run the REST integration tests under ASan.

🤖 Generated with Claude Code

@smaheshwar-pltr
smaheshwar-pltr force-pushed the fix/rest-http-client-thread-safety branch from 79e980e to 14c719e Compare September 25, 2026 21:44
@smaheshwar-pltr
smaheshwar-pltr force-pushed the rest-catalog-thread-safety branch from 01a8847 to 698aa5d Compare September 25, 2026 21:44
@smaheshwar-pltr smaheshwar-pltr changed the title fix(rest): guard RestCatalog::AsCatalog() cache and document thread safety fix(rest): make RestCatalog::AsCatalog() thread-safe Sep 25, 2026
@smaheshwar-pltr
smaheshwar-pltr force-pushed the rest-catalog-thread-safety branch from 698aa5d to 731ea55 Compare September 25, 2026 22:22
AsCatalog() read and wrote the cached default catalog without a lock,
so concurrent calls raced. It was the only state RestCatalog changed
after Make(). Guard it with a mutex and document RestCatalog as
thread-safe.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@smaheshwar-pltr
smaheshwar-pltr force-pushed the fix/rest-http-client-thread-safety branch from 14c719e to dee5b68 Compare September 25, 2026 23:14
@smaheshwar-pltr
smaheshwar-pltr force-pushed the rest-catalog-thread-safety branch from 731ea55 to b79dc0f Compare September 25, 2026 23:14
@smaheshwar-pltr smaheshwar-pltr changed the title fix(rest): make RestCatalog::AsCatalog() thread-safe fix(rest): make RestCatalog safe to share across threads Sep 25, 2026
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.

1 participant