Skip to content

Release the thread lock when IPC acquisition fails - #2203

Merged
micafer merged 4 commits into
apache:trunkfrom
zhechen-cs:codex/local-lock-acquisition-cleanup
Nov 7, 2026
Merged

micafer merged 4 commits into
apache:trunkfrom
zhechen-cs:codex/local-lock-acquisition-cleanup

Conversation

@zhechen-cs

Copy link
Copy Markdown
Contributor

Description

Release the thread lock when LockLocalStorage cannot acquire its IPC lock. A failed __enter__ never reaches __exit__, so the previous code left the thread lock held after a timeout, acquisition error or interruption, preventing reuse of the same lock object.

Regression coverage verifies cleanup and successful reuse after each failure, while preserving the original exceptions. This is independent of the lock-file cleanup in #2172.

Fixes #2202

Status

Ready for review.

Validation

  • Local and base storage tests: 33 passed, 3 subtests passed (Python 3.12).
  • All three regression cases fail on unmodified production code because the thread lock stays held.
  • Black, isort, flake8, pylint and git diff --check pass for the changed files.
  • Live cloud integration tests were not run.

Checklist

  • Code linting
  • Documentation (no public API change)
  • Tests
  • ICLA (small bug fix)

@codecov-commenter

codecov-commenter commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.59%. Comparing base (647d5a7) to head (21b4561).

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #2203      +/-   ##
==========================================
+ Coverage   83.58%   83.59%   +0.01%     
==========================================
  Files         352      352              
  Lines       82131    82150      +19     
  Branches     8812     8818       +6     
==========================================
+ Hits        68649    68671      +22     
+ Misses      10607    10606       -1     
+ Partials     2875     2873       -2     
Files with missing lines Coverage Δ
libcloud/storage/drivers/local.py 77.95% <100.00%> (+1.55%) ⬆️
libcloud/test/storage/test_local.py 91.93% <100.00%> (+0.33%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@micafer

micafer commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Please add the entry in the changelog.

@zhechen-cs

Copy link
Copy Markdown
Contributor Author

Done, thanks @micafer !

@micafer micafer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@micafer
micafer enabled auto-merge November 7, 2026 18:49
@micafer
micafer merged commit a8add70 into apache:trunk Nov 7, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local storage retains its thread lock after IPC acquisition fails

3 participants