You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/12/14 12:41:33 UTC

[GitHub] [airflow] mik-laj opened a new pull request #13058: Set timeout for child processes

mik-laj opened a new pull request #13058:
URL: https://github.com/apache/airflow/pull/13058


   Any child process can hang. When it is happen,  then very difficult to determine what happened.  Adding a timeout when starting processes will make it easier to diagnose problems, because our application will raise an exception. .
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
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.

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



[GitHub] [airflow] mik-laj commented on a change in pull request #13058: Set timeout for child processes

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #13058:
URL: https://github.com/apache/airflow/pull/13058#discussion_r542777395



##########
File path: airflow/configuration.py
##########
@@ -69,7 +69,9 @@ def run_command(command):
     process = subprocess.Popen(
         shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True
     )
-    output, stderr = [stream.decode(sys.getdefaultencoding(), 'ignore') for stream in process.communicate()]
+    output, stderr = [
+        stream.decode(sys.getdefaultencoding(), 'ignore') for stream in process.communicate(timeout=60)

Review comment:
       I added more docs now :-) 




----------------------------------------------------------------
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.

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



[GitHub] [airflow] github-actions[bot] closed pull request #13058: Set timeout for child processes

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #13058:
URL: https://github.com/apache/airflow/pull/13058


   


----------------------------------------------------------------
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.

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



[GitHub] [airflow] github-actions[bot] commented on pull request #13058: Set timeout for child processes

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13058:
URL: https://github.com/apache/airflow/pull/13058#issuecomment-744481893


   [The Workflow run](https://github.com/apache/airflow/actions/runs/420940369) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


----------------------------------------------------------------
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.

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



[GitHub] [airflow] github-actions[bot] commented on pull request #13058: Set timeout for child processes

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13058:
URL: https://github.com/apache/airflow/pull/13058#issuecomment-744482217


   [The Workflow run](https://github.com/apache/airflow/actions/runs/420940475) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


----------------------------------------------------------------
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.

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



[GitHub] [airflow] mik-laj commented on a change in pull request #13058: Set timeout for child processes

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #13058:
URL: https://github.com/apache/airflow/pull/13058#discussion_r542373341



##########
File path: airflow/configuration.py
##########
@@ -69,7 +69,9 @@ def run_command(command):
     process = subprocess.Popen(
         shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True
     )
-    output, stderr = [stream.decode(sys.getdefaultencoding(), 'ignore') for stream in process.communicate()]
+    output, stderr = [
+        stream.decode(sys.getdefaultencoding(), 'ignore') for stream in process.communicate(timeout=60)

Review comment:
       This value is much greater than the time it takes to complete this process. It seems to me that processes that take longer than 5 seconds will not be started here as this would have an impact on the environment performance.  I am not trying to solve the problems that processes are freezing and we should handle these situations somehow, but for now I just want the user to be notified that the process has stopped responding. In the future, we might think of a better way to handle it once these problems are reported along with the use case.
   
   What do you think about increasing this time to 5 minutes? Is this a more rational time for you?




----------------------------------------------------------------
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.

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



[GitHub] [airflow] github-actions[bot] commented on pull request #13058: Set timeout for child processes

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13058:
URL: https://github.com/apache/airflow/pull/13058#issuecomment-787209748


   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.


----------------------------------------------------------------
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.

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



[GitHub] [airflow] ashb commented on a change in pull request #13058: Set timeout for child processes

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #13058:
URL: https://github.com/apache/airflow/pull/13058#discussion_r542683198



##########
File path: airflow/configuration.py
##########
@@ -69,7 +69,9 @@ def run_command(command):
     process = subprocess.Popen(
         shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True
     )
-    output, stderr = [stream.decode(sys.getdefaultencoding(), 'ignore') for stream in process.communicate()]
+    output, stderr = [
+        stream.decode(sys.getdefaultencoding(), 'ignore') for stream in process.communicate(timeout=60)

Review comment:
       This case is to run command from the `*_CMD` vars, for instance `sqlalchemy_conn_cmd` setting.
   
   60s is fine for most sensible cases (probably too long), but we just can't know what users might put in these configs -- it might take a long time on first instance.
   
   Perhaps we just document this as a limitation for now and we can make it configurable when someone complains.




----------------------------------------------------------------
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.

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



[GitHub] [airflow] ashb commented on a change in pull request #13058: Set timeout for child processes

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #13058:
URL: https://github.com/apache/airflow/pull/13058#discussion_r542362992



##########
File path: airflow/configuration.py
##########
@@ -69,7 +69,9 @@ def run_command(command):
     process = subprocess.Popen(
         shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True
     )
-    output, stderr = [stream.decode(sys.getdefaultencoding(), 'ignore') for stream in process.communicate()]
+    output, stderr = [
+        stream.decode(sys.getdefaultencoding(), 'ignore') for stream in process.communicate(timeout=60)

Review comment:
       I wonder if this one (and maybe some others) need to be configurable.




----------------------------------------------------------------
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.

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