判题时偶发JSONDecodeError

Author: MattDong123Created Sep 12, 2025Updated Sep 12, 2025

如题,判题机运行一段时间就会偶发JSONDecodeError的情况,好像是沙箱里面返回空值,各位大神有遇到类似的问题嘛或者有好的解决办法嘛

Traceback (most recent call last):
  File "/app/server.py", line 288, in server
    ret = {"err": None, "data": getattr(JudgeServer, path)(**data)}
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/server.py", line 164, in judge
    exe_path = Compiler().compile(
               ^^^^^^^^^^^^^^^^^^^
  File "/app/compiler.py", line 27, in compile
    result = judger.run(
             ^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/judger/__init__.py", line 85, in run
    return json.loads(out.decode("utf-8"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 338, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 356, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)