Skip to content

storage/lockfile: shorten the sleeps in TestLockfileMixedConcurrent - #1037

Open
vtushar06 wants to merge 1 commit into
podman-container-tools:mainfrom
vtushar06:lockfile-test-sleep
Open

storage/lockfile: shorten the sleeps in TestLockfileMixedConcurrent#1037
vtushar06 wants to merge 1 commit into
podman-container-tools:mainfrom
vtushar06:lockfile-test-sleep

Conversation

@vtushar06

@vtushar06 vtushar06 commented Jul 29, 2026

Copy link
Copy Markdown

Closes #1016.

The 50 writers hold the lock exclusively, so 50 writers x 10 iterations x 100ms is 50 seconds of serialised sleeping and that is most of the test. It runs at about 7% cpu.

1ms is still a lot longer than a goroutine switch, and cutting the sleep instead of the goroutine counts means all 150 goroutines still pile onto the lock. The test goes from 52.6s to 3.2s and the package from 84.3s to 33.8s here.

To check it still catches a broken lock I made the writer take RLock instead of Lock, and it fails at 1ms the same as it does at 100ms, including at GOMAXPROCS=1 and 2. Ran it 20 times with no failures and it passes under -race.

I only touched the sleep @mtrmac mentioned. The 2s ones in TestLockfileTouch and TestLockfileRecordWrite look like filesystem timestamp granularity, and the multiprocess tests seem to need their time, so the package is still around 34s.

Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
Copilot AI review requested due to automatic review settings July 29, 2026 02:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the storage Related to "storage" package label Jul 29, 2026
@vtushar06

Copy link
Copy Markdown
Author

I only did the one sleep @mtrmac u called out, the multiprocess ones look like they actually need the time so I left them alone.

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

Labels

storage Related to "storage" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

storage/pkg/lockfile: unit tests unreasonably slow

2 participants