Feature #3310
closednfd process: write PID to file
0%
Description
Write the PID of nfd process to a file, so that it can be signaled with kill precisely.
Necessity:
In certain experiments including but not limited to Mini-NDN, multiple nfd processes can be running in the same PID namespace.
pkill and killall cannot precisely signal one nfd process without affecting other nfd processes.
This issue includes:
- design the format of PID file
- decide the location of PID file, whether and how it can be configured
- decide who should write the PID file
- implement the feature
Updated by Junxiao Shi almost 10 years ago
- Description updated (diff)
file format
- Many applications write just the PID (in decimal), as a text file.
- Google Chrome for Ubuntu writes the machine name plus the PID (in decimal), as a symlink
$HOME/.config/google-chrome/SingletonLock.
Having the machine name allows Google Chrome to prompt user if the profile is being used on another machine sharing a folder over NFS, but this isn't important for NFD.
I'm unsure about the choice between a text file and a symlink.
location
The location must be configured, so that multiple nfd processes can have different PID files.
The choice is: whether to configure this in nfd.conf, or as a command line option (on either nfd or nfd-start+nfd-stop, depending on the next answer).
who writes PID file
Either nfd itself or nfd-start should write the PID file.
In nfd-start, it can know nfd's PID through $! variable.
Updated by Junxiao Shi almost 10 years ago
- Blocks Feature #3311: nfd-stop: kill with PID added
Updated by Davide Pesavento almost 10 years ago
Sounds like the wrong solution to me. Why can't the parent process (whatever spawns the nfd process) keep track of its PID? E.g. in bash there's $!, in python you can use subprocess.Popen objects, etc... What does having a PID file simplify?
Updated by Junxiao Shi almost 10 years ago
Why can't the parent process (whatever spawns the nfd process) keep track of its PID?
In the case of nfd-start and nfd-stop, the parent process who spawns nfd is nfd-start, which has no way to pass the PID to nfd-stop which can be called in another console.
Updated by Davide Pesavento almost 10 years ago
who said anything about nfd-start and nfd-stop? With the merging of nfd and nrd in one process, there's no reason for those scripts to exist anymore, we should get rid of them. nfd should be run directly.
Updated by Junxiao Shi almost 10 years ago
- Status changed from New to Rejected
20151103 conference call agrees with note-3, so this is rejected.