From 0e20d9be3fda607b65035d745a2c33d5f39f6dbb Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Mon, 3 Apr 2023 14:37:35 +0200
Subject: [PATCH] TMSS-2349: try/except

---
 .../services/scheduling/bin/tmss_scheduling_service   | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/SAS/TMSS/backend/services/scheduling/bin/tmss_scheduling_service b/SAS/TMSS/backend/services/scheduling/bin/tmss_scheduling_service
index c882e87eb41..50d4f8cf017 100755
--- a/SAS/TMSS/backend/services/scheduling/bin/tmss_scheduling_service
+++ b/SAS/TMSS/backend/services/scheduling/bin/tmss_scheduling_service
@@ -31,10 +31,13 @@ def main():
 
     logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)
 
-    # some parts of scheduling use recursion. Bump the conservative python recursion limit.
-    import resource, sys
-    resource.setrlimit(resource.RLIMIT_STACK, resource.RLIM_INFINITY)
-    sys.setrecursionlimit(10000)
+    try:
+        # some parts of scheduling use recursion. Bump the conservative python recursion limit.
+        import resource, sys
+        resource.setrlimit(resource.RLIMIT_STACK, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
+        sys.setrecursionlimit(10000)
+    except Exception as e:
+        logger.error(e)
 
     # Check the invocation arguments
     parser = OptionParser('%prog [options]',
-- 
GitLab