-
Notifications
You must be signed in to change notification settings - Fork 43
Secondary SpiderMonkeyError thrown while deserializing an already-handled Python exception (error cascade / double-fault) #501
Copy link
Copy link
Open
Description
Issue type
Bug
How did you install PythonMonkey?
Installed from pip
OS platform and distribution
macOS Sequoia 15.5 (24F74), M2 chip
Python version (python --version)
3.12.6
PythonMonkey version (pip show pythonmonkey)
1.3.0
Bug Description
I wrote a DCP job that deliberately imports a package that isn't available nor exists, e.g. "nanana", to observe the error message.
When a Python exception originating from a JS/wasm environment (via Pyodide) is surfaced correctly as a structured error object, pythonmonkey subsequently throws a secondary SpiderMonkeyError during deserialization, even though the original error has already been delivered to user code and handled.
This results in a noisy, cascading failure where a handled error still causes an uncatchable exception at the PythonMonkey layer.
Standalone code to reproduce the issue
import dcp
dcp.init()
my_inputs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
my_args = [25, 11]
def my_function(x, a, b):
dcp.progress()
import nanana
result = x + a + b
return result
my_job = dcp.compute_for(my_inputs, my_function, my_args)
my_job.computeGroups = [
{"joinKey": "demo"}
]
# Prompt for join secrets at runtime
from getpass import getpass
for g in my_job.computeGroups:
if g.get("joinKey") != "public":
g["joinSecret"] = getpass(f"Enter join secret for compute group '{g['joinKey']}': ")
my_job.on('readystatechange', lambda sta: print(f"State: {sta}"))
my_job.on('accepted', lambda _: print(f" Job ID: {my_job.id}\n Job accepted, awaiting results..."))
import json
my_job.on('noProgress', lambda nop: print(json.dumps(nop, indent=4).replace('\\n', '\n')))
my_job.on('error', lambda err: print(json.dumps(err, indent=4).replace('\\n', '\n')))
my_job.exec()
results = my_job.wait()
print(results)Relevant log output or backtrace
{
"name": "PythonError",
"message": "Traceback (most recent call last):
File \"<exec>\", line 105, in slice_handler_deserialization_wrapper
File \"<string>\", line 3, in my_function
ModuleNotFoundError: No module named 'nanana'
",
"timestamp": "2026-01-11T13:59:09.149Z",
"code": "EUNCAUGHT",
"stack": "PythonError: Traceback (most recent call last):
File \"<exec>\", line 105, in slice_handler_deserialization_wrapper
File \"<string>\", line 3, in my_function
ModuleNotFoundError: No module named 'nanana'
at new_error (https://scheduler.distributed.computer/dcp-client/libexec/sandbox/pyodide-core.js?d91005494a226e4361d9ae1a2f739dc2dc45750a:2:1002009)
at wasm://wasm/020fb45e:wasm-function[261]:0x10f02c
at wasm://wasm/020fb45e:wasm-function[262]:0x10f0f4
at callPyObjectKwargs (https://scheduler.distributed.computer/dcp-client/libexec/sandbox/pyodide-core.js?d91005494a226e4361d9ae1a2f739dc2dc45750a:2:1045919)
at Module.callPyObject (https://scheduler.distributed.computer/dcp-client/libexec/sandbox/pyodide-core.js?d91005494a226e4361d9ae1a2f739dc2dc45750a:2:1047481)
at Function.apply (https://scheduler.distributed.computer/dcp-client/libexec/sandbox/pyodide-core.js?d91005494a226e4361d9ae1a2f739dc2dc45750a:2:1063661)
at Object.apply (https://scheduler.distributed.computer/dcp-client/libexec/sandbox/pyodide-core.js?d91005494a226e4361d9ae1a2f739dc2dc45750a:2:1060100)
at workFunctionWrapper (https://scheduler.distributed.computer/dcp-client/libexec/sandbox/bravojs-env.js?d91005494a226e4361d9ae1a2f739dc2dc45750a:246:40)
at async runWorkFunction_inner (https://scheduler.distributed.computer/dcp-client/libexec/sandbox/bravojs-env.js?d91005494a226e4361d9ae1a2f739dc2dc45750a:403:16)",
"jobName": "Ad-Hoc Job9La7w7",
"job": "jjK71iUUHCZIyYLa9La7w7",
"sliceNumber": 7.0
}
[SpiderMonkeyError('Error in file , on line 0, column 881757:\nPythonError: Traceback (most recent call last):\n File "<exec>", line 105, in slice_handler_deserialization_wrapper\n File "<string>", line 3, in my_function\nModuleNotFoundError: No module named \'nanana\'\n\nStack Trace:\n unprepare$object@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:881757\n unprepare@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:880640\n serialize$$unmarshal@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893473\n deserialize@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893840\n utils$$decodeData@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1506660\n 219/fetchUri$$fetchURI/<@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1505128\n'), SpiderMonkeyError('Error in file , on line 0, column 881757:\nPythonError: Traceback (most recent call last):\n File "<exec>", line 105, in slice_handler_deserialization_wrapper\n File "<string>", line 3, in my_function\nModuleNotFoundError: No module named \'nanana\'\n\nStack Trace:\n unprepare$object@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:881757\n unprepare@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:880640\n serialize$$unmarshal@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893473\n deserialize@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893840\n utils$$decodeData@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1506660\n 219/fetchUri$$fetchURI/<@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1505128\n'), SpiderMonkeyError('Error in file , on line 0, column 881757:\nPythonError: Traceback (most recent call last):\n File "<exec>", line 105, in slice_handler_deserialization_wrapper\n File "<string>", line 3, in my_function\nModuleNotFoundError: No module named \'nanana\'\n\nStack Trace:\n unprepare$object@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:881757\n unprepare@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:880640\n serialize$$unmarshal@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893473\n deserialize@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893840\n utils$$decodeData@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1506660\n 219/fetchUri$$fetchURI/<@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1505128\n'), SpiderMonkeyError('Error in file , on line 0, column 881757:\nPythonError: Traceback (most recent call last):\n File "<exec>", line 105, in slice_handler_deserialization_wrapper\n File "<string>", line 3, in my_function\nModuleNotFoundError: No module named \'nanana\'\n\nStack Trace:\n unprepare$object@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:881757\n unprepare@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:880640\n serialize$$unmarshal@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893473\n deserialize@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893840\n utils$$decodeData@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1506660\n 219/fetchUri$$fetchURI/<@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1505128\n'), SpiderMonkeyError('Error in file , on line 0, column 881757:\nPythonError: Traceback (most recent call last):\n File "<exec>", line 105, in slice_handler_deserialization_wrapper\n File "<string>", line 3, in my_function\nModuleNotFoundError: No module named \'nanana\'\n\nStack Trace:\n unprepare$object@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:881757\n unprepare@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:880640\n serialize$$unmarshal@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893473\n deserialize@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893840\n utils$$decodeData@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1506660\n 219/fetchUri$$fetchURI/<@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1505128\n'), SpiderMonkeyError('Error in file , on line 0, column 881757:\nPythonError: Traceback (most recent call last):\n File "<exec>", line 105, in slice_handler_deserialization_wrapper\n File "<string>", line 3, in my_function\nModuleNotFoundError: No module named \'nanana\'\n\nStack Trace:\n unprepare$object@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:881757\n unprepare@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:880640\n serialize$$unmarshal@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893473\n deserialize@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893840\n utils$$decodeData@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1506660\n 219/fetchUri$$fetchURI/<@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1505128\n'), SpiderMonkeyError('Error in file , on line 0, column 881757:\nPythonError: Traceback (most recent call last):\n File "<exec>", line 105, in slice_handler_deserialization_wrapper\n File "<string>", line 3, in my_function\nModuleNotFoundError: No module named \'nanana\'\n\nStack Trace:\n unprepare$object@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:881757\n unprepare@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:880640\n serialize$$unmarshal@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893473\n deserialize@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893840\n utils$$decodeData@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1506660\n 219/fetchUri$$fetchURI/<@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1505128\n'), SpiderMonkeyError('Error in file , on line 0, column 881757:\nPythonError: Traceback (most recent call last):\n File "<exec>", line 105, in slice_handler_deserialization_wrapper\n File "<string>", line 3, in my_function\nModuleNotFoundError: No module named \'nanana\'\n\nStack Trace:\n unprepare$object@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:881757\n unprepare@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:880640\n serialize$$unmarshal@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893473\n deserialize@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893840\n utils$$decodeData@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1506660\n 219/fetchUri$$fetchURI/<@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1505128\n'), SpiderMonkeyError('Error in file , on line 0, column 881757:\nPythonError: Traceback (most recent call last):\n File "<exec>", line 105, in slice_handler_deserialization_wrapper\n File "<string>", line 3, in my_function\nModuleNotFoundError: No module named \'nanana\'\n\nStack Trace:\n unprepare$object@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:881757\n unprepare@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:880640\n serialize$$unmarshal@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893473\n deserialize@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893840\n utils$$decodeData@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1506660\n 219/fetchUri$$fetchURI/<@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1505128\n'), SpiderMonkeyError('Error in file , on line 0, column 881757:\nPythonError: Traceback (most recent call last):\n File "<exec>", line 105, in slice_handler_deserialization_wrapper\n File "<string>", line 3, in my_function\nModuleNotFoundError: No module named \'nanana\'\n\nStack Trace:\n unprepare$object@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:881757\n unprepare@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:880640\n serialize$$unmarshal@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893473\n deserialize@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:893840\n utils$$decodeData@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1506660\n 219/fetchUri$$fetchURI/<@/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/dcp/js/node_modules/dcp-client/dist/dcp-client-bundle.js:1:1505128\n')]Additional info if applicable
What branch of PythonMonkey were you developing on? (If applicable)
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Backlog