Open ajrouvoet opened 7 months ago
Actually it looks like a simpler example already has problems.
Using:
And the attached notebook, I get into a seemingly failed state by just re-evaluating the last cell a bunch of times. The first few times I get the correct output, but eventually (after 2-n re-evaluations, randomly) it gets stuck. The cell shows 'busy' and so does the kernel status, but no response comes and no errors in the Jupyter server output.
Hi! does it work with other versions of kernel (previous one)?
Thanks for your reply. I've tried:
With similar results on the provided example notebook.
In the below screenshot you can see the asterisk for the cell being evaluated, but the kernel status indicator showing 'idle'. The first 6 evaluations all yielded the desired graph output, the 7th yielded this stuck state:
A test with Jupyter 5.7.2 makes it seem harder to reproduce the failure condition; but because it occurs randomly it is hard to tell. I'm not sure how likely it is that this is the Kotlin kernel's problem.
Uncaught SyntaxError: Kernel message validation error: JSON.parse:
It is the error inside the browser, right? If yes, could you please try to extract the JSON that cannot be parsed (inside a debugger?)
And could you please copy the contents of the notebook the screenshot of which you made
Apologies for the delay; I tried to reply by Github e-mail, but apparently it did not work.
And could you please copy the contents of the notebook the screenshot of which you made
I had attached that notebook in an above comment as example.zip
.
I haven't been able yet to pinpoint the data that produces the browser console error, but I did now come across errors on the server console that look similar:
[E 2024-05-08 14:23:10.860 ServerApp] Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
f = callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
return callback(self, msg)
^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 508, in handle_outgoing_message
if self._limit_rate(channel, msg, parts):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 657, in _limit_rate
msg["header"] = self.get_part("header", msg["header"], msg_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 524, in get_part
value = self.session.unpack(msg_list[field2idx[field]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_client/session.py", line 124, in json_unpacker
return json.loads(s)
^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[E 2024-05-08 14:23:10.860 ServerApp] Uncaught exception in zmqstream callback
Traceback (most recent call last):
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 634, in _handle_events
self._handle_recv()
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 663, in _handle_recv
self._run_callback(callback, msg)
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
f = callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
return callback(self, msg)
^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 508, in handle_outgoing_message
if self._limit_rate(channel, msg, parts):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 657, in _limit_rate
msg["header"] = self.get_part("header", msg["header"], msg_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 524, in get_part
value = self.session.unpack(msg_list[field2idx[field]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_client/session.py", line 124, in json_unpacker
return json.loads(s)
^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Exception in callback BaseAsyncIOLoop._handle_events(29, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(29, 1)>
Traceback (most recent call last):
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/asyncio/events.py", line 84, in _run
self._context.run(self._callback, *self._args)
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/tornado/platform/asyncio.py", line 192, in _handle_events
handler_func(fileobj, events)
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 634, in _handle_events
self._handle_recv()
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 663, in _handle_recv
self._run_callback(callback, msg)
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
f = callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
return callback(self, msg)
^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 508, in handle_outgoing_message
if self._limit_rate(channel, msg, parts):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 657, in _limit_rate
msg["header"] = self.get_part("header", msg["header"], msg_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 524, in get_part
value = self.session.unpack(msg_list[field2idx[field]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_client/session.py", line 124, in json_unpacker
return json.loads(s)
^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[E 2024-05-08 14:23:10.862 ServerApp] Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
f = callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
return callback(self, msg)
^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 508, in handle_outgoing_message
if self._limit_rate(channel, msg, parts):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 657, in _limit_rate
msg["header"] = self.get_part("header", msg["header"], msg_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 524, in get_part
value = self.session.unpack(msg_list[field2idx[field]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_client/session.py", line 124, in json_unpacker
return json.loads(s)
^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[E 2024-05-08 14:23:10.864 ServerApp] Uncaught exception in zmqstream callback
Traceback (most recent call last):
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 634, in _handle_events
self._handle_recv()
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 663, in _handle_recv
self._run_callback(callback, msg)
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
f = callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
return callback(self, msg)
^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 508, in handle_outgoing_message
if self._limit_rate(channel, msg, parts):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 657, in _limit_rate
msg["header"] = self.get_part("header", msg["header"], msg_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 524, in get_part
value = self.session.unpack(msg_list[field2idx[field]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_client/session.py", line 124, in json_unpacker
return json.loads(s)
^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Exception in callback BaseAsyncIOLoop._handle_events(47, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(47, 1)>
Traceback (most recent call last):
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/asyncio/events.py", line 84, in _run
self._context.run(self._callback, *self._args)
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/tornado/platform/asyncio.py", line 192, in _handle_events
handler_func(fileobj, events)
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 634, in _handle_events
self._handle_recv()
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 663, in _handle_recv
self._run_callback(callback, msg)
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
f = callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
return callback(self, msg)
^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 508, in handle_outgoing_message
if self._limit_rate(channel, msg, parts):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 657, in _limit_rate
msg["header"] = self.get_part("header", msg["header"], msg_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_server/services/kernels/connection/channels.py", line 524, in get_part
value = self.session.unpack(msg_list[field2idx[field]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/1b1yn1f26br7h1vn6zjvd1px3mhb8hg2-python3-3.11.9-env/lib/python3.11/site-packages/jupyter_client/session.py", line 124, in json_unpacker
return json.loads(s)
^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I'll see if I can get the malformed JSON out of the browser debugger.
First of all: great work on this. I'm impressed by how well this all works and I'm happy to see Kotlin compete with Python's dominance in data science.
I have set up Jupyter integration for a (closed source) Kotlin library. It generally works well, but I'm seeing some issues where sometimes the kernel seems to stop responding, or possibly delivering malformed responses. It always goes wrong on the re-evaluation of a cell whose response is HTML. Restarting the kernel and re-evaluating everything yields correct results.
On re-evaluation of such cells, I get console errors such as:
The Jupyter server log shows nothing irregular in my eyes. Looks to me like the proper response is composed:
Perhaps I'm also barking up the wrong tree here: I have no strong indication that this is coming from the Kotlin kernel, but I'm suspicious because first evaluation goes correct and because the error seems to surface on some re-evaluations, but not every.
The errors happen both in Jupyterlab frontend and the classic notebooks.
I'd be happy to supply more information if you can tell me how to obtain it.