You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "toxadx (via GitHub)" <gi...@apache.org> on 2023/03/06 21:10:13 UTC

[GitHub] [airflow] toxadx commented on pull request #23872: DagFileProcessorManager: Start a new process group only if current process not a session leader

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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org