JuliaGizmos / Interact.jl

Interactive widgets to play with your Julia code
Other
520 stars 75 forks source link

Interact not working with Mux 1.0.1 #420

Open Para7etamol opened 8 months ago

Para7etamol commented 8 months ago

Hi guys,

I found this simple mwe below is not working when using

Downgrading to Mux v0.7.6 helps (resulting in
↓ HTTP v1.10.1 ⇒ v0.9.17 ↓ WebSockets v1.6.0 ⇒ v1.5.9 )

using Interact
ui = Interact.button()

using Mux
task = WebIO.webio_serve(page("/", req -> ui), 8000)

The ui is displayed in a browser, but

This is the stacktrace when ui is rendered the first time:

 Error handling websocket connection:
TaskFailedException
Stacktrace:
  [1] wait
    @ ./task.jl:352 [inlined]
  [2] create_socket(req::Dict{Any, Any})
    @ WebIO ~/.julia/packages/WebIO/8Xm9p/src/providers/mux.jl:47
  [3] #5
    @ Mux ~/.julia/packages/Mux/PipQ9/src/Mux.jl:17 [inlined]
  [4] (::Mux.var"#1#2"{Mux.var"#5#6"{Mux.var"#29#30"{Vector{SubString{String}}}, typeof(WebIO.create_socket)}, Mux.var"#1#2"{typeof(Mux.wclose), Mux.var"#1#2"{Mux.var"#19#20"{Mux.var"#23#24"{Symbol, Int64}}, Mux.var"#21#22"{String}}}})(x::Dict{Any, Any})
    @ Mux ~/.julia/packages/Mux/PipQ9/src/Mux.jl:10
  [5] splitquery(app::Mux.var"#1#2"{Mux.var"#5#6"{Mux.var"#29#30"{Vector{SubString{String}}}, typeof(WebIO.create_socket)}, Mux.var"#1#2"{typeof(Mux.wclose), Mux.var"#1#2"{Mux.var"#19#20"{Mux.var"#23#24"{Symbol, Int64}}, Mux.var"#21#22"{String}}}}, req::Dict{Any, Any})
    @ Mux ~/.julia/packages/Mux/PipQ9/src/basics.jl:31
  [6] #1
    @ ~/.julia/packages/Mux/PipQ9/src/Mux.jl:10 [inlined]
  [7] wcatch(app::Mux.var"#1#2"{typeof(Mux.splitquery), Mux.var"#1#2"{Mux.var"#5#6"{Mux.var"#29#30"{Vector{SubString{String}}}, typeof(WebIO.create_socket)}, Mux.var"#1#2"{typeof(Mux.wclose), Mux.var"#1#2"{Mux.var"#19#20"{Mux.var"#23#24"{Symbol, Int64}}, Mux.var"#21#22"{String}}}}}, req::Dict{Any, Any})
    @ Mux ~/.julia/packages/Mux/PipQ9/src/websockets_integration.jl:11
  [8] #1
    @ Mux ~/.julia/packages/Mux/PipQ9/src/Mux.jl:10 [inlined]
  [9] todict
    @ Mux ~/.julia/packages/Mux/PipQ9/src/basics.jl:25 [inlined]
 [10] #3 (repeats 2 times)
    @ Mux ~/.julia/packages/Mux/PipQ9/src/Mux.jl:14 [inlined]
 [11] (::Mux.var"#1#2"{Mux.var"#3#4"{Mux.var"#3#4"{typeof(Mux.todict), typeof(Mux.wcatch)}, typeof(Mux.splitquery)}, Mux.var"#1#2"{Mux.var"#5#6"{Mux.var"#29#30"{Vector{SubString{String}}}, typeof(WebIO.create_socket)}, Mux.var"#1#2"{typeof(Mux.wclose), Mux.var"#1#2"{Mux.var"#19#20"{Mux.var"#23#24"{Symbol, Int64}}, Mux.var"#21#22"{String}}}}})(x::HTTP.WebSockets.WebSocket)
    @ Mux ~/.julia/packages/Mux/PipQ9/src/Mux.jl:10
 [12] (::Mux.var"#9#10"{Mux.App})(sock::HTTP.WebSockets.WebSocket)
    @ Mux ~/.julia/packages/Mux/PipQ9/src/server.jl:48
 [13] upgrade(f::Mux.var"#9#10"{Mux.App}, http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.Connections.Connection{Sockets.TCPSocket}}; suppress_close_error::Bool, maxframesize::Int64, maxfragmentation::Int64, kw::@Kwargs{})
    @ HTTP.WebSockets ~/.julia/packages/HTTP/bDoga/src/WebSockets.jl:440
 [14] upgrade
    @ ~/.julia/packages/HTTP/bDoga/src/WebSockets.jl:420 [inlined]
 [15] (::Mux.var"#14#15"{Mux.App, Mux.App})(http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.Connections.Connection{Sockets.TCPSocket}})
    @ Mux ~/.julia/packages/Mux/PipQ9/src/server.jl:81
 [16] #invokelatest#2
    @ ./essentials.jl:887 [inlined]
 [17] invokelatest
    @ ./essentials.jl:884 [inlined]
 [18] handle_connection(f::Function, c::HTTP.Connections.Connection{Sockets.TCPSocket}, listener::HTTP.Servers.Listener{Nothing, Sockets.TCPServer}, readtimeout::Int64, access_log::Nothing)
    @ HTTP.Servers ~/.julia/packages/HTTP/bDoga/src/Servers.jl:450
 [19] (::HTTP.Servers.var"#16#17"{Mux.var"#14#15"{Mux.App, Mux.App}, HTTP.Servers.Listener{Nothing, Sockets.TCPServer}, Set{HTTP.Connections.Connection}, Int64, Nothing, Base.Semaphore, HTTP.Connections.Connection{Sockets.TCPSocket}})()
    @ HTTP.Servers ~/.julia/packages/HTTP/bDoga/src/Servers.jl:386

    nested task error: MethodError: no method matching isopen(::HTTP.WebSockets.WebSocket)

    Closest candidates are:
      isopen(::FileWatching.FolderMonitor)
       @ FileWatching /opt/julia/julia-1.10.0/share/julia/stdlib/v1.10/FileWatching/src/FileWatching.jl:380
      isopen(::FileWatching.PollingFileWatcher)
       @ FileWatching /opt/julia/julia-1.10.0/share/julia/stdlib/v1.10/FileWatching/src/FileWatching.jl:381
      isopen(::FileWatching.FDWatcher)
       @ FileWatching /opt/julia/julia-1.10.0/share/julia/stdlib/v1.10/FileWatching/src/FileWatching.jl:383
      ...

    Stacktrace:
     [1] (::WebIO.var"#98#99"{WebIO.WebSockConnection, HTTP.WebSockets.WebSocket})()
       @ WebIO ~/.julia/packages/WebIO/8Xm9p/src/providers/mux.jl:40
status --manifest
Status `Manifest.toml`
  [bf4720bc] AssetRegistry v0.1.0
  [d1d4a3ce] BitFlags v0.1.8
  [70588ee8] CSSUtil v0.1.1
  [944b1d66] CodecZlib v0.7.3
  [3da002f7] ColorTypes v0.11.4
  [5ae59095] Colors v0.12.10
  [f0e56b4a] ConcurrentUtilities v2.3.0
  [460bff9d] ExceptionUnwrapping v0.1.10
  [53c48c17] FixedPointNumbers v0.8.4
  [de31a74c] FunctionalCollections v0.5.0
  [cd3eb016] HTTP v1.10.1
  [9fb69e20] Hiccup v0.2.2
  [c601a237] Interact v0.10.5
  [d3863d7c] InteractBase v0.10.10
  [692b3bcd] JLLWrappers v1.5.0
  [97c1335a] JSExpr v0.5.4
  [682c06a0] JSON v0.21.4
  [bcebb21b] Knockout v0.2.6
  [e6f89c97] LoggingExtras v1.0.3
  [1914dd2f] MacroTools v0.5.13
  [739be429] MbedTLS v1.1.9
  [442fdcdd] Measures v0.3.2
  [a975b10e] Mux v1.0.1
  [510215fc] Observables v0.5.5
  [4d8831e6] OpenSSL v1.4.1
  [bac558e1] OrderedCollections v1.6.3
  [69de0a69] Parsers v2.8.1
  [fa939f87] Pidfile v1.3.0
  [aea7be01] PrecompileTools v1.2.0
  [21216c6a] Preferences v1.4.1
  [189a3867] Reexport v1.2.2
  [ae029012] Requires v1.3.0
  [777ac1f9] SimpleBufferStream v1.1.0
  [3bb67fe8] TranscodingStreams v0.10.2
  [5c2747f8] URIs v1.5.1
  [0f1e0344] WebIO v0.8.21
  [104b5d7c] WebSockets v1.6.0
  [cc8bc4a8] Widgets v0.6.6
  [458c3c95] OpenSSL_jll v3.0.12+0
  [0dad84c5] ArgTools v1.1.1
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8ba89e20] Distributed
  [f43a241f] Downloads v1.6.0
  [7b1f6079] FileWatching
  [b77e0a4c] InteractiveUtils
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [ca575930] NetworkOptions v1.2.0
  [44cfe95a] Pkg v1.10.0
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization
  [6462fe0b] Sockets
  [2f01184e] SparseArrays v1.10.0
  [10745b16] Statistics v1.10.0
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll v1.0.5+1
  [deac9b47] LibCURL_jll v8.4.0+0
  [e37daf67] LibGit2_jll v1.6.4+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.2+1
  [14a3606d] MozillaCACerts_jll v2023.1.10
  [4536629a] OpenBLAS_jll v0.3.23+2
  [bea87d4a] SuiteSparse_jll v7.2.1+1
  [83775a58] Zlib_jll v1.2.13+1
  [8e850b90] libblastrampoline_jll v5.8.0+1
  [8e850ede] nghttp2_jll v1.52.0+1
  [3f19e933] p7zip_jll v17.4.0+2

Could you be so kind to make interact work with mux 1.0.1?

Kind regards Para7etamol