jupyter-ui icon indicating copy to clipboard operation
jupyter-ui copied to clipboard

Notebook After uninstallation, the api is still called in the background

Open chenjpu opened this issue 1 year ago • 7 comments

Using nextjs technology to integrate Notebook, when the navigation leaves the Notebook edit page, the api background continuously access。 When navigate to the Notebook edit page again, the shortcut keys all fail。

Description

Reproduce

  1. Go to '...'
  2. Click on '...'
  3. Scroll down to '...'
  4. See error '...'

Expected behavior

Context

  • Datalayer version:
  • Operating System and version:
  • Browser and version:
Browser Output

image

image

chenjpu avatar Jul 05 '24 08:07 chenjpu

Hi @chenjpu Are you using the simple Notebook component or the more evolved JupyterLabApp component?

How do you navigate away? (maybe the Notebook component is still rendered but not shown?)

echarles avatar Jul 05 '24 09:07 echarles

using the simple Notebook component

use nextjs router(Only one page contains the Notebook component)

chenjpu avatar Jul 05 '24 20:07 chenjpu

Force to refresh the browser, and the background api access stops. Is it the resource leakage caused by the service when the components are uninstalled?

chenjpu avatar Jul 08 '24 02:07 chenjpu

@echarles https://github.com/datalayer/jupyter-ui/blob/53f2cd655c5fff4ef7772cef003ddbd86e4b85b5/packages/react/src/components/lumino/Lumino.tsx#L30-L37

When the component is unloaded, the children.node.isConnected=false, lead to an exception. Does it have anything to do with this?

chenjpu avatar Jul 10 '24 06:07 chenjpu

When the component is unloaded, the children.node.isConnected=false, lead to an exception. Does it have anything to do with this?

That could be the case. that exception is coming from Lumino and hard to remove (ideally it should be).

Maybe a temp workaround, a termination action on the Notebook hook could help.

echarles avatar Jul 10 '24 08:07 echarles

Fix keydown Event leak(https://github.com/datalayer/jupyter-ui/pull/265)

chenjpu avatar Jul 11 '24 04:07 chenjpu

@echarles

useEffect(() => {
    return () => {
      try {
        kernelManager?.dispose();
        serviceManager?.dispose();
      } catch (e) {
        //console.log(e)
      }
    };
  }, [serviceManager, kernelManager]);

Clear some api calls, but there are still some other apis rotation :( image

chenjpu avatar Jul 11 '24 08:07 chenjpu