- Notifications
You must be signed in to change notification settings - Fork2.9k
Commit83c253e
committed
Fix race condition in concurrent artifact additions
This fixes a race condition where concurrent 'podman artifact add'commands for different artifacts would result in only one artifactbeing created, without any error messages.The root cause was in the artifact store's Add() method, whichwould:1. Acquire lock2. Read OCI layout index3. Create ImageDestination (which snapshots the index)4. RELEASE lock (optimization for blob copying)5. Copy blobs (while unlocked)6. Reacquire lock7. Commit changes (write new index)When two concurrent additions happened:- Process A: Lock → Read index → Create dest A → Unlock → Copy blobs- Process B: Lock → Read index (no artifact A!) → Create dest B → Unlock- Process A: Lock → Commit (write index with A)- Process B: Lock → Commit (write index with B, OVERWRITING A)The fix keeps the lock held for the entire operation. While thisreduces concurrency for blob copying, it prevents the index filecorruption that caused artifacts to be lost.Changes:- Remove lock release/reacquire around blob copying in store.Add()- Simplify lock management (no more conditional unlock)- Add e2e test for concurrent artifact additions- Add standalone test script to verify the fixFixes:#27569Generated-with: Cursor AISigned-off-by: Daniel J Walsh <dwalsh@redhat.com>1 parent7cd9b81 commit83c253e
File tree
2 files changed
+63
-12
lines changed- test/e2e
- vendor/go.podman.io/common/pkg/libartifact/store
2 files changed
+63
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
741 | 741 | | |
742 | 742 | | |
743 | 743 | | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
744 | 800 | | |
745 | 801 | | |
746 | 802 | | |
| |||
Lines changed: 7 additions & 12 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
0 commit comments
Comments
(0)