Re:Fork() without exec() is dangerous in large programs (2016)
by masklinn on Tuesday June 14, 2022 @02:53PM
(#31744202)
Isn't the first use-case a pretty debatable / bad one? By daemonizing internally, you make service management and supervision of the program much more difficult, and if you include a non-daemonizing mode for debugging you now have two different runmodes with a pretty significant semantics difference, only one of which is easily inspectable.
Re:Fork() without exec() is dangerous in large programs (2016)
by cryptonector on Tuesday June 14, 2022 @03:26PM
(#31744743)
Daemonizing is a thing of the past with modern restarter frameworks, like SMF, systemd, supervisord, etc. But daemonizing was always an option, not a requirement, and as an option, it's safe enough to provide it for those who don't use a restarter.
Re:Fork() without exec() is dangerous in large programs (2016)
by gunapologist99 on Tuesday June 14, 2022 @03:49PM
(#31745070)
Your program probably knows how (if it wished) to manage its own resources far better than an external program ever could.
Re:Fork() without exec() is dangerous in large programs (2016)
by masklinn on Tuesday June 14, 2022 @04:39PM
(#31745749)
Said no sysadmin ever.
Re:Fork() without exec() is dangerous in large programs (2016)
by lanstin on Tuesday June 14, 2022 @05:32PM
(#31746350)
I love this sysadmin comment and the GP dev comment. The key is to get the sysadmin team putting requirements to the code, whether the restarting ends up in process or as a nice small unix separate tool that just does restarts well, is an outcome of a process.
But I think that's about it for good uses of fork().
For all process spawning uses of fork() I strongly recommend vfork() or posix_spawn() instead.