smt: handle failure of setrlimit syscall
authorN. Engelhardt <nakengelhardt@gmail.com>
Mon, 15 Jul 2019 15:33:18 +0000 (23:33 +0800)
committerN. Engelhardt <nakengelhardt@gmail.com>
Mon, 15 Jul 2019 15:33:18 +0000 (23:33 +0800)
backends/smt2/smtio.py

index ae7968a1b80b92e68277355037c976bfc4f62433..bac68ac7094648d2aa7d76fcb52b9e2d558f426c 100644 (file)
@@ -43,7 +43,11 @@ if os.name == "posix":
         if current_rlimit_stack[1] != resource.RLIM_INFINITY:
             smtio_stacksize = min(smtio_stacksize, current_rlimit_stack[1])
         if current_rlimit_stack[0] < smtio_stacksize:
-            resource.setrlimit(resource.RLIMIT_STACK, (smtio_stacksize, current_rlimit_stack[1]))
+            try:
+                resource.setrlimit(resource.RLIMIT_STACK, (smtio_stacksize, current_rlimit_stack[1]))
+            except ValueError:
+                # couldn't get more stack, just run with what we have
+                pass
 
 
 # currently running solvers (so we can kill them)