ipython / ipython/ipykernel

object_inspect may call user-defined functions that wedge the kernel

オープン
#383 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
734
フォーク
412
平均マージ
1日 5時間
マージ済み PR(30日)
8

説明

Actions that induce object inspection, e.g., shift-tab after a variable, may call user-defined functions that take a long time to complete. When that happens, the kernel is wedged. Subsequent code execution blocks waiting for the inspect reply, kernel interrupt doesn't unblock, meaning that a kernel process restart is required to proceed.

An example follows:
![slow_inspect](https://user-images.githubusercontent.com/151865/51767459-53843c80-2092-11e9-8042-24b5373e0cca.gif)

This example shows the back-to-back completion time for an object inspect triggered by shift-tab. I recorded the demo from a Jupyterlab frontend started on `try.jupyter.org`. The issue applies to vanilla Jupyter as well.

In this example, `Slow` is an object with a `__repr__` that takes 1 second. `__repr__` seems to be called multiple times during inspection, meaning that the end-to-end time to inspect an object with a 1 second `__repr__` is ~10 seconds.

Of course, increasing the `sleep` increases the delay.

I suspect there's a fundamental tradeoff between the information available in object inspection and reliability. To avoid becoming wedged, object inspection and code completion should avoid calling any user-defined functions. But, that will limit available information.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。