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

WebSocket does not connect #1965

Closed
sprungj opened this issue Mar 3, 2022 · 19 comments
Closed

WebSocket does not connect #1965

sprungj opened this issue Mar 3, 2022 · 19 comments
Labels
bug Something isn't working HTTP/WS The connection between backend and frontend

Comments

@sprungj
Copy link

sprungj commented Mar 3, 2022

3 2 22

The interface hangs in the loading state shown at the end of the video. The same thing happens if I try to load one of the sample notebooks.

Apologies if there is something obvious going on here -- I haven't been able to find a description of the same issue.

Thank you!

@disberd
Copy link
Contributor

disberd commented Mar 4, 2022

Do you get any errors on the browser's developer console?

@sprungj
Copy link
Author

sprungj commented Mar 4, 2022

Getting 'WebSocket can't connect' errors in both Firefox and Chromium. Looks like I'm in the Issue #1168 family, though not Firefox exclusive. I'm not connected to a VPN.

Screenshot_2022-03-04_08-00-15
Screenshot_2022-03-04_08-01-45

Here is the Chromium log:

localhost-1646402874457.log

@disberd
Copy link
Contributor

disberd commented Mar 4, 2022

Unfortunately I can't help you with the specific error. Tagging @fonsp as he can probably help you better

@rikhuijzer

This comment was marked as off-topic.

@rikhuijzer
Copy link
Collaborator

rikhuijzer commented Mar 4, 2022

The interface hangs in the loading state shown at the end of the video. The same thing happens if I try to load one of the sample notebooks.

@sprungj, are you running master or Pluto 0.18.1 (latest release)?

@sprungj
Copy link
Author

sprungj commented Mar 4, 2022

I'm using the latest release.

@fonsp

This comment was marked as off-topic.

@fonsp fonsp changed the title Pluto hangs indefinitely when attempting to open new file or sample notebook WebSocket does not connect Mar 5, 2022
@fonsp fonsp added bug Something isn't working HTTP/WS The connection between backend and frontend labels Mar 5, 2022
@fonsp
Copy link
Owner

fonsp commented Mar 5, 2022

Did a previous version of Pluto work on your computer before? Do previous versions work right now? Does https://binder.plutojl.org/ work? Did you try restarting your computer? Can you try a different port? Pluto.run(port=23456)

@sprungj
Copy link
Author

sprungj commented Mar 6, 2022

This was my first attempt to get it running on this computer (have tried restarting). I tried 0.17.5 and 0.16.0 as well and had the same issue. The Binder link does work! But running with a different port doesn't. I'm seeing Unchecked lastError value: Error: Could not establish connection. Receiving end does not exist. in the browser console.

@fonsp
Copy link
Owner

fonsp commented Mar 11, 2022

Hey @sprungj !

Could you do the following in Chrome:

  1. Run Pluto, go to chrome and navigate to localhost:1234
  2. Press F12, and open the Network panel
  3. At the top, click "WS" (WebSocket)
  4. Reload the page, now a single request should show up, to localhost
  5. Click on the request, and send us a screenshot of the entire chrome window. Make sure that all Request Headers and Response Headers (if any) are visible.

For example, this should look like:
image

Next, click on the two View source buttons next to Request Headers and Response Headers. Copy paste this into your issue, for example:

HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: wXYRAXJ/nOOYT7yvTOEUobYnkIQ=

GET ws://localhost:1234/ HTTP/1.1
Host: localhost:1234
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36
Upgrade: websocket
Origin: http://localhost:1234
Sec-WebSocket-Version: 13
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,nl;q=0.8,fr;q=0.7,de;q=0.6
Cookie: secret=SPZD6im8
Sec-WebSocket-Key: Kow2j8Z8DGKxyK05aG0dRw==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

@sprungj
Copy link
Author

sprungj commented Mar 12, 2022

The View source option doesn't seem to be available, maybe because of the Provisional headers are shown warning?

Screenshot_2022-03-12_13-58-43

I should have tried this earlier, but: Python runs fine in a Jupyter notebook in the browser, but Jupyter can't connect to the Julia kernel in the browser or in VSCode. So it seems like I have something going wrong prior to Pluto -- apologies if this issue has been a red herring!

@fonsp
Copy link
Owner

fonsp commented Mar 12, 2022

@quinnj What do you think of this last report? It looks like:

  • HTTP.jl can serve HTTP requests, but not WS
  • HTTP headers are working, you can see that Pluto's secret cookie was set previously
  • It is probably caused by the server, not the browser, because:
    • Running Pluto on binder works
    • Python's Jupyter web server can serve HTTP and WS
  • Jupyter (running in python) can't connect with IJulia.jl, which does not use HTTP.jl I think, they talk over ZMQ, which is provided by Sockets and ZMQ_jll

@quinnj
Copy link

quinnj commented Apr 19, 2022

@fonsp are you able to reproduce this at all? Is it perhaps version (Julia or HTTP.jl) specific issue? Or OS specific? Does pluto have verbose logging we could turn on for the HTTP server?

If this is reproducible, I can try to dig in deeper to figure out why the WS connections aren't working but regular http requests are.

@quinnj
Copy link

quinnj commented Jun 11, 2022

I just merged an overhaul of the websockets code in HTTP#master, so it might be worth trying the issue here again with HTTP#master checked out. Happy to help debug things here if it's still reproducible.

@sprungj
Copy link
Author

sprungj commented Jun 13, 2022

Got the following error loading Pluto after adding HTTP#master:
Screenshot_2022-06-13_12-17-35

@rikhuijzer
Copy link
Collaborator

@sprungj That's correct. HTTP is in the process of a breaking change so not everything will work. Would be nice if you can update the Pluto code on your system and continue from there. If you put it in a draft PR, then we can quickly switch to the new HTTP once it is released

@sprungj
Copy link
Author

sprungj commented Jun 13, 2022

@rikhuijzer Got it, I will give it a shot!

@Pangoraw
Copy link
Collaborator

A new version of Pluto.jl with HTTP.jl 1.0 has just been released. Could you try to see if the problem still happens with [email protected] ?

@sprungj
Copy link
Author

sprungj commented Jul 27, 2022

Looks to be working, hurrah! Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working HTTP/WS The connection between backend and frontend
Projects
None yet
Development

No branches or pull requests

6 participants