fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
4.94k stars 285 forks source link

websocket can't connect -- main menu #848

Closed danvinci closed 3 years ago

danvinci commented 3 years ago

Hi!

First of all, thanks for creating Pluto!

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

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 commented 3 years ago

Which browser?

danvinci commented 3 years ago

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:

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 commented 3 years ago

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:

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 commented 3 years ago

Can you follow these steps (you have done some already): https://github.com/fonsp/Pluto.jl/issues/553#issuecomment-706132347

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:

danvinci commented 3 years ago

Ok!

So:

When switching to another browser, same port:

Screenshot 2021-01-17 at 7 08 07 PM

When using another port:

Hope it helps!

(using Chrome on another port is working so far)

fonsp commented 3 years ago

Thanks! The most important thing is that you share the output of the browser's development console: https://github.com/fonsp/Pluto.jl/issues/553#issuecomment-706132347

danvinci commented 3 years ago

Attaching the FF console export!

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

fonsp commented 3 years ago

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 commented 3 years ago

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

danvinci commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

Nope, nothing in the REPL.

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

pankgeorg commented 3 years ago

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