JuliaGizmos / Blink.jl

Web-based GUIs for Julia
Other
355 stars 74 forks source link

Conflicts with the package RCall #250

Open WeiMXi opened 4 years ago

WeiMXi commented 4 years ago

My system is Centos 7.
Only using Blink, the function Window() work fine, but when using RCall, Windows() will always running without return. And RCall seem work fine. I don't know where should I post the Issues to, but I post this at here first.

julia> versioninfo()
Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Genuine Intel(R) CPU 0000 @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

julia> using Blink

julia> w1 = Window() # work fine
Window(1, Electron(Process(`/root/.julia/packages/Blink/HhoiS/deps/atom/electron /root/.julia/packages/Blink/HhoiS/src/AtomShell/main.js port 2834`, ProcessRunning), Sockets.TCPSocket(RawFD(0x00000014) active, 0 bytes waiting), Dict{String,Any}("callback" => Blink.var"#1#2"())), Page(1, WebSocket(server, CONNECTED), Dict{String,Any}("webio" => Blink.AtomShell.var"#22#23"{Blink.AtomShell.WebIOBlinkComm}(Blink.AtomShell.WebIOBlinkComm(Window(#= circular reference @-5 =#))),"callback" => Blink.var"#1#2"()), Distributed.Future(1, 1, 1, Some(true))), Task (done) @0x00007f4268adf0d0)

julia> using RCall

julia> w2 = Window() # always run without return
WeiMXi commented 4 years ago

Oh, now I know Window() will running much longer when using RCall, i run those in my win10.

julia> versioninfo()
Julia Version 1.4.0-rc2.0
Commit b99ed72c95 (2020-02-24 16:51 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Genuine Intel(R) CPU 0000 @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, skylake)

julia> using Blink

julia> @time w1 = Window()
  8.658116 seconds (21.41 M allocations: 1.029 GiB, 4.39% gc time)
Window(1, Electron(Process(`'C:\Users\WeiM\.julia\packages\Blink\HhoiS\deps\atom\electron.exe' 'C:\Users\WeiM\.julia\packages\Blink\HhoiS\src\AtomShell\main.js' port 5638`, ProcessRunning), Sockets.TCPSocket(Base.Libc.WindowsRawSocket(0x00000000000003e8) active, 0 bytes waiting), Dict{String,Any}("callback" => Blink.var"#1#2"())), Page(1, WebSocket(server, CONNECTED), Dict{String,Any}("webio" => Blink.AtomShell.var"#22#23"{Blink.AtomShell.WebIOBlinkComm}(Blink.AtomShell.WebIOBlinkComm(Window(#= circular reference @-5 =#))),"callback" => Blink.var"#1#2"()), Distributed.Future(1, 1, 1, Some(true))), Task (done) @0x000000002f9bab30)

julia> using RCall;

R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

julia> @time w2 = Window()
310.513897 seconds (417.10 M allocations: 27.021 GiB, 3.07% gc time)
Window(2, Electron(Process(`'C:\Users\WeiM\.julia\packages\Blink\HhoiS\deps\atom\electron.exe' 'C:\Users\WeiM\.julia\packages\Blink\HhoiS\src\AtomShell\main.js' port 5638`, ProcessRunning), Sockets.TCPSocket(Base.Libc.WindowsRawSocket(0x00000000000003e8) active, 0 bytes waiting), Dict{String,Any}("callback" => Blink.var"#1#2"())), Page(2, WebSocket(server, CONNECTED), Dict{String,Any}("webio" => Blink.AtomShell.var"#22#23"{Blink.AtomShell.WebIOBlinkComm}(Blink.AtomShell.WebIOBlinkComm(Window(#= circular reference @-5 =#))),"callback" => Blink.var"#1#2"()), Distributed.Future(1, 1, 2, Some(true))), Task (done) @0x00000000499eb6b0)
JxMills commented 4 years ago

Confirming this on Windows 10, Julia 1.4.1. The electron window eventually loads after an extremely long period (20+ minutes), under heavy CPU activity.

DataFrames is having this same issue.

using Blink
using DataFrames
@time w = Window()

1358.921258 seconds (1.57 G allocations: 101.991 GiB, 3.13% gc time)

If Window() is called directly after 'using Blink', everything is fine. (as long as you clear / restart Julia before calling Window() again.

As a work around:

using Blink
@time w = Window() # Call Window before loading data packages

using DataFrames
using RCall
using FileIO, Base64, Serialization

... rest of code
versioninfo():
Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, sandybridge)
Environment:
  JULIA_NUM_THREADS = 6