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 2021/11/24 15:16:55 UTC

[GitHub] [airflow] potiuk opened a new pull request #19809: Fix OOM error in tests when using public Github Runners.

potiuk opened a new pull request #19809:
URL: https://github.com/apache/airflow/pull/19809


   There was a side effect caused by the test_start_and_terminate
   from TestStandardRunned that caused broken logging configuration,
   which in turn created OutOfMemory condition for our Public
   GitHubRunners.
   
   The problem was that the test overrode the configuration of
   logging with some simple test configuration, but never restored
   the default configuration, which resulted in `airflow.processor`
   logger that was created before contain empty handlers. Since
   the `airflow.processor` logger has "propagate" set to False,
   empty handlers normally cause a lastResort handler call, which
   by default redirects everything to Stderr and this is what
   happened in DagFile Processor tests. However, DagFileProcessor
   uses `stderr_redirect` which replaces `sys.stderr` with provided
   stream. In this case however the stream set (StreamLogWriter)
   redirected the output to "airflow.processor" logger - which in
   turn (as last resort) redirected everything to sys.stderr which
   in turn redirected everything to "airflow.processor" logger etc.
   
   This resulted in:
   
   * OOM condition in Public GitHub Runners
   * DagFileProcessor failing with exceeded recursion depth when
     there was enough memory to get there.
   
   The condition was triggered by two preceding tests:
   
   1) First test_plugins_manger.py initialized logging for
      `airflow.processor` and stored it in logging manager
   2) The TestStandardTaskRunner test applied simpler configuration
      but the way configure() works - it did not remove the
      "airflow.processor" logger, but it REMOVED all handlers
      registered for it - and never restored the default configuration
   3) The DagFileProcessor logs caused infinite recursion
   
   The fix is two-fold:
   
   * the TestStandardTaskRunner restores default config after test
   * the DagFileProcessor sets default config before starting
   
   <!--
   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/main/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/main/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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] potiuk merged pull request #19809: Fix OOM error in tests when using public Github Runners.

Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #19809:
URL: https://github.com/apache/airflow/pull/19809


   


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



[GitHub] [airflow] kaxil commented on pull request #19809: Fix OOM error in tests when using public Github Runners.

Posted by GitBox <gi...@apache.org>.
kaxil commented on pull request #19809:
URL: https://github.com/apache/airflow/pull/19809#issuecomment-978162281


   Well done on the PR description too 👏 


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



[GitHub] [airflow] jedcunningham commented on a change in pull request #19809: Fix OOM error in tests when using public Github Runners.

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



##########
File path: tests/dag_processing/test_manager.py
##########
@@ -111,6 +113,7 @@ def waitable_handle(self):
 
 class TestDagFileProcessorManager:
     def setup_method(self):
+        dictConfig(DEFAULT_LOGGING_CONFIG)

Review comment:
       That's fair. At the end of the day, like normal, the only thing that is consistent is that things are inconsistent 😀.




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



[GitHub] [airflow] potiuk commented on a change in pull request #19809: Fix OOM error in tests when using public Github Runners.

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



##########
File path: tests/dag_processing/test_manager.py
##########
@@ -111,6 +113,7 @@ def waitable_handle(self):
 
 class TestDagFileProcessorManager:
     def setup_method(self):
+        dictConfig(DEFAULT_LOGGING_CONFIG)

Review comment:
       Indeed. This PR is a clear manifestation of it :)




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



[GitHub] [airflow] potiuk commented on pull request #19809: Fix OOM error in tests when using public Github Runners.

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #19809:
URL: https://github.com/apache/airflow/pull/19809#issuecomment-978081439


   Some failiures but the main problem is fixed - we can deal with those separately.


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



[GitHub] [airflow] jedcunningham commented on a change in pull request #19809: Fix OOM error in tests when using public Github Runners.

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



##########
File path: tests/dag_processing/test_manager.py
##########
@@ -111,6 +113,7 @@ def waitable_handle(self):
 
 class TestDagFileProcessorManager:
     def setup_method(self):
+        dictConfig(DEFAULT_LOGGING_CONFIG)

Review comment:
       Should we call `logging_config.configure_logging()` instead?




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



[GitHub] [airflow] potiuk commented on a change in pull request #19809: Fix OOM error in tests when using public Github Runners.

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



##########
File path: tests/dag_processing/test_manager.py
##########
@@ -111,6 +113,7 @@ def waitable_handle(self):
 
 class TestDagFileProcessorManager:
     def setup_method(self):
+        dictConfig(DEFAULT_LOGGING_CONFIG)

Review comment:
       I copied it from TestStandardTaskRunner - there it is much more obvious why I used it this way. I have no super strong opinion, though I'd say in tests stating expllicitly that "this test requires default config" is a bit more resilient - for example if another test generates local_config and does not remove it - using DEFULT_* will still work.




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



[GitHub] [airflow] github-actions[bot] commented on pull request #19809: Fix OOM error in tests when using public Github Runners.

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


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


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



[GitHub] [airflow] potiuk commented on pull request #19809: Fix OOM error in tests when using public Github Runners.

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #19809:
URL: https://github.com/apache/airflow/pull/19809#issuecomment-978173846


   Thanks @kaxil . The sheer amount of time I spent on it, means that I had to be creative to describe the 4 lines (actually 2 really needed) of code it produced. 


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



[GitHub] [airflow] potiuk edited a comment on pull request #19809: Fix OOM error in tests when using public Github Runners.

Posted by GitBox <gi...@apache.org>.
potiuk edited a comment on pull request #19809:
URL: https://github.com/apache/airflow/pull/19809#issuecomment-978173846


   Thanks @kaxil . The sheer amount of time I spent on it, means that I had to be creative to describe the 5 lines (actually 2 really needed) of code it produced. 


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