You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 9, 2020. It is now read-only.
Pids in docker containers always start at one. So if you run dep inside a docker container as part of a script the pids are very likely to collide between different containers.
The cache lock in source_manager.go uses the pid to detect and avoid a deadlock where the process is waiting for itself.
Unfortunately this all results in a false positive abort when running in docker.
Steps to reproduce
Given directory containing Dockerfile
FROM golang:1.9.1
RUN go get -u github.com/golang/dep/cmd/dep
RUN mkdir /go/src/test
WORKDIR /go/src/test
ADD main.go .
RUN dep init
and main.go
package main
import _ "github.com/go-chi/chi"funcmain() {}
run
docker build . -t test
mkdir cache
(docker run -v $PWD/cache:/go/pkg/dep test dep ensure -v &) && \
docker run -v $PWD/cache:/go/pkg/dep test dep ensure -v
expected output
One process would get the lock, the other would wait:
Gopkg.lock was already in sync with imports and Gopkg.toml
(1/1) Wrote github.com/go-chi/chi@v3.3.0
Gopkg.lock was already in sync with imports and Gopkg.toml
(1/1) Wrote github.com/go-chi/chi@v3.3.0
actual output
Gopkg.lock was already in sync with imports and Gopkg.toml
lockfile /go/pkg/dep/sm.lock already locked by this process
(1/1) Wrote github.com/go-chi/chi@v3.3.0
Proposed solution
The deadlock detection is useful, but perhaps the process could track it own state? If dep knows it isnt holding the lock but the lock file exists with our pid wait like normal.