Skip to content

Conversation

gammazero
Copy link
Contributor

@gammazero gammazero commented May 6, 2025

Retry acquiring repo lock for a specified amount of time. Retry once per second until time is expired or lock is acquired.

Lock wait timeout is specified using the environment variable IPFS_WAIT_REPO_LOCK and assigning it a value that is parsable as a golang time.Duration. For example:

IPFS_WAIT_REPO_LOCK="5s"

CLI example:

GOLOG_LOG_LEVEL="lock=warn" IPFS_WAIT_REPO_LOCK="5s" ipfs daemon
Initializing daemon...
Kubo version: 0.35.0-dev-705962018-dirty
Repo version: 16
System version: arm64/darwin
Golang version: go1.24.2
2025-05-06T05:58:29.763-1000    WARN    lock    go-fs-lock@v0.1.1/fslock.go:100 /Users/ajg/.ipfs/repo.lock: someone else has the lock. Retrying...
2025-05-06T05:58:30.764-1000    WARN    lock    go-fs-lock@v0.1.1/fslock.go:100 /Users/ajg/.ipfs/repo.lock: someone else has the lock. Retrying...
2025-05-06T05:58:31.765-1000    WARN    lock    go-fs-lock@v0.1.1/fslock.go:100 /Users/ajg/.ipfs/repo.lock: someone else has the lock. Retrying...
2025-05-06T05:58:32.764-1000    WARN    lock    go-fs-lock@v0.1.1/fslock.go:100 /Users/ajg/.ipfs/repo.lock: someone else has the lock. Retrying...
2025-05-06T05:58:33.765-1000    WARN    lock    go-fs-lock@v0.1.1/fslock.go:100 /Users/ajg/.ipfs/repo.lock: someone else has the lock. Retrying...
2025-05-06T05:58:34.763-1000    WARN    lock    go-fs-lock@v0.1.1/fslock.go:107 did not acquire lock: context deadline exceeded

Error: lock /Users/ajg/.ipfs/repo.lock: someone else has the lock

Closes #10482

@gammazero gammazero marked this pull request as ready for review May 6, 2025 23:47
@gammazero gammazero requested a review from a team as a code owner May 6, 2025 23:47
@gammazero gammazero force-pushed the feat/wait-repo-lock branch from b73c0a6 to f4a56ba Compare May 6, 2025 23:54
gammazero added 4 commits May 7, 2025 02:40
Retry acquiring repo lock for a specified amount of time. Retry once per second until time is expired ro lock is acquired.

Lock wait timeout is specified using the environment variable `IPFS_WAIT_REPO_LOCK` and assigning it a value that is parsable as a golang `time.Duration`. For example:

```
IPFS_WAIT_REPO_LOCK="5s"
```

Closes #10482
@gammazero gammazero force-pushed the feat/wait-repo-lock branch from 8daa15e to febfc03 Compare May 7, 2025 12:45
@lidel lidel changed the title repo: optionally wait to acquire repo lock feat: IPFS_WAIT_REPO_LOCK May 7, 2025
@lidel lidel enabled auto-merge (squash) May 7, 2025 14:23
@lidel lidel merged commit f7e0568 into master May 7, 2025
17 checks passed
@lidel lidel deleted the feat/wait-repo-lock branch May 7, 2025 14:28
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.

Add a grace period to obtain the lock to avoid "Error: lock /data/ipfs/repo.lock: someone else has the lock"
2 participants