fonsp / Pluto.jl

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

Windows 7: `julia.exe` using 100% of a core when idle #329

Closed Ummon closed 4 years ago

Ummon commented 4 years ago

The following notebook output the correct values but after executing the code the associated notebook process julia.exe takes 100% of a whole core of my CPU.

### A Pluto.jl notebook ###
# v0.11.10

using Markdown
using InteractiveUtils

# ╔═╡ 504cc192-eb75-11ea-2b6e-af5d4f828086
begin
    using PlutoUI, Plots, LinearAlgebra
end

# ╔═╡ 5485d760-eb75-11ea-2e25-7b13d58ce554
let
    a = 0
    n = 20
    f(x, y) = let
        v = complex(x, y)
        c = v
        for i ∈ 1:n
            v = v^2 + c + a * im
            if norm(v) > 2
                return 1-i/n # Normalized.
            end
        end
        0
    end
    x = LinRange(-2, 1, 1000)
    y = LinRange(-1.5, 1.5, 1000)
    plot(x, y, f, st = :surface, label = false, camera = (45, 80), c = :grays)
end

# ╔═╡ Cell order:
# ╠═504cc192-eb75-11ea-2b6e-af5d4f828086
# ╠═5485d760-eb75-11ea-2e25-7b13d58ce554

I'm using the latest version of Julia (1.5) and Pluto (0.11.10)

fonsp commented 4 years ago

On windows? Which browser?

fonsp commented 4 years ago

Were you running VS Code at the same time?

Ummon commented 4 years ago

Windows 7, Firefox 80.0.

And yes, VS Code was running at the same time but I tried without it and the result was the same.

Ummon commented 4 years ago

I tried on my other machine which is on Windows 10 and I can't reproduce the issue (Firefox 80.0 and same version of Julia and Pluto)

fonsp commented 4 years ago

Is the UI still responsive while it is at 100%?

There are two julia.exe processes running: the Pluto server and the notebook process. It would be useful to know which is stalling:

If you shut down the notebook from the main menu, one of the processes will disappear. By remembering their CPU and RAM usages, you should be able to tell which one shut down.

Ummon commented 4 years ago

It was the notebook process and the UI was still responsive.

fonsp commented 4 years ago

What happens when you Ctrl+C in the terminal? Does it shut down Pluto normally or do you get a stacktrace

Ummon commented 4 years ago

Here is the console output. The first errors appeared after the page has been loaded in Firefox.

julia> using Pluto; Pluto.run()
Go to http://localhost:1234/ to start writing ~ have fun!

Press Ctrl+C in this terminal to stop Pluto

┌ Error: (Base.IOError("read: connection reset by peer (ECONNRESET)", -4077), Base.StackTraces.StackFrame[wait_readnb(::Sockets.TCPSocket, ::Int64) at
 stream.jl:350, eof at stream.jl:48 [inlined], read_to_buffer(::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::Int64) at ConnectionPool.jl:253,
 readuntil(::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::Function, ::Int64) at ConnectionPool.jl:273, readuntil at ConnectionPool.jl:271 [in
lined], readheaders at Messages.jl:471 [inlined], startread(::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSoc
ket}}) at Streams.jl:155, handle_transaction(::HTTP.Handlers.var"#4#5"{HTTP.Handlers.StreamHandlerFunction{Pluto.var"#190#196"{Pluto.ServerSession,HTT
P.Handlers.Router{Symbol("##253")}}}}, ::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::HTTP.Servers.Server{Nothing,Sockets.TCPServer}; final_t
ransaction::Bool) at Servers.jl:343, (::HTTP.Servers.var"#handle_transaction##kw")(::NamedTuple{(:final_transaction,),Tuple{Bool}}, ::typeof(HTTP.Serv
ers.handle_transaction), ::Function, ::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::HTTP.Servers.Server{Nothing,Sockets.TCPServer}) at Server
s.jl:338, handle_connection(::Function, ::HTTP.ConnectionPool.Connection{Sockets.TCPSocket}, ::HTTP.Servers.Server{Nothing,Sockets.TCPServer}, ::Int64
, ::Int64) at Servers.jl:299, (::HTTP.Servers.var"#8#9"{HTTP.Handlers.var"#4#5"{HTTP.Handlers.StreamHandlerFunction{Pluto.var"#190#196"{Pluto.ServerSe
ssion,HTTP.Handlers.Router{Symbol("##253")}}}},HTTP.Servers.Server{Nothing,Sockets.TCPServer},Base.RefValue{Int64},Int64,Int64,Bool,HTTP.ConnectionPoo
l.Connection{Sockets.TCPSocket}})() at task.jl:356])
└ @ HTTP.Servers G:\Program Settings\.julia\packages\HTTP\atT5q\src\Servers.jl:264
┌ Error: (Base.IOError("read: connection reset by peer (ECONNRESET)", -4077), Base.StackTraces.StackFrame[wait_readnb(::Sockets.TCPSocket, ::Int64) at
 stream.jl:350, eof at stream.jl:48 [inlined], read_to_buffer(::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::Int64) at ConnectionPool.jl:253,
 readuntil(::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::Function, ::Int64) at ConnectionPool.jl:273, readuntil at ConnectionPool.jl:271 [in
lined], readheaders at Messages.jl:471 [inlined], startread(::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSoc
ket}}) at Streams.jl:155, handle_transaction(::HTTP.Handlers.var"#4#5"{HTTP.Handlers.StreamHandlerFunction{Pluto.var"#190#196"{Pluto.ServerSession,HTT
P.Handlers.Router{Symbol("##253")}}}}, ::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::HTTP.Servers.Server{Nothing,Sockets.TCPServer}; final_t
ransaction::Bool) at Servers.jl:343, (::HTTP.Servers.var"#handle_transaction##kw")(::NamedTuple{(:final_transaction,),Tuple{Bool}}, ::typeof(HTTP.Serv
ers.handle_transaction), ::Function, ::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::HTTP.Servers.Server{Nothing,Sockets.TCPServer}) at Server
s.jl:338, handle_connection(::Function, ::HTTP.ConnectionPool.Connection{Sockets.TCPSocket}, ::HTTP.Servers.Server{Nothing,Sockets.TCPServer}, ::Int64
, ::Int64) at Servers.jl:299, (::HTTP.Servers.var"#8#9"{HTTP.Handlers.var"#4#5"{HTTP.Handlers.StreamHandlerFunction{Pluto.var"#190#196"{Pluto.ServerSe
ssion,HTTP.Handlers.Router{Symbol("##253")}}}},HTTP.Servers.Server{Nothing,Sockets.TCPServer},Base.RefValue{Int64},Int64,Int64,Bool,HTTP.ConnectionPoo
l.Connection{Sockets.TCPSocket}})() at task.jl:356])
└ @ HTTP.Servers G:\Program Settings\.julia\packages\HTTP\atT5q\src\Servers.jl:264

Closing Pluto... Restart Julia for a fresh session.

Have a nice day! �
      From worker 2:    fatal: error thrown and no exception handler available.
      From worker 2:    jl_mutex_unlock at /cygdrive/d/buildbot/worker/package_win64/build/src\locks.h:143 [inlined]
      From worker 2:    jl_task_get_next at /cygdrive/d/buildbot/worker/package_win64/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 /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1690 [inlined]
      From worker 2:    jl_finish_task at /cygdrive/d/buildbot/worker/package_win64/build/src\task.c:198
      From worker 2:    start_task at /cygdrive/d/buildbot/worker/package_win64/build/src\task.c:717
      From worker 2:    InterruptException()

julia>
fonsp commented 4 years ago

Could you write the place where you pressed Ctrl+C inside the output?

Ummon commented 4 years ago

Could you write the place where you pressed Ctrl+C inside the output?

It was before the line Closing Pluto... Restart Julia for a fresh session.

Ummon commented 4 years ago

It seems if I use plotly() instead of the default GR backend for Plots this behavior doesn't appear.

fonsp commented 4 years ago

Can you try Jupyter?

fonsp commented 4 years ago

@Ummon does this only happen in that particular notebook or for all notebooks?

fonsp commented 4 years ago

This is not a problem for Windows 7 in general, and it is impossible for me to debug, so let's close this for now.