interactive icon indicating copy to clipboard operation
interactive copied to clipboard

System.TimeoutException: Timeout resolving the kernel's HTTP endpoint. Please try again when running in Binder

Open eosfor opened this issue 3 years ago • 2 comments

Hello colleagues,

I run this notebook in Binder.

And the very last step fails with the following message. Is there any way to make it work?

System.TimeoutException: Timeout resolving the kernel's HTTP endpoint. Please try again.
   at Microsoft.DotNet.Interactive.Http.HtmlNotebookFrontendEnvironment.ExecuteClientScript(String code, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Http\HtmlNotebookFrontendEnvironment.cs:line 53
   at Microsoft.DotNet.Interactive.Kernel.HandleAsync(KernelCommand command, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\Kernel.cs:line 256
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<BuildPipeline>b__6_0(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation _) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 57
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_1.<<BuildPipeline>b__3>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 72
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.CompositeKernel.LoadExtensions(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation next) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\CompositeKernel.cs:line 144
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_0.<<BuildPipeline>g__Combine|2>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 70
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.SendAsync(KernelCommand command, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 48
   at Microsoft.DotNet.Interactive.Http.HtmlNotebookFrontendEnvironment.ExecuteClientScript(String code, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Http\HtmlNotebookFrontendEnvironment.cs:line 53
   at Microsoft.DotNet.Interactive.Kernel.HandleAsync(KernelCommand command, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\Kernel.cs:line 256
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<BuildPipeline>b__6_0(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation _) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 57
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_1.<<BuildPipeline>b__3>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 72
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.CompositeKernel.LoadExtensions(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation next) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\CompositeKernel.cs:line 144
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_0.<<BuildPipeline>g__Combine|2>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 70
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.SendAsync(KernelCommand command, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 48

eosfor avatar Jan 14 '22 05:01 eosfor

Faced a similar problem, but my setup is a little bit unique.

JupyterHub was hosted via SystemD and exposed via bare-metal server (lab.ts.anhdle14.me) on 0.0.0.0. Another proxy was hosted on top of Jupyterhub on that machine via Tailscale (Zero Trust VPN) solution so it can be reached out from a different IP (jupyter.ts.anhdle14.me)

$ nslookup jupyter.ts.anhdle14.me
192.168.10.11

$ nslookup lab.ts.anhdle14.me
100.107.19.122

So if I goes to https://jupyter.ts.anhdle14.me and tried executing anything #!js magic function it failed with the above error.

But If I goes to http://lab.ts.anhdle14.me:8000 and running #!js it works.

I have played around with most of the settings in jupyterhub_config.py but nothing fix it. 🤔 I think this is some hacky things going on with JS kernel and I would love to know how/why to fix it. I think somehow dotnet-interactive need to run that port on 0.0.0.0 instead of 127.0.0.1. Is there anyway to do this?

image

anhdle14 avatar Mar 18 '23 19:03 anhdle14

Dear @jonsequitur

Any good news on this? I'm having a similar issue with a different notebook now.

eosfor avatar May 01 '24 04:05 eosfor

This older approach to the JavaScript kernel, used in Jupyter frontends including Binder, is being deprecated in favor of the approach used in Polyglot Notebooks, which I think shouldn't have this problem as it doesn't depend on inserting scripts into the DOM to execute them.

Have you tried this in Polyglot Notebooks or Codespaces by any chance?

jonsequitur avatar May 14 '24 22:05 jonsequitur

I'm sorry @jonsequitur , when you say Polyglot Notebooks you mean VS Code Polyglot Notebooks? It obviously works in VS Code. What i'm looking for is some online service, which can run .net interactive kernel and notebooks based on it so:

  • i can share notebooks/demos
  • people wont need to install vs code to try them

eosfor avatar May 14 '24 22:05 eosfor

Yes. The Polyglot Notebooks extension also works in GitHub Codespaces, which lets you share notebooks online with people who don't have VS Code installed. This uses the newer JavaScript kernel, which is much more capable.

Until .NET Interactive's support for JupyterLab and Jupyter Notebook is updated to use the newer JavaScript kernel, Binder support for JavaScript cells will be more limited.

jonsequitur avatar May 14 '24 22:05 jonsequitur

Thanks, @jonsequitur , do you have an example of a devcontainer which is configured to run .net interactive notebooks?

eosfor avatar May 15 '24 22:05 eosfor

Feels like I've found one, right at the root of the repo :D

eosfor avatar May 17 '24 01:05 eosfor