HoganHost blog

[email protected]

Node.JS Selector not Working with an Error “Can’t acquire lock for app” in cPanel

 

 

 

 

 

 

 

If you encounter the error message “Can’t acquire lock for an app” it is likely because some processes are utilizing the “.lock” file of your NodeJS application.

This typically occurs when a daemon script was initiated using the Node.JS Selector -> Run NPM Script feature. Unfortunately, scripts started this way cannot be stopped via the UI and will continue running in the background, holding a lock for the application. Consequently, any attempts to perform actions on the app after launching such a daemon script will result in the “Can’t acquire lock for app” error.

To resolve this issue, follow these steps:

As the root user, run the lsof command: lsof -u username | grep lock

This will display a list of lock processes that you need to terminate. To kill a specific process (where XXXXXX is the process number), use the following command: kill -9 XXXXXX

If you have multiple processes, you can list their IDs.

To avoid encountering this problem in the future, avoid launching daemon scripts via the NodeJS Selector UI.

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *