The GitHub Actions job "Tests" on airflow.git has failed. Run started by GitHub user Usiel (triggered by Usiel).
Head commit for run: 18d15939413d3fadbbb6a35fa94dea20489e94e3 / Usiel Riedl <[email protected]> Fix for infinite recursion due to secrets_masker We can get into trouble for types that cannot be initiated with re2's `type(obj)()` call. The `secrets_masker` thus fails, which triggers a warning log, which also fails because we pass the object to the logger, which is then masked again, and so forth. We can break the recursion by printing out the `repr` of the object in question in the warning log. This issue has occured previously: https://github.com/apache/airflow/issues/19816#issuecomment-983311373 I noticed this issue while working with a DAG that calls Airflow's DB cleanup function, thus I'm fixing the logging call in `db_cleanup` to log a stringified name instead of the `quoted_name` object. I thought about fixing the `SecretsMasker` call to the reducer, i.e. only passing objects that re2 can handle (i.e. having a parameterless constructor), but decided against it. Checking for this would probably not be cheap and considering this scenario is quite unlikely, I think it's better to simply fail and emit a warning log (without the infinite recursion :)). Example DAG: ``` from datetime import datetime from airflow import DAG from airflow.models import Variable from airflow.operators.python import PythonOperator class MyStringClass(str): def __init__(self, required_arg): pass def fail(task_instance): # make sure the `SecretsMasker` has a replacer Variable.set(key="secret", value="secret_value") Variable.get("secret") # trigger the infinite recursion task_instance.log.info("%s", MyStringClass("secret_value")) with DAG( dag_id="secrets_masker_recursion", start_date=datetime(2023, 9, 26), ): PythonOperator(task_id="fail", python_callable=fail) ``` Report URL: https://github.com/apache/airflow/actions/runs/6570491878 With regards, GitHub Actions via GitBox --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
