You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This means that if the pidfile is specifed as a relative path, e.g. ./river.pidfile, it will try to create the pidfile in the system root, e.g. /river.pidfile. This will often fail, and was confusing to me until I used strace to figure out what it was actually trying to do:
# the parent process changes to the root directory
56468 chdir("/") = 0
# the child process attempts to open the pidfile at that root path
56469 openat(AT_FDCWD</>, "./testdir/river.pidfile", O_WRONLY|O_CREAT, 0666 <unfinished ...>
We can see the current working directory is /, and the path to open is ./testdir/river.pidfile.
This might also affect the upgrade socket path in addition to the pidfile.
Describe the solution you'd like
We should likely do one or both of two things:
Allow the configuration of the working directory of the daemonized process, having a configuration that perhaps defaults to the host process' current working directory if not otherwise set
Canonicalize the paths prior to forking, turning them into absolute paths relative to the working directory of the host process
Describe alternatives you've considered
We could also refuse to accept relative paths at all for both of these configuration values, but this may impact other configuration paths in the future.
What is the problem your feature solves, or the need it fulfills?
Currently, when
pingora
is configured to daemonize, it usesDaemonize::new()
as the base configuration:pingora/pingora-core/src/server/daemon.rs
Lines 56 to 114 in 42a847d
However, this selects the system root, e.g.
/
, as the new working path for the daemonized process:https://github.com/knsd/daemonize/blob/c270c91354524b6d750dc3cecfbf3d21dcec508c/daemonize/src/lib.rs#L259-L275
This means that if the pidfile is specifed as a relative path, e.g.
./river.pidfile
, it will try to create the pidfile in the system root, e.g./river.pidfile
. This will often fail, and was confusing to me until I usedstrace
to figure out what it was actually trying to do:The relevant lines are:
We can see the current working directory is
/
, and the path to open is./testdir/river.pidfile
.This might also affect the upgrade socket path in addition to the pidfile.
Describe the solution you'd like
We should likely do one or both of two things:
Describe alternatives you've considered
We could also refuse to accept relative paths at all for both of these configuration values, but this may impact other configuration paths in the future.
Additional Context
CC memorysafety/river#50
The text was updated successfully, but these errors were encountered: