Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent API Calls After Cells Kernel Shutdown #343

Open
MarcosVn opened this issue Dec 20, 2024 · 2 comments
Open

Persistent API Calls After Cells Kernel Shutdown #343

MarcosVn opened this issue Dec 20, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@MarcosVn
Copy link
Contributor

MarcosVn commented Dec 20, 2024

Description

I have my own custom Notebook.tsx component that uses the Cell.tsx set from jupyter-react

Currently, every time a user accesses this notebook, we create a kernel, and upon exiting, we shut it down (to maintain a unique context per notebook, similar to the JupyterLabApp).

One issue we have today (and would like to confirm) is that even after a user leaves Notebook X, meaning they are no longer inside the component and the associated kernel has been shut down, requests to /jupyter-server/api/sessions?{id} and /jupyter-server/api/kernels?{id} continue to be made continuously (and these likely accumulate as we have N notebooks with N cells).

From some tests, I noticed that this seems to occur even in the ./src/examples/Cells of the library.

Is this a known issue, and is there any way to control these calls?

Reproduce

  1. Create a wrapper over Cells.tsx example;
  2. Leave the component (navigate to another route/context) and observe the requests still being made.

Expected behavior

Have better control over these requests

Context

  • Datalayer version: 0.17.2

  • Browser and version: Chrome Version 130.0.6723.116

  • Current unmount code:

notebookStore.reset(id).finally(() => {
   kernelManager?.shutdown(kernel.id).then().finally(() => {
     console.log(`Kernel ${kernel?.id} is turned off`);
    });
});
  • From our custom Notebook.tsx:

image

  • From jupyter-react ./src/examples/Cells:

image

@MarcosVn MarcosVn added the bug Something isn't working label Dec 20, 2024
@echarles
Copy link
Member

Yeah, I have seen that difficulty to really teradown the jupyterlab services. We are leading towards fully serverless components, and ensure better lifecycle management. TBH that difficult is mainly generated by the upstream jupyterlab being not always like it should be. Also, I can spend time to debug/fix on main branch, but won't be able to look at 0.17.x specifics.

@MarcosVn
Copy link
Contributor Author

MarcosVn commented Dec 20, 2024

Hey @echarles, thanks for the quick feedback.

Regarding the version, I’ll retest this: both the ./src/examples/Cells and our component in the main branch ASAP, and I’ll provide feedback here in the issue, okay?

Taking advantage of the context: Is there any known and more direct way to force the "shutdown" of these requests, even externally through some already existing interface (even if it’s from the core)?

My (main) concern is the accumulation of these requests over time (in case the user keeps a session/browser open).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants