gap-packages / JupyterKernel

Native Jupyter kernel for GAP
https://gap-packages.github.io/JupyterKernel/
BSD 3-Clause "New" or "Revised" License
19 stars 12 forks source link

Restarting the kernel takes 30s and shows errors on console #83

Open nathancarter opened 5 years ago

nathancarter commented 5 years ago

This works as expected:

  1. Run jupyter notebook on console.
  2. From the "New" menu, choose "GAP 4."
  3. The console log indicates that the Kernel is ready very quickly (<1 second)
  4. From the "Kernel" menu, choose "Restart" (then confirm by clicking Restart).
  5. Jupyter says the Kernel restarts very quickly (about 1 second), and the console log confirms this. It continues to work that way if you evaluate cells with no errors.

This does not work as expected:

  1. Evaluate a cell that causes an error, such as LoadPackage("nothing"); (which just prints warnings and then returns fail, so it's not even really a full error).
  2. From the "Kernel" menu, choose "Restart" (then confirm by clicking Restart).
  3. Jupyter says the Kernel restarts very slowly (about 30 seconds, which is the part that's not expected), and the console log confirms this. It also displays the following errors:
    [I 13:55:56.392 NotebookApp] Kernel restarted: 9a2c10c7-f3d9-4dd3-b4f5-6996cf51ec04
    GAP Jupyter Kernel Starting using gap
    true
    [W 13:56:26.392 NotebookApp] Timeout waiting for kernel_info_reply: 9a2c10c7-f3d9-4dd3-b4f5-6996cf51ec04
    [E 13:56:26.392 NotebookApp] Exception restarting kernel
    Traceback (most recent call last):
      File "/usr/local/Cellar/jupyter/1.0.0_5/libexec/lib/python3.7/site-packages/notebook/services/kernels/handlers.py", line 85, in post
        yield gen.maybe_future(km.restart_kernel(kernel_id))
      File "/usr/local/Cellar/jupyter/1.0.0_5/libexec/vendor/lib/python3.7/site-packages/tornado/gen.py", line 1099, in run
        value = future.result()
    tornado.util.TimeoutError: Timeout waiting for restart
    [E 13:56:26.395 NotebookApp] {
      "Host": "localhost:8888",
      "Connection": "keep-alive",
      "Content-Length": "0",
      "Accept": "application/json, text/javascript, */*; q=0.01",
      "Origin": "http://localhost:8888",
      "X-Requested-With": "XMLHttpRequest",
      "X-Xsrftoken": "2|57716eb3|2d58a0e505dbd61540e683e091c81d2c|1538574010",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36",
      "Referer": "http://localhost:8888/notebooks/Untitled1.ipynb?kernel_name=gap-4",
      "Accept-Encoding": "gzip, deflate, br",
      "Accept-Language": "en-US,en;q=0.9",
      "Cookie": "io=XpNle5TPVSBBnJj5AAAA; username-localhost-8889=\"2|1:0|10:1538557044|23:username-localhost-8889|44:NjNhMDAzOThkMTA0NDFhNjlkNTM1YjcxOTQyNjI3NTc=|85bc57738be300ba99cdaed5d3dbcea7a9caeb8c61f94d5663917ae794f7578a\"; _xsrf=2|57716eb3|2d58a0e505dbd61540e683e091c81d2c|1538574010; username-localhost-8888=\"2|1:0|10:1540817704|23:username-localhost-8888|44:YjQ3M2NmNTBiNDhjNGRhNDg2NjY2MjgxMDNlYTc4NDM=|5eb7c689393ec565419ada9c033cae186e77a829a9f6c6292e21278e7c63d759\""
    }
    [E 13:56:26.395 NotebookApp] 500 POST /api/kernels/9a2c10c7-f3d9-4dd3-b4f5-6996cf51ec04/restart (127.0.0.1) 30112.88ms referer=http://localhost:8888/notebooks/Untitled1.ipynb?kernel_name=gap-4
    [I 13:56:26.401 NotebookApp] Discarding 1 buffered messages for 9a2c10c7-f3d9-4dd3-b4f5-6996cf51ec04:62dc864695ca4c4b84179e249da9e488
    [I 13:56:26.504 NotebookApp] Kernel shutdown: 9a2c10c7-f3d9-4dd3-b4f5-6996cf51ec04
    GAP Jupyter Kernel Starting using gap
    [I 13:56:26.523 NotebookApp] Kernel started: b340f394-4eb0-4a90-9c87-af38b76fcf91
    true
markuspf commented 5 years ago

This could be related to #73

dimpase commented 5 years ago

I suggest to use a already prepared workspace to restart, this might speed things up...