Skip to content

Commit

Permalink
Fix sensor loop handle cleanup
Browse files Browse the repository at this point in the history
Summary:
TIL that pop_stack doesn't actually close the contextmanagers in the stack! https://docs.python.org/3/library/contextlib.html#contextlib.ExitStack.pop_all

I think what we actually want is close().

Resolves #3757.

Test Plan: Run daemon loop long enough that the pop_all is hit (>60 seconds), CTRL-C the daemon, daemon no longer hangs.

Reviewers: prha, johann, alangenfeld

Reviewed By: johann

Differential Revision: https://dagster.phacility.com/D6757
  • Loading branch information
gibsondan committed Mar 3, 2021
1 parent aa8154b commit bcc23b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python_modules/dagster/dagster/scheduler/sensor.py
Expand Up @@ -144,7 +144,7 @@ def execute_sensor_iteration_loop(
not handle_manager
or (start_time - manager_loaded_time) > RELOAD_LOCATION_MANAGER_INTERVAL
):
stack.pop_all() # remove the previous context
stack.close() # remove the previous context
handle_manager = stack.enter_context(
RepositoryLocationHandleManager(grpc_server_registry)
)
Expand Down

0 comments on commit bcc23b7

Please sign in to comment.