xeus
xeus copied to clipboard
overwriting json files in drive breaks kernels
overwriting json stored in the lite drive will break the kernel. In xeus-python one can reproduce this via: (this also fails for other kernels (xeus-r for instance))
s = R"""
{
"args": {}
}
"""
import json
data = json.loads(s)
with open('data.json', 'w') as f:
json.dump(data, f)
with open('data.json', 'w') as f:
json.dump(data, f)
the kernel will be in a busy state forever and we see this error in the dev-console
VM2772:1 Uncaught (in promise) SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at R.put (drivecontents.js:118:24)
at R.processDriveRequest (drivecontents.js:30:29)
at h._onDriveMessage (service-worker-manager.js:49:65)
at BroadcastChannel._onBroadcastMessage (service-worker-manager.js:45:22)
I observed the following: in drivecontent.js when trying to save / overwrite a json which already in the drive, we see request.data.data = "" ie its only an empty string.