From d71f6fc9e1fb893fc3cd4dea18d131f151ecfd1e Mon Sep 17 00:00:00 2001 From: Kory Draughn Date: Mon, 4 Nov 2024 09:43:54 -0500 Subject: [PATCH] squash w/ startup/shutdown. Avoid infinite loop on config reload. --- scripts/irods/controller.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/irods/controller.py b/scripts/irods/controller.py index b127e50875..0b73c9a902 100644 --- a/scripts/irods/controller.py +++ b/scripts/irods/controller.py @@ -143,6 +143,9 @@ def reload_configuration(self): l.debug('Sending SIGHUP to iRODS server') os.kill(server_pid, signal.SIGHUP) + # Helps protect against infinite loops. + loop_counter = 0 + # Wait for a new agent factory to appear before starting the wait loop. # This guarantees the python script connects to the new agent factory. Remember, # the iRODS server doesn't launch the new agent factory until the old agent factory @@ -151,8 +154,11 @@ def reload_configuration(self): new_agent_factory_pid = self.find_agent_factory_pid() if (new_agent_factory_pid is None) or (new_agent_factory_pid == old_agent_factory_pid): time.sleep(1) + loop_counter += 1 + if loop_counter == 15: + raise IrodsError('Reload may have failed. Please check log file and configuration.') continue - l.debug('New agent factory has appeared [%s].', new_agent_factory_pid) + l.debug('New agent factory has appeared [pid=%s].', new_agent_factory_pid) break self.wait_for_server_to_start()