We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0222d9e commit 9ec9cf7Copy full SHA for 9ec9cf7
apps/common/utils/tool_code.py
@@ -7,6 +7,7 @@
7
import socket
8
import subprocess
9
import sys
10
+import signal
11
import uuid_utils.compat as uuid
12
from common.utils.logger import maxkb_logger
13
from django.utils.translation import gettext_lazy as _
@@ -234,8 +235,10 @@ def _exec_sandbox(self, _code):
234
235
text=True,
236
capture_output=True,
237
timeout=self.process_timeout_seconds,
238
+ preexec_fn=os.setsid,
239
**kwargs)
- except subprocess.TimeoutExpired:
240
+ except subprocess.TimeoutExpired as e:
241
+ os.killpg(e.pid, signal.SIGKILL)
242
raise Exception(_("Sandbox process execution timeout, consider increasing MAXKB_SANDBOX_PYTHON_PROCESS_TIMEOUT_SECONDS."))
243
return subprocess_result
244
0 commit comments