Questions tagged [lockfile]

The tag has no usage guidance.

lockfile
Filter by
Sorted by
Tagged with
2453 votes
15 answers
1.0m views

Do I commit the package-lock.json file created by npm 5?

npm 5 was released today and one of the new features include deterministic installs with the creation of a package-lock.json file. Is this file supposed to be kept in source control? I'm assuming it'...
rink.attendant.6's user avatar
396 votes
25 answers
228k views

Waiting for another flutter command to release the startup lock

When I run my flutter application it show Waiting for another flutter command to release the startup lock this messages and not proceed further.
Viren V Varasadiya's user avatar
211 votes
43 answers
142k views

Quick-and-dirty way to ensure only one instance of a shell script is running at a time

What's a quick-and-dirty way to make sure that only one instance of a shell script is running at a given time?
raldi's user avatar
  • 21.6k
136 votes
14 answers
148k views

What is the best way to ensure only one instance of a Bash script is running? [duplicate]

What is the simplest/best way to ensure only one instance of a given script is running - assuming it's Bash on Linux? At the moment I'm doing: ps -C script.name.sh > /dev/null 2>&1 || ./...
user avatar
35 votes
1 answer
1k views

NPM lockfiles/shrinkwrap get random "dl" parameter tacked on to the "resolved" URL

Our company uses an Artifactory repository for storing internally-published packages and as a proxy for the NPM registry. Sometimes the resolved field in lockfiles/shrinkwrap files is as expected, ...
Jacob's user avatar
  • 78.2k
30 votes
1 answer
64k views

Is 'lockfileVersion: 2' in package-lock.json from npm 7 compatible with older versions of npm?

I was wondering if the new lockfileVersion 2 was backwards compatable with older versions of NPM. Now since NPM 7 is released, a new package-lock.json file is regenerated to a different structure. ...
Thaun_'s user avatar
  • 480
28 votes
7 answers
24k views

Python: module for creating PID-based lockfile?

I'm writing a Python script that may or may not (depending on a bunch of things) run for a long time, and I'd like to make sure that multiple instances (started via cron) don't step on each others ...
David Wolever's user avatar
20 votes
1 answer
1k views

Server-side custom git merge driver on GitHub/Azure Repos

I have a custom merge driver for git that helps merge lockfiles in a large monorepo shared by hundreds of engineers. Because lockfiles churn quite frequently, it's not uncommon for these files to ...
Sachin Joseph's user avatar
12 votes
3 answers
48k views

Inconsistent dependency when i do terraform apply from plan -out=file

I am attempting to create new resources on GCP with a remote backend After doing terraform init plan -out=tfplan and then terraform apply tfplan I get the following error: Error: Inconsistent ...
Shay Pinchasi's user avatar
12 votes
4 answers
40k views

Why is my program creating empty .lck files?

I am trying to use Java Logger. I get my logger file (name.log) with the content, it works and I also get an empty name.log.lck file. Why does this file appear, what program is creating them and ...
Roman's user avatar
  • 128k
11 votes
1 answer
5k views

npm equivalent of yarn install --check-files (or yarn check)

Update for 2020 This question originally referred to the yarn check command, but the docs state that this is deprecated in v1, and removed in v2, and yarn install --check-files should be used instead. ...
davnicwil's user avatar
  • 29.8k
10 votes
2 answers
2k views

Git: do not create index.lock for read-only operations

Is there a way to force git not to create index.lock for read-only operations like git status? I'm displaying the status of my working tree in tmux, being updated every couple of seconds. Basically I ...
Michael Krupp's user avatar
8 votes
2 answers
4k views

Should bun.lockb file be versioned?

I'm migrating a Laravel+Sail project to use bun instead nodejs. According the Bun docs, after run bun i, a binary lockfile named bun.lockb (similar to yarn.lock) is created to increase performance. ...
Leandro Ferreira's user avatar
8 votes
2 answers
1k views

Implementing a portable file locking mechanism

I have implemented a file locking mechanism along the lines of the suggestion from the linux man page for "open", which states: Portable programs that want to perform atomic file locking using a ...
Nigel Scott's user avatar
7 votes
3 answers
4k views

In Makefile, how to cleanup lockfile files?

In GNU Make 3.81, I need to remove a lockfile in the event of an error in any part of the toolchain. Is there a special target that will allow me to do this? Do I need to write a wrapper script? In ...
Jeff's user avatar
  • 560
7 votes
0 answers
1k views

Unable to install packages via renv::restore() ("R was unable to find one or more FORTRAN libraries during compilation.")

I've downloaded an old repo on a new laptop (running on MacOS Catalina) and attempted to run a R script. The repo has a renv lock file - meaning, I should be able to restore all dependencies as they ...
abtinsr's user avatar
  • 71
6 votes
1 answer
3k views

In Bash when creating a mutex, should I use `flock` or `mkdir`?

I searched for Bash how to create a mutex. I came across two different ways to create a mutex in Bash. Both are stackoverflow answers and both have >100 upvotes: one answer uses mkdir and the other ...
Trevor Boyd Smith's user avatar
6 votes
1 answer
1k views

Updating an indirect dependency in shrinkwrapped project

Is there a good way with npm (I'm on npm@5) to do a version bump for a nested dependency in a shrinkwrapped/lockfiled project? Doing an npm install package@latest --save will update the shrinkwrap ...
Jacob's user avatar
  • 78.2k
5 votes
1 answer
7k views

Yarn: use yarn.lock of dependencies

I use yarn to install packages directly from the companies' GitLab: yarn add git+ssh://<user>@<host>:<repo> For first-level dependencies, I use yarn --pure-lockfile to reconstruct ...
user4344's user avatar
  • 181
5 votes
2 answers
25k views

Get the pid of the shell script and save it into a lockfile

I do my backups with rsnapshot which creates a lockfile with the process pid inside. Now I would like to make a backup from the rsnapshots backup, so I´m looking for a way to create this lockfile for ...
user2693017's user avatar
  • 1,800
5 votes
1 answer
439 views

How to enforce only one running instance of a process in python Django framework?

I have a python Django manage command that should be called upon receiving an input file but this command is not safe for parallel calls. So an input file should be processed only and only when there ...
Ali_IT's user avatar
  • 7,741
5 votes
1 answer
3k views

lockfile-create does not work in bash script

This can be a very simple question but I don't understand why it behaves that way. When I invoke lockfile-create --use-pid --retry 0 /tmp/my_lock_file it returns 0, and next time it runs it returns ...
Bunti's user avatar
  • 1,750
5 votes
1 answer
7k views

Python: Daemonizing process with PID file

I am trying to daemonize a process using the daemon module. Code looks something like this import sys import time import daemon import lockfile def do_things(): while True: print "hello"...
auny's user avatar
  • 1,940
4 votes
2 answers
5k views

How to effectively lock a text file while using it in NodeJS?

I have several independent scripts reading and writing from the same text files. I'm trying to lock the text files while a module is reading/writing from them. At the moment I am using the lockfile ...
Physicsman's user avatar
4 votes
7 answers
6k views

memcached dead but subsys locked

service memcached restart yields: stopping memcached: [failed] starting memcached: [ ok ] service memcached status yields: memcached dead but subsys locked ls inside /var/lock/subsys/ ...
Colin Hilbert's user avatar
4 votes
2 answers
8k views

I don't understand the results from #service tomcat6 status

I'm trying to get Tomcat 6 running on Fedora 14. I'm quite new to this sort of thing, though I have managed to get Apache running before. I suspect I've made mistakes on some quite basic levels, ...
Neil Sands's user avatar
4 votes
1 answer
6k views

yarn.lock file is not updating after I update the version of a dependency in package.json and run yarn install or just yarn

In the repository of a project, I already have package.json and yarn.lock files. I'm updating the version of a particular package from version 2.0.14 to version 2.0.16. When I do yarn install or just ...
Srinu Rachakonda's user avatar
3 votes
1 answer
2k views

Lockfile in PHP

I have PHP script that should be run only once at the moment. If someone else tries to launch it again while it is already working, the second process should immediately die with error message. ...
Lecko's user avatar
  • 1,305
3 votes
1 answer
5k views

C++ Lock File Windows Blocking Mode

How can I block a file on Windows using C++ in a blocking fashion? By blocking I mean... a lock is requested and if the file is locked it will wait until it is unlocked, once the file is unlocked by ...
petersaints's user avatar
  • 1,919
3 votes
4 answers
3k views

What is the best way to lock a file to prevent multiple users from accessing it

I have a windows form app in which users can open, create and save xml files. Files are typically saved to a network folder. I need to make sure a given file can only be opened by one user at a time. ...
Dan Schubel's user avatar
3 votes
1 answer
1k views

How can I optionally add a lockfile to a docker container?

I'm trying to build a docker image that optionally adds a yarn (or npm lockfile) while building. I'd like to add it explicitly, but also not fail the build if it isn't included. The intent is to ...
Dan Monego's user avatar
  • 9,917
3 votes
1 answer
13k views

How to have yarn fail on yarn install when package.json and yarn.lock are out of sync?

On a project I have replaced npm with yarn to get the benefits of it, and also enforce our dependencies are locked in via the yarn.lock. Now, a developer added a library with npm@4, which only changed ...
k0pernikus's user avatar
  • 63.6k
3 votes
0 answers
4k views

prometheus 2.0.0 error msg="Opening storage failed" err="open DB in /home/prometheus: Lockfile created, but doesn't exist"

Context : Trying to use prometheus on k8s 1.10.2 and using azure file storage as persistent storage medium Problem : using azurefile storage with prometheus gives me the following error : level=info ...
D007's user avatar
  • 41
3 votes
1 answer
463 views

RSpec tests failing - Display socket is taken but lock file is missing

I'm trying to run RSpec tests in my Rails application and keep getting the following error: :> rspec spec/controllers/api/v0/buying_strategies_controller_spec.rb WARN: Unresolved specs during ...
allenad3213's user avatar
3 votes
1 answer
2k views

Sonarqube: Job fails with Couldn't delete lock file: .././.sonar_lock java.nio.file.NoSuchFileException

I am running command 'gradle sonarqube --stacktrace" which started resulting in the following: Analysis report generated in /Users/shashank.devan/dev/myproject/build/sonar/batch-report 23:38:14.994 ...
knash's user avatar
  • 389
3 votes
2 answers
3k views

Why does cargo build ignore the lock file when lock changed by git?

I'm confused about the behavior of cargo build when the lock file changes between builds: Run cargo clean Run cargo build Change the lock file to a previous version using git Now rerun cargo build ...
Cornelius Roemer's user avatar
2 votes
4 answers
1k views

Detecting that files are being copied in a folder

I am running a script which copies one folder from a specific location if it does not exist( or is not consistent). The problems appears when I run concurently the script 2+ times. As the first script ...
John Doe's user avatar
  • 1,098
2 votes
1 answer
4k views

devtools::check - System command 'Rcmd.exe' failed, exit stauts:1, stdout + stderr:

I am currently developing a package for my PhD containing functions for the data analysis for my project. The setup is windows 10 and all files are saved locally on the PC and synchronised to One ...
ikempf's user avatar
  • 165
2 votes
2 answers
77 views

Is lockfile necessary for reading and writing the same file of two processes

I'm working with Bash script and meeting such a situation: one bash script will write things into a file, and the other bash script will read things from the same file. In this case, is lockfile ...
Yves's user avatar
  • 12k
2 votes
3 answers
2k views

What is the best exception type to use for an I/O timeout?

I've written a Java class that implements a "lock file" to prevent a period job from running more than once concurrently. It's based upon java.nio.channels.FileChannel.tryLock and works quite well. ...
Christopher Schultz's user avatar
2 votes
1 answer
1k views

renv 0.12.0 was loaded from project library, but renv 0.11.0 is recorded in lockfile

Upon opening a project on rstudio i have the following Warning: Warning message: renv 0.12.0 was loaded from project library, but renv 0.11.0 is recorded in lockfile. Use `renv::record("[email protected]....
moth's user avatar
  • 2,073
2 votes
1 answer
1k views

procmail lockfile utility and NFS

Has anyone used the lockfile utility that ships with procmail in conjunction with NFS mounted directories? The lockfile man page states that "Lockfile is NFS-resistant and eight-bit clean."
Rob Wells's user avatar
  • 36.6k
2 votes
1 answer
786 views

Proper way to handle a lock file on rebase conflict

Hi I am not sure if I am doing things correctly. Whenever I rebase an hit an issue with package.json and the lock file. I fix the package.json, but then delete the lockfile and just run pnpm i again. ...
blessanm86's user avatar
  • 31.6k
2 votes
1 answer
3k views

FileHandler creation gives NoSuchFileException cause missing .lck

im searching for 2 hours now fo a solution to this: Im trying to add a FileHandler to a Logger in a JAR. The Log-Directory is outside. In my IDE (NetBeans) this works: public static void ...
Schesam's user avatar
  • 641
2 votes
1 answer
2k views

Cross-platform Pipenv.lock

I am creating a cross-platform Python app, using pipenv (as I understand poetry has the same issue too) for management of dependencies and virtual envs. While trying to build the app on Windows and ...
Alex P.'s user avatar
  • 3,707
2 votes
1 answer
4k views

fcntl F_GETLK always return true

i'm trying to make a single instance daemon using a lock file but fcntl() doesn't seem to work as expected... int creat_lock_file (char * pid_fn) { struct flock pid_lck = {F_WRLCK, SEEK_SET, 0, ...
Aristos Miliaressis's user avatar
2 votes
0 answers
149 views

Is there any implementation or how to implement `lockf()` for Windows?

I am porting some Linux code to Windows that uses lockf() static string load_bulletin_from_file(const char* cache_filename) { int fd = open(cache_filename, O_RDWR); // lockf requires O_RDWR if ...
Hojzerice's user avatar
2 votes
2 answers
957 views

Installation of private npm package from CodeArtifact fails with "401 Unauthorized" with yarn and yarn.lock

We have a private npm package in CodeArtifact that we want to install as part of our package.json. We are using Yarn as a package manager and have a yarn.lock file to control the versions. When trying ...
Lola Bach's user avatar
  • 101
2 votes
0 answers
685 views

npm protractor xlsx file wait and retry

I am trying to run protractor with multi capabilities (around 30 browsers with diff versions) The data sheet is xlsx and is one sheet, which will be consumed. After each run the xlsx row will be ...
erchristopher's user avatar
2 votes
1 answer
256 views

Why .Net code version hangs, but C++ not?

Why does the same code in .Net (C#) hangs, but in C++ it isn't? The really problem is in System.IO.FileStream, but I reduced it down to CreateFile, nevertheless it still hangs in .Net (while being ...
frtnum's user avatar
  • 177