You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "AmosG (via GitHub)" <gi...@apache.org> on 2025/11/29 12:55:38 UTC

[PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

AmosG opened a new pull request, #58849:
URL: https://github.com/apache/airflow/pull/58849

   Add __iter__ methods to Accessor classes to prevent debugger introspection from triggering infinite loops in __getattr__.
   
   Issue: #51861
   
   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   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 an 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/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+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 a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
   


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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "sean-golchin-brze (via GitHub)" <gi...@apache.org>.
sean-golchin-brze commented on PR #58849:
URL: https://github.com/apache/airflow/pull/58849#issuecomment-4878278599

   Any updates on this? We're running into this issue as well. Its critical for us to be able to debug code and this wasn't an issue in Airflow 2


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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #58849:
URL: https://github.com/apache/airflow/pull/58849#discussion_r2573245153


##########
task-sdk/src/airflow/sdk/execution_time/context.py:
##########
@@ -348,6 +348,9 @@ def __getattr__(self, conn_id: str) -> Any:
     def __repr__(self) -> str:
         return "<ConnectionAccessor (dynamic access)>"
 
+    def __iter__(self):

Review Comment:
   Please describe why those methods are added. I understand why by reading the related issue - but it sould be explained in the code when someone looks at 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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #58849: Fix Python debugger hang when python_callable has **context parameter
URL: https://github.com/apache/airflow/pull/58849


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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #58849:
URL: https://github.com/apache/airflow/pull/58849#issuecomment-3638314023

   cc: @uranusjr @ashb -> since you were closest to this. I dug a little deeper - and I was thinking that magic/dunder methods are not going through regular __getatr__ calls, so to be honest, so it's pretty strange those recursive behavious are observed here- and I do not particularly like how "specia" the handling is. Maybe you have some more insight into that ?


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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "johnslavik (via GitHub)" <gi...@apache.org>.
johnslavik commented on code in PR #58849:
URL: https://github.com/apache/airflow/pull/58849#discussion_r2577488527


##########
task-sdk/src/airflow/sdk/execution_time/context.py:
##########
@@ -348,6 +348,9 @@ def __getattr__(self, conn_id: str) -> Any:
     def __repr__(self) -> str:
         return "<ConnectionAccessor (dynamic access)>"
 
+    def __iter__(self):

Review Comment:
   And we could also include something along the lines of `See #58849 for more details` in these explanation comments.



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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #58849:
URL: https://github.com/apache/airflow/pull/58849#issuecomment-3619725248

   You need to fix static checks


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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on PR #58849:
URL: https://github.com/apache/airflow/pull/58849#issuecomment-3722743394

   Any updates here?


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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #58849:
URL: https://github.com/apache/airflow/pull/58849#discussion_r2641877227


##########
airflow-core/src/airflow/models/connection.py:
##########
@@ -488,6 +488,10 @@ def get_connection_from_secrets(cls, conn_id: str) -> Connection:
         :param conn_id: connection id
         :return: connection
         """
+        # Debuggers and other tooling probe dunder attributes like "__iter__". These should never be treated
+        # as real connection IDs.
+        if conn_id.startswith("__"):
+            raise AirflowNotFoundException(f"The conn_id `{conn_id}` isn't defined")

Review Comment:
   I don’t think we can simply do this since it has compatibility implications. Why do those names get passed in here as a string in the first place?



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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #58849:
URL: https://github.com/apache/airflow/pull/58849#issuecomment-3787528546

   This pull request has been automatically marked as stale because the author has not responded to a request for more information. It will be closed in 7 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.

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

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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "AmosG (via GitHub)" <gi...@apache.org>.
AmosG commented on PR #58849:
URL: https://github.com/apache/airflow/pull/58849#issuecomment-3638616952

   i think i found another place that causes this on utils/context.py on __getattr__
   would amend the pr 
   


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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "AmosG (via GitHub)" <gi...@apache.org>.
AmosG commented on code in PR #58849:
URL: https://github.com/apache/airflow/pull/58849#discussion_r2578348744


##########
task-sdk/src/airflow/sdk/execution_time/context.py:
##########
@@ -348,6 +348,9 @@ def __getattr__(self, conn_id: str) -> Any:
     def __repr__(self) -> str:
         return "<ConnectionAccessor (dynamic access)>"
 
+    def __iter__(self):

Review Comment:
   enjoy 



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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "opeida (via GitHub)" <gi...@apache.org>.
opeida commented on PR #58849:
URL: https://github.com/apache/airflow/pull/58849#issuecomment-4377814020

   @AmosG can we proceed with your fix, please? The issue still persists in 3.2.1


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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #58849:
URL: https://github.com/apache/airflow/pull/58849#issuecomment-3821095675

   This pull request has been closed because the author has not responded to a request for more information.


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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "johnslavik (via GitHub)" <gi...@apache.org>.
johnslavik commented on code in PR #58849:
URL: https://github.com/apache/airflow/pull/58849#discussion_r2577488527


##########
task-sdk/src/airflow/sdk/execution_time/context.py:
##########
@@ -348,6 +348,9 @@ def __getattr__(self, conn_id: str) -> Any:
     def __repr__(self) -> str:
         return "<ConnectionAccessor (dynamic access)>"
 
+    def __iter__(self):

Review Comment:
   And we could also include something along the lines of `See #58849 for more details` in these comments.



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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "johnslavik (via GitHub)" <gi...@apache.org>.
johnslavik commented on code in PR #58849:
URL: https://github.com/apache/airflow/pull/58849#discussion_r2577488527


##########
task-sdk/src/airflow/sdk/execution_time/context.py:
##########
@@ -348,6 +348,9 @@ def __getattr__(self, conn_id: str) -> Any:
     def __repr__(self) -> str:
         return "<ConnectionAccessor (dynamic access)>"
 
+    def __iter__(self):

Review Comment:
   And we could also include something along the lines of `See #58849 for more details` in these comment(s).



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


Re: [PR] Fix Python debugger hang when python_callable has **context parameter [airflow]

Posted by "johnslavik (via GitHub)" <gi...@apache.org>.
johnslavik commented on code in PR #58849:
URL: https://github.com/apache/airflow/pull/58849#discussion_r2577488527


##########
task-sdk/src/airflow/sdk/execution_time/context.py:
##########
@@ -348,6 +348,9 @@ def __getattr__(self, conn_id: str) -> Any:
     def __repr__(self) -> str:
         return "<ConnectionAccessor (dynamic access)>"
 
+    def __iter__(self):

Review Comment:
   And we could also include `#58849` in these comment(s).



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