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 can't connect -- main menu #848

Closed
danvinci opened this issue Jan 16, 2021 · 13 comments
Closed

websocket can't connect -- main menu #848

danvinci opened this issue Jan 16, 2021 · 13 comments
Assignees
Labels
bug Something isn't working HTTP/WS The connection between backend and frontend

Comments

@danvinci
Copy link

danvinci commented Jan 16, 2021

Hi!

First of all, thanks for creating Pluto!

Pluto 0.12.18, macOS 11.1
I'm running into the following issue very frequently:

  • start Julia and Pluto
  • open a new or existing notebook
  • going back to the 'home' clicking on the logo
  • Pluto becomes unresponsive, including the notebook path bar

Screenshot 2021-01-16 at 1 05 30 AM

Restarting Julia has a 50/50 chance of fixing the problem, but also of opening Pluto directly in this 'always loading' state.

Any suggestions on how to go and gather extra information on what's going on?
In the REPL I don't get any messages.

@fonsp
Copy link
Owner

fonsp commented Jan 16, 2021

Which browser?

@danvinci
Copy link
Author

danvinci commented Jan 16, 2021

Firefox 85.0b5 Dev Edition

(although once stuck, it's seen regardless of browser, also tried in Chrome).

Also, another way to replicate the issue, at least on my installation:

  • open a notebook
  • click on the 'Statistics' link in the footer
  • go back in navigation
  • I end up in an empty notebook and Pluto looks disconnected

So, I'm again at the point described above and I have to restart Julia & Pluto a few times to get it to work.
No updates in the REPL as this happens.

@danvinci
Copy link
Author

danvinci commented Jan 17, 2021

I tried to delete everything in the ./julia folder and re-install relevant packages, the problem still persists.
I managed to create a new notebook and run commands things like ''1+1'' and everything was fine until I tried to install Plots and run into #228 (REPL output below).
Also, the only way I can open notebooks is to copy/paste directly their path, as the bar is not working (no autocomplete).

A strange thing I've noticed is that in Statistics I see this:

Screenshot 2021-01-17 at 4 55 16 PM

Things that jump to mind:

  • "versionPluto": "unkown" (I'm using v 0.12.18)
  • "screenWidthApprox": 1200 (I have a 2-screens setup and they're both 1920x1080+)

I tried to open a sample notebook from another tab but nothing happens, I only get to see ''Reconnecting'' on the top right.

It's been a few days that I can't use Pluto:
even if I manage to create a new notebook it won't open again next time, or if it does I run into #228.

Any suggestions on what I can do?

Here the REPL output of when I interrupted the cell installing Plots as it was taking 2+ mins (sent the stop signal a few times and had partial executions in between):

[ Info: Sending interrupt to process 2
      From worker 2:	fatal: error thrown and no exception handler available.
      From worker 2:	InterruptException()
      From worker 2:	jl_mutex_unlock at /Users/julia/buildbot/worker/package_macos64/build/src/./locks.h:144 [inlined]
      From worker 2:	jl_task_get_next at /Users/julia/buildbot/worker/package_macos64/build/src/partr.c:476
      From worker 2:	poptask at ./task.jl:704
      From worker 2:	wait at ./task.jl:712 [inlined]
      From worker 2:	task_done_hook at ./task.jl:442
      From worker 2:	jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1690 [inlined]
      From worker 2:	jl_finish_task at /Users/julia/buildbot/worker/package_macos64/build/src/task.c:196
      From worker 2:	start_task at /Users/julia/buildbot/worker/package_macos64/build/src/task.c:715
┌ Warning: temp cleanup
│   exception =
│    schedule: Task not runnable
│    Stacktrace:
│     [1] error(::String) at ./error.jl:33
│     [2] enq_work(::Task) at ./task.jl:526
│     [3] yield at ./task.jl:626 [inlined]
│     [4] yield at ./task.jl:625 [inlined]
│     [5] Channel{Any}(::Base.Filesystem.var"#_it#24"{Bool,Bool,typeof(throw),String,Array{String,1},Array{String,1}}, ::Int64; taskref::Nothing, spawn::Bool) at ./channels.jl:135
│     [6] #Channel#488 at ./channels.jl:157 [inlined]
│     [7] Channel at ./channels.jl:150 [inlined]
│     [8] walkdir(::String; topdown::Bool, follow_symlinks::Bool, onerror::typeof(throw)) at ./file.jl:913
│     [9] walkdir at ./file.jl:872 [inlined]
│     [10] prepare_for_deletion(::String) at ./file.jl:478
│     [11] temp_cleanup_purge(::Bool) at ./file.jl:513
│     [12] temp_cleanup_purge() at ./file.jl:507
│     [13] _atexit() at ./initdefs.jl:316
└ @ Base.Filesystem file.jl:518
┌ Error: Fatal error on process 2
│   exception =
│    schedule: Task not runnable
│    Stacktrace:
│     [1] error(::String) at ./error.jl:33
│     [2] schedule(::Task, ::Any; error::Bool) at ./task.jl:586
│     [3] schedule at ./task.jl:586 [inlined]
│     [4] uv_writecb_task(::Ptr{Nothing}, ::Int32) at ./stream.jl:1051
│     [5] poptask(::Base.InvasiveLinkedListSynchronized{Task}) at ./task.jl:704
│     [6] wait at ./task.jl:712 [inlined]
│     [7] uv_write(::Sockets.TCPSocket, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:933
│     [8] uv_write at ./stream.jl:918 [inlined]
│     [9] flush(::Sockets.TCPSocket) at ./stream.jl:1014
│     [10] send_msg_(::Distributed.Worker, ::Distributed.MsgHeader, ::Distributed.ResultMsg, ::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/messages.jl:191
│     [11] send_msg_now at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/messages.jl:130 [inlined]
│     [12] send_msg_now(::Sockets.TCPSocket, ::Distributed.MsgHeader, ::Distributed.ResultMsg) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/messages.jl:125
│     [13] deliver_result(::Sockets.TCPSocket, ::Symbol, ::Distributed.RRID, ::NamedTuple{(:level, :msg, :group, :file, :line, :kwargs),Tuple{String,String,Symbol,String,Int64,Dict{Symbol,String}}}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/process_messages.jl:111
│     [14] macro expansion at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/process_messages.jl:302 [inlined]
│     [15] (::Distributed.var"#105#107"{Distributed.CallMsg{:call_fetch},Distributed.MsgHeader,Sockets.TCPSocket})() at ./task.jl:356
└ @ Distributed /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/process_messages.jl:115
Worker 2 terminated.DistributedCell interrupted!
.
ProcessExitedException([ Info: Tried to stop idle workspace - ignoring.
2[ Info: Tried to stop idle workspace - ignoring.
)[ Info: Tried to stop idle workspace - ignoring.
[ Info: Tried to stop idle workspace - ignoring.
[ Info: Tried to stop idle workspace - ignoring.
Distributed.ProcessExitedException(2)[ Info: Tried to stop idle workspace - ignoring.

Stacktrace:[ Info: Tried to stop idle workspace - ignoring.

 [1] worker_from_id(::Distributed.ProcessGroup, ::Int64) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/cluster.jl:1074
 [2] worker_from_id at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/cluster.jl:1071 [inlined]
 [3] remotecall(::Function, ::Int64, ::Module, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:376
 [4] remotecall at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:376 [inlined]
 [5] macro expansion at ./task.jl:403 [inlined]
 [6] macro expansion at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/macros.jl:224 [inlined]
 [7] macro expansion at ./task.jl:332 [inlined]
 [8] remotecall_eval(::Module, ::Array{Int64,1}, ::Expr) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/macros.jl:218
 [9] create_emptyworkspacemodule(::Int64) at /Users/Daniele/.julia/packages/Pluto/luIaC/src/evaluation/WorkspaceManager.jl:100
 [10] delete_vars(::Tuple{Pluto.ServerSession,Pluto.Notebook}, ::Set{Symbol}, ::Set{Tuple{Base.UUID,Array{Symbol,1}}}, ::Set{Expr}; kwargs::Base.Iterators.Pairs{Symbol,Array{Pluto.Cell,1},Tuple{Symbol},NamedTuple{(:to_run,),Tuple{Array{Pluto.Cell,1}}}}) at /Users/Daniele/.julia/packages/Pluto/luIaC/src/evaluation/WorkspaceManager.jl:276
 [11] run_reactive!(::Pluto.ServerSession, ::Pluto.Notebook, ::Pluto.NotebookTopology, ::Pluto.NotebookTopology, ::Array{Pluto.Cell,1}; deletion_hook::Function, persist_js_state::Bool) at /Users/Daniele/.julia/packages/Pluto/luIaC/src/evaluation/Run.jl:65
 [12] run_reactive! at /Users/Daniele/.julia/packages/Pluto/luIaC/src/evaluation/Run.jl:26 [inlined]
 [13] macro expansion at /Users/Daniele/.julia/packages/Pluto/luIaC/src/evaluation/Run.jl:13 [inlined]
 [14] (::Pluto.var"#79#81"{Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},Pluto.ServerSession,Pluto.Notebook,Pluto.NotebookTopology,Pluto.NotebookTopology,Array{Pluto.Cell,1}})() at ./task.jl:356      From worker 3:	   Building PlotlyJS → `~/.julia/packages/PlotlyJS/m2Lzd/deps/build.log`
[ Info: Tried to stop idle workspace - ignoring.
[ Info: Tried to stop idle workspace - ignoring.

This is the incriminated notebook: https://gist.github.com/danvinci/2c97c432b1d224007f7449780a9e96b5

@fonsp
Copy link
Owner

fonsp commented Jan 17, 2021

Can you follow these steps (you have done some already): #553 (comment)

The issue is that the WebSocket connection fails, so let's focus on this. Statistics, opening notebooks and cell interruption are unrelated.

In the main menu screen, with a broken connection (first screenshot), try the following, and report what worked:

  • Refresh the page
  • "Clear cache and refresh" the page
  • Open the main menu in a different browser
  • Run Pluto on a different port: Pluto.run(port=2345)

@danvinci
Copy link
Author

danvinci commented Jan 17, 2021

Ok!

So:

  • Refresh doesn't work
  • Clear cache and refresh doesn't work

When switching to another browser, same port:

  • it works only if the startup was successful (loaded previous sessions, file path bar is responsive), and I switch from FF to Chrome
  • behavior is not 'predictable' and I'm only able to run the first few cells of a notebook (installing packages) until I run into long-running cell problems

Screenshot 2021-01-17 at 7 08 07 PM

When using another port:

  • if startup is not successful in FF (stuck at loading) in Chrome I get this:

Screenshot 2021-01-17 at 7 17 19 PM

(no previous sessions loaded - probably makes sense (?))
  • but, compared to FF, the file path bar is responsive and I can locate/open/run notebooks
  • in FF, even copy/pasting the URL in the bar, it results in the editor being opened with the notebook never being loaded

Hope it helps!

(using Chrome on another port is working so far)

@fonsp
Copy link
Owner

fonsp commented Jan 17, 2021

Thanks! The most important thing is that you share the output of the browser's development console: #553 (comment)

@danvinci
Copy link
Author

Attaching the FF console export!

console-export-2021-1-18_1-54-27.txt

@fonsp
Copy link
Owner

fonsp commented Jan 18, 2021

It looks like you shared something internal in Firefox, can you instead share the output of the Web Console? https://developer.mozilla.org/en-US/docs/Tools/Web_Console

@fonsp
Copy link
Owner

fonsp commented Jan 18, 2021

Also try disabling ad-blocking extensions for the Pluto address (localhost:1234)

@danvinci
Copy link
Author

danvinci commented Jan 19, 2021

Ok!

I've copy/pasted the output of Browser Console instead of Web Console.
Here the output of the FF Web Console.

In this case, Pluto is working in Chrome and I've tried opening it from Firefox (with the proper link including the secret).
I've also disabled uBlock on the domain and refreshed the page before copying any web console output.

SOCKET DID AN OOPSIE - close 13:38:54 
close { target: WebSocket, isTrusted: true, wasClean: true, code: 1006, reason: "", srcElement: WebSocket, currentTarget: WebSocket, eventPhase: 2, bubbles: false, cancelable: false, … }
PlutoConnection.js:163:21
    onclose http://localhost:2345/common/PlutoConnection.js:163
    (Async: EventHandlerNonNull)
    create_ws_connection http://localhost:2345/common/PlutoConnection.js:162
    create_ws_connection http://localhost:2345/common/PlutoConnection.js:103
    connect http://localhost:2345/common/PlutoConnection.js:286
    create_pluto_connection http://localhost:2345/common/PlutoConnection.js:342
    Welcome http://localhost:2345/components/Welcome.js:149
    Preact 7
    <anonymous> http://localhost:2345/index.js:6
connect() failed 
close { target: WebSocket, isTrusted: true, wasClean: true, code: 1006, reason: "", srcElement: WebSocket, currentTarget: WebSocket, eventPhase: 2, bubbles: false, cancelable: false, … }
PlutoConnection.js:337:21
    connect http://localhost:2345/common/PlutoConnection.js:337
    create_pluto_connection http://localhost:2345/common/PlutoConnection.js:342
    Welcome http://localhost:2345/components/Welcome.js:149
    Preact 7
    <anonymous> http://localhost:2345/index.js:6
Pluto.jl, by Fons van der Plas (https://github.com/fonsp) and Mikołaj Bochenski (https://github.com/malyvsen) 🌈 localhost:2345:9:17
Waiting for socket to open... 13:38:54 PlutoConnection.js:185:17
XHRGEThttp://localhost:2345/possible_binder_token_please
[HTTP/1.1 404 Not Found 2ms]

    InnerModuleEvaluation self-hosted:2381
    evaluation self-hosted:2332
Creating websocket timed out 13:39:24 PlutoConnection.js:110:21
connect() failed Socket timeout PlutoConnection.js:337:21
Firefox can’t establish a connection to the server at ws://localhost:2345/?secret=4WPqYXjb. PlutoConnection.js:104:23
The connection to ws://localhost:2345/?secret=4WPqYXjb was interrupted while the page was loading. PlutoConnection.js:104:23
Waiting for socket to open... 13:39:29 PlutoConnection.js:185:17
XHRGEThttp://localhost:2345/possible_binder_token_please
[HTTP/1.1 404 Not Found 2ms]

Source map error: Error: NetworkError when attempting to fetch resource.
Resource URL: moz-extension://86c35ffb-7a67-8747-b571-a1e4c3396b64/src/js/editor-popup.js
Source Map URL: purify.js.map

@fonsp
Copy link
Owner

fonsp commented Jan 19, 2021

Is there any output in the julia console when you do this? When sharing this output, do not open notebooks, use the file picker, etc, but just start Pluto, go to the address in firefox and get the console output.

@danvinci
Copy link
Author

Nope, nothing in the REPL.

The output above is from the Pluto main screen, only tried to use the picker.

@fonsp fonsp changed the title Notebooks not being loaded websocket can't connect -- main menu Jan 25, 2021
@fonsp fonsp added bug Something isn't working HTTP/WS The connection between backend and frontend labels Jan 25, 2021
@pankgeorg
Copy link
Collaborator

Closing due to lack of progress - let's continue in #1168 if we have new data!

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

3 participants