Skip to content

Commit bdfea80

Browse files
jedcunninghamashb
andauthored
Stop calling close_all_sessions in forks (apache#47638)
This ends up not being safe, might be a race condition, but we can get away with not doing it at all. Co-authored-by: Ash Berlin-Taylor <[email protected]>
1 parent 18324dc commit bdfea80

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

airflow/settings.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,9 @@ def _session_maker(_engine):
388388
NonScopedSession = _session_maker(engine)
389389
Session = scoped_session(NonScopedSession)
390390

391-
from sqlalchemy.orm.session import close_all_sessions
392-
393-
os.register_at_fork(after_in_child=close_all_sessions)
394391
# https://docs.sqlalchemy.org/en/20/core/pooling.html#using-connection-pools-with-multiprocessing-or-os-fork
395392
os.register_at_fork(after_in_child=lambda: engine.dispose(close=False))
393+
os.register_at_fork(after_in_child=lambda: async_engine.sync_engine.dispose(close=False))
396394

397395

398396
DEFAULT_ENGINE_ARGS = {

0 commit comments

Comments
 (0)