mirror of https://github.com/containers/podman.git
When refreshing libpod, if SHM locks exist, remove them
This will hopefully help cases where libpod is initialized multiple times on the same system (as on our CI tests). We still run into potential issues where multiple Podmans with multiple tmp paths try to run on the same system - we could end up thrashing the locks. I think we need a file locks driver for situations like that. We can also see about storing paths in the SHM segment, to make sure multiple libpod instances aren't using the same one. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
parent
31df5e0e85
commit
16a5cbfac5
|
|
@ -540,6 +540,11 @@ func makeRuntime(runtime *Runtime) (err error) {
|
|||
lockPath = DefaultRootlessSHMLockPath
|
||||
}
|
||||
if doRefresh {
|
||||
// If SHM locks already exist, delete them and reinitialize
|
||||
if err := os.Remove(filepath.Join("/dev/shm", lockPath)); err != nil && !os.IsNotExist(err) {
|
||||
return errors.Wrapf(err, "error deleting existing libpod SHM segment %s", lockPath)
|
||||
}
|
||||
|
||||
manager, err = lock.NewSHMLockManager(lockPath, runtime.config.NumLocks)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "error creating SHM locks for libpod")
|
||||
|
|
|
|||
Loading…
Reference in New Issue