mdediana edited a comment on issue #9083: URL: https://github.com/apache/airflow/issues/9083#issuecomment-656932920
@mik-laj I ran into a recursion issue in `StackdriverTaskHandler` which I'm trying to figure out. This is how it happens: `emit` calls `_transport` https://github.com/apache/airflow/blob/3cc5756d04c7d3fd14b71e9ec6f5f906d5a24212/airflow/providers/google/cloud/log/stackdriver_task_handler.py#L140 which calls `_client` https://github.com/apache/airflow/blob/3cc5756d04c7d3fd14b71e9ec6f5f906d5a24212/airflow/providers/google/cloud/log/stackdriver_task_handler.py#L120 which calls `get_credentials_and_project_id` https://github.com/apache/airflow/blob/3cc5756d04c7d3fd14b71e9ec6f5f906d5a24212/airflow/providers/google/cloud/log/stackdriver_task_handler.py#L107 which calls `log.info` https://github.com/apache/airflow/blob/3cc5756d04c7d3fd14b71e9ec6f5f906d5a24212/airflow/providers/google/cloud/utils/credentials_provider.py#L211 which apparently starts it all over again and then it breaks because maximum recursion depth is reached. If I understand this correctly, the problem is that we are calling `logging.info` before initialization has finished, so a new initialization starts and so on. I tried two things which prevent the error from happening, my plan is to investigate it further tomorrow and fix it. The two things: - Removing the `log.info` call from `get_credentials_and_project_id` - Instead of lazily initializing `client` on first `emit`, do it eagerly in `__init__` (i.e., convert the `cached_property` into a `property`). This seems to fix the issue but I don't really understand why, as we still end up calling `logging.info` during the handler initialization, it's just that it's not in `emit`. Does it all make sense? If so, the second sounds like the right thing to do, what do you think? ---------------------------------------------------------------- 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: [email protected]
