Repository navigation
fix: prevent concurrent TGT re-creation race under multi-threaded calls - #3
Merged
Merged
Conversation
Endpoint.__call__ creates a fresh Authentication() per request, so concurrent (ThreadPoolExecutor) calls from the same process each ran _setup_directories()'s unlocked permission-check/reset and unlocked _test_file_permissions() read - these could delete/recreate the shared tgt_dir/lock files out from under each other, breaking get_tgt()'s own locking and causing every thread to mint its own TGT (observed live: ~20 "Yeni TGT oluşturuldu" log lines within the same second for 20 concurrent calls). - _setup_directories(): destructive permission-check/reset now runs at most once per process (double-checked locking via _setup_lock + _verified_temp_dirs), instead of on every Authentication() construction. - _test_file_permissions(): tgt_dir/st_dir reads now happen under the same _locked() used by get_tgt()/_store_ticket(), so they can no longer race with a concurrent write. - Add regression test simulating 20 concurrent separate Authentication() constructions (matching real Endpoint.__call__ behavior) asserting exactly one TGT is created; fails with FileNotFoundError on the old code. - Bump version to 0.7.8-dev. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Endpoint.call creates a fresh Authentication() per request, so concurrent (ThreadPoolExecutor) calls from the same process each ran _setup_directories()'s unlocked permission-check/reset and unlocked _test_file_permissions() read - these could delete/recreate the shared tgt_dir/lock files out from under each other, breaking get_tgt()'s own locking and causing every thread to mint its own TGT (observed live: ~20 "Yeni TGT oluşturuldu" log lines within the same second for 20 concurrent calls).
Değişiklik Açıklaması
Bu PR'ın ne yaptığını açık ve öz bir şekilde açıklayın.
Değişiklik Türü
Lütfen ilgili kutucuğu işaretleyin:
İlgili Issue
Bu PR hangi issue'yu çözüyor? (varsa)
Closes #
Değişiklik Detayları
Ne Değişti?
Neden Değişti?
Değişikliğin nedenini açıklayın.
Nasıl Test Edildi?
Değişikliklerin nasıl test edildiğini açıklayın:
Test Sonuçları
Ekran Görüntüleri
Varsa, değişiklikleri gösteren ekran görüntüleri ekleyin.
Kontrol Listesi
PR göndermeden önce aşağıdakileri kontrol edin:
black,isort)Breaking Changes
Bu PR breaking change içeriyor mu?
Breaking Changes Detayları
Eğer breaking change varsa, detaylarını açıklayın:
Ek Notlar
Eklemek istediğiniz başka bir şey var mı?
Review Notları
Reviewer'lar için özel notlar (varsa):