I am getting lock files in the /var/webmin/locks/####/ folder. Eventually I started getting inode issues with too many of these files in the /var directory. I deleted them and noticed they reappeared. I am not sure why I am getting these continually without any cleanup. I have 2 nearly identical Debian 12 servers that are both getting these. Any ideas, I have done google searches and it doesn’t turn up much in this regard.
I have a Debian 11 server and have found the same thing… over 48,000+ links in the /var/webmin/locks/446415 folder. I don’t see any inode issues yet, but I hope support can find a way to clean up this folder. They are dated from Oct 3 - 17.
Well, initially, I came up with a custom file locking feature specific to the stats server.
However, @Jamie insisted on using the Webmin inbuilt lock_file function.
The reason why those locks are left around and even appear when forcefile flag is used for lock_file is unclear to me at the moment. Perhaps because the default lock_file functions wasn’t meant for endlessly running process…?
Jamie, could you shed light on it? Should I perhaps revert to using my custom locking function? Alternatively, we might not need locking at all, since there’s only one process on the system that writes to that file. It’s sub-optimal, but it would resolve some ongoing locking issues.
Those files are created so that it’s possible to find all the open locks Webmin has. However, they should get cleaned up automatically when the lock on the destination file is released … but due to a bug they don’t always
Nevertheless, it didn’t change anything regarding the original problem, where locking is performed from the server. I’m curious… Why would you expect it to work for a process that never finishes? Specifically, I’m referring to this line push(@main::temporary_files, $locklink); of code.
Perhaps I shouldn’t relock the file every time and instead do it just once. This might work, but I don’t think it’s the right solution — it’s more of a workaround. Like what if the stats server gets killed?
Thanks, @Jamie. I see a bug in this new code, though. You’re adding the lock file to %locked_file_link in lock_file, but in unlock_file, you’re trying to clean it up using the real file instead. It won’t work.
Thanks, @Jamie! It seems to be working now. Should we also clean up the PID-related directories in /var/webmin/locks since those are accumulating too? Maybe we could just use rmdir for that?