toxadx commented on PR #23872:
URL: https://github.com/apache/airflow/pull/23872#issuecomment-1457007112

   I think that comparing PID = SID is not the correct approach.
   Starting scheduler as a daemon (-D flag) forks the process twice, while 
setting SID only for the first forked child. That means that PID will not equal 
to SID in any case.
   Moreover calling os.getsid(0) raises Exception under OpenBSD.
   According to "Ask forgiveness not permission" concept I would like to 
propose to rewrite set_new_process_group:
   ```python
   def set_new_process_group() -> None:
       """
       Try to set current process to a new process group.
       That makes it easy to kill all sub-process of this at the OS-level,
       rather than having to iterate the child processes.
       If current process spawn by system call ``exec()`` than keep current 
process group
       """
       try:
           os.setpgid(0, 0)
       except PermissionError:
           pass
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to