Deleting a User with php-fpm while a php script is running throws error

Version 1.52


If you run php-fpm and the User's website is active when you delete it, this error may appear: Unable to remove Unix User. Continuing with the other files. userdel: user testuser is currently used by process 123456 DirectAdmin does scan for, and kill all Users processes before running the userdel command, however php-fpm is quick to spawn a new process for the User. The solution is to delete the file: /usr/local/directadmin/data/users/testuser/php/* and quickly triggering a graceful reload of php-fpm before running userdel. Currently, this is triggered multiple times if multiple Users are deleted, so we may need to change it. Predicting the full list of Users is possible, but more difficult due to the recursive nature of Reseller, so for now the graceful trigger is done per-User being deleted. As "graceful" restarts don't affect live requests, in theory, this should't hurt other Users, except those being removed. Note, by "graceful", it will be whatever is the correct term for your OS, as it has several variables. If "php_fpm_restarts=1" set, the "restart" is used. if systemd, then reload is used, else graceful is used.

Interested to try DirectAdmin? Get a 30-day Free Trial!