-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On rotation the new file's owner is not always the same. Sometimes it is the user, sometimes it is root #374
Comments
UPDATE: I had a theory that maybe the spawned processes were running under a different user space and that was causing the rotated files to be created with I tested that by emitting the uid and gid both in the parent process, but also in the stdout and stderr event handlers. Same values. |
following. We also have this issue, though we are using systemctl to restart the node application.
We also have a python script doing some stuff
|
workaround is set all log files (in folder ./logs) to current user (pi), so
|
I'm running into a frustrating problem that was a little hard to track down.
I have a background process that was trouble-free until a few weeks ago and then suddenly it developed the following error...
EACCES: permission denied, open '../logs/textract-prod/default-2023-06-07.log'
Once this error occurs the process enters a failed state. It is controlled by pm2, which will restart it, but as soon as it tries to log to the file (which it does on startup) it encounters the permission problem and it crashes, and gets restarted again.
I found that I could temporarily fix the problem by stopping the process and renaming the logging directory. When I restart the process it creates a new log file which has the correct permissions. I should mention at this point that I am running the process in user space, and the log directory is in the user's home directory.
User:
bigbird
Log directory:
/home/bigbird/logs/textract-prod/
OS:
Ubuntu 18.04.6 LTS
Looking at the logs I noticed a pattern: the file permission problem always starts at midnight UTC. Which led me to the log file rotator.
I confirmed this theory by checking the file permissions of a set of files:
So straight away I see the rotator has a random chance of creating the new log file with the current user as the owner, but sometimes
root
is the owner.What the ____ ?!
The only "odd" thing that we do in this process is we spawn some python processes. We capture the stdout and stderr from those processes in the parent process and write that to the log. I'm wondering if that has something to do with why we sometimes get a root-owner log file.
The reason I don't think this is the problem:
child_process.spawn
should be creating processes in the same user space as the parent process.I also note that we don't get this problem on other environments, OSes and architectures.
The text was updated successfully, but these errors were encountered: