You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Terminates MATLAB when stuck in starting state for more than 2 minutes for all licensing options. This previously only occurred with the "Existing License" option.
# Since max allowed startup time has elapsed, it means that MATLAB is in a stuck state and cannot be launched.
801
+
# Set the error and stop matlab.
802
+
user_visible_error="Unable to start MATLAB.\nTry again by clicking Start MATLAB."
803
+
804
+
asyncdef__force_stop_matlab(error):
809
805
"""A private method to update self.error and force stop matlab"""
810
-
self.error=LicensingError(licensing_error)
811
-
logger.error(f"{this_task}: {licensing_error}")
806
+
self.error=MatlabError(error)
807
+
logger.error(f"{this_task}: {error}")
812
808
813
809
# If force_quit is not set to True, stop_matlab() would try to
814
810
# send a HTTP request to the Embedded Connector (which is already "down")
815
811
awaitself.stop_matlab(force_quit=True)
816
812
817
-
# In WINDOWS systems, errors are raised as UI windows and cannot be captured programmatically.
818
-
# So, raise a generic error wherever appropriate
819
813
ifsystem.is_windows():
820
-
generic_error=f"MATLAB has been in a starting state for more than {int(self.embedded_connector_max_startup_duration)} seconds. Use Windows Remote Desktop to check for any errors"
821
-
822
-
# If licensing type is existing_license and there are no logs, then it means that MATLAB cannot be launched with an existing license
823
-
# Set the error and stop matlab.
824
-
if (
825
-
self.licensing["type"] =="existing_license"
826
-
andlen(self.logs["matlab"]) ==0
827
-
):
828
-
await__force_stop_matlab()
829
-
# Breaking out of the loop will end this task as matlab-proxy was unable to launch MATLAB successfully even after embedded_connector_max_startup_duration
814
+
# In WINDOWS systems, errors are raised as UI windows and cannot be captured programmatically.
815
+
# So, raise a generic error wherever appropriate
816
+
generic_error=f"MATLAB did not start in {int(self.EMBEDDED_CONNECTOR_MAX_STARTUP_DURATION_IN_SECONDS)} seconds. Use Windows Remote Desktop to check for any errors."
817
+
logger.error(f":{this_task}: {generic_error}")
818
+
iflen(self.logs["matlab"]) ==0:
819
+
await__force_stop_matlab(user_visible_error)
820
+
# Breaking out of the loop to end this task as matlab-proxy was unable to launch MATLAB successfully
821
+
# even after waiting for EMBEDDED_CONNECTOR_MAX_STARTUP_DURATION_IN_SECONDS
830
822
break
831
-
832
823
else:
833
824
# Do not stop the MATLAB process or break from the loop (the error type is unknown)
834
825
self.error=MatlabError(generic_error)
835
-
logger.error(f"{this_task}: {generic_error}")
836
826
awaitasyncio.sleep(5)
837
827
continue
838
828
839
829
else:
840
-
# If licensing type is existing license and then there are no error logs, then MATLAB cannot be launched with the existing license
830
+
# If there are no logs after the max startup time has elapsed, it means that MATLAB is in a stuck state and cannot be launched.
841
831
# Set the error and stop matlab.
842
-
if (
843
-
self.licensing["type"] =="existing_license"
844
-
andlen(self.logs["matlab"]) ==0
845
-
):
846
-
await__force_stop_matlab()
847
-
# Breaking out of the loop will end this task as matlab-proxy was unable to launch MATLAB successfully even after embedded_connector_max_startup_duration
832
+
logger.error(
833
+
f":{this_task}: MATLAB did not start in {int(self.EMBEDDED_CONNECTOR_MAX_STARTUP_DURATION_IN_SECONDS)} seconds!"
834
+
)
835
+
iflen(self.logs["matlab"]) ==0:
836
+
await__force_stop_matlab(user_visible_error)
837
+
# Breaking out of the loop to end this task as matlab-proxy was unable to launch MATLAB successfully
838
+
# even after waiting for EMBEDDED_CONNECTOR_MAX_STARTUP_DURATION_IN_SECONDS
0 commit comments