wjddn279 commented on code in PR #65121:
URL: https://github.com/apache/airflow/pull/65121#discussion_r3223068417
##########
shared/logging/src/airflow_shared/logging/structlog.py:
##########
@@ -809,6 +809,18 @@ def reconfigure_logger(
)
+def clear_structlog_shared_lock(log_file_descriptor: IO[Any]):
+ """Temporary workaround that prevents a memory leak in the supervisor by
removing the FD reference from WRITE_LOCKS."""
+ # TODO: remove this logic and bump the structlog version when the next
release (possibly 26.1.0) is out
+ try:
+ from structlog._output import WRITE_LOCKS
+ except ImportError:
+ WRITE_LOCKS = None # type: ignore[assignment]
+
+ if WRITE_LOCKS is not None and isinstance(WRITE_LOCKS, dict):
Review Comment:
In `structlog` 26.1.0, `WRITE_LOCKS` was changed to a
`weakref.WeakKeyDictionary`, which removes keys automatically. To avoid
interfering with that behavior, this guard only deletes the entry directly when
`WRITE_LOCKS` is still a regular `dict`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]