fonsp / Pluto.jl

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

pluto takes forever to run notebook.... #1657

Open rczerminski-valo opened 3 years ago

rczerminski-valo commented 3 years ago

Pluto notebook keeps running for a very long time (1h+) and apparently is stuck in some kind of loop...

Pluto: v0.17.1
julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

I do not know if this helps to diagnose the problem, but below is what I see when I kill it with Ctrl-C in julia REPL When I start it again (using Pluto; Pluto.run()) it executes the same notebook reasonably fast.

ERROR: TaskFailedException:
InterruptException:
poptask(::Base.InvasiveLinkedListSynchronized{Task}) at ./task.jl:704
wait at ./task.jl:712 [inlined]
wait(::Base.GenericCondition{Base.Threads.SpinLock}) at ./condition.jl:106
_trywait(::Timer) at ./asyncevent.jl:110
wait at ./asyncevent.jl:128 [inlined]
sleep at ./asyncevent.jl:213 [inlined]
_rmprocs(::Array{Int64,1}, ::Int64) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/cluster.jl:1044
rmprocs(::Int64; waitfor::Int64) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/cluster.jl:1018
rmprocs(::Int64) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/cluster.jl:1010
top-level scope at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/evaluation/WorkspaceManager.jl:191
eval at ./boot.jl:331 [inlined]
#137 at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:354 [inlined]
run_work_thunk(::Distributed.var"#137#138"{typeof(Core.eval),Tuple{Module,Expr},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}}, ::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/process_messages.jl:79
#remotecall_fetch#142 at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:379 [inlined]
remotecall_fetch at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:379 [inlined]
#remotecall_fetch#146 at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:421 [inlined]
remotecall_fetch at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:421 [inlined]
remotecall_eval at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/macros.jl:241 [inlined]
macro expansion at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/evaluation/WorkspaceManager.jl:190 [inlined]
(::Pluto.WorkspaceManager.var"#14#16"{Pluto.WorkspaceManager.Workspace})() at ./task.jl:356
Stacktrace:
 [1] #remotecall_fetch#142 at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:380 [inlined]
 [2] remotecall_fetch at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:379 [inlined]
 [3] #remotecall_fetch#146 at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:421 [inlined]
 [4] remotecall_fetch at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:421 [inlined]
 [5] remotecall_eval at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Distributed/src/macros.jl:241 [inlined]
 [6] macro expansion at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/evaluation/WorkspaceManager.jl:190 [inlined]
 [7] (::Pluto.WorkspaceManager.var"#14#16"{Pluto.WorkspaceManager.Workspace})() at ./task.jl:356
Stacktrace:
 [1] wait at ./task.jl:267 [inlined]
 [2] unmake_workspace(::Pluto.WorkspaceManager.Workspace; async::Bool) at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/evaluation/WorkspaceManager.jl:194
 [3] unmake_workspace at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/evaluation/WorkspaceManager.jl:181 [inlined]
 [4] (::Pluto.var"#324#334"{Pluto.Promise{Pluto.WorkspaceManager.Workspace}})() at ./task.jl:356
Stacktrace:
 [1] sync_end(::Channel{Any}) at ./task.jl:314
 [2] macro expansion at ./task.jl:333 [inlined]
 [3] (::Pluto.var"#319#329"{Pluto.ServerSession})() at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/webserver/WebServer.jl:259
 [4] run(::Pluto.ServerSession) at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/webserver/WebServer.jl:278
 [5] run(::Pluto.Configuration.Options) at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/webserver/WebServer.jl:77
 [6] run(; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/webserver/WebServer.jl:72
 [7] run() at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/webserver/WebServer.jl:71
 [8] top-level scope at REPL[10]:1
caused by [exception 1]
InterruptException:
Stacktrace:
 [1] try_yieldto(::typeof(Base.ensure_rescheduled)) at ./task.jl:656
 [2] wait at ./task.jl:713 [inlined]
 [3] wait(::Base.GenericCondition{Base.Threads.SpinLock}) at ./condition.jl:106
 [4] _wait(::Task) at ./task.jl:238
 [5] wait at ./task.jl:265 [inlined]
 [6] run(::Pluto.ServerSession) at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/webserver/WebServer.jl:275
 [7] run(::Pluto.Configuration.Options) at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/webserver/WebServer.jl:77
 [8] run(; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/webserver/WebServer.jl:72
 [9] run() at /Users/ryszard/.julia/packages/Pluto/OxjgN/src/webserver/WebServer.jl:71
 [10] top-level scope at REPL[10]:1

julia> 
roland-KA commented 3 years ago

I experienced the same problem (Pluto 0.17.1, Julia 1.6.1, macOS Monterey) when using MLJ in a Pluto notebook during the execution of evaluate!. Sometimes the execution seems to be caught in an endless loop and when I restart the notebook the function is executed within a reasonable time span.

fonsp commented 3 years ago

Can you send a notebook file?

roland-KA commented 3 years ago

Hi @fonsp here is the notebook that causes the problem. Unfortunately it's quite large. It is a Pluto version of this MLJ tutorial (I've converted it to Pluto recently): MLJ-Tutorial-Part 3-4.jl.zip

The problem occurs in 'Exercise 8'. The notebook gets from time to time stuck at the following points:

'Exercise 8' is a relatively isolated part of the notebook. It depends only on the data which is loaded in section 'Prepare House data'. But I'm sending you the complete notebook because there are other strange things happen with this code when using Pluto:

The @pipeline macros in this notebook don't work any more, when they are isolated in a smaller notebook (see: Pluto.jl #1658). They work only in this Pluto notebook (and outside of Pluto, e.g. using the REPL). I have no idea, if these problems are related, just in case ...

Both evaluate! commands mentioned above have strongly varying execution times, even if they terminate. On an iMac (M1 processor) I've experienced the following values:

Interestingly the latter command completes in about 20 minutes on a much slower Windows machine (Julia 1.6.0, Pluto 0.17.1, MLJ 0.16.5, Windows 10, Intel i5, 8GB).

fonsp commented 3 years ago

@rczerminski-valo Perhaps you have a smaller example notebook for us to work with?

rczerminski-valo commented 3 years ago

@fonsp My notebook is quite large as well (~600 lines of notebook + ~900 of a local pkg) I will try to trim it down for something smaller with the problem still reproducible.

roland-KA commented 3 years ago

Here is a stripped down version of my notebook which contains only the above mentioned 'Exercise 8': MLJ-Tutorial-Exercise8.jl.zip

dandanua commented 3 years ago

I'm not sure if this is the same problem, but my notebook also hangs where it should be instant. The execution of the second cell takes forever (though, it produces the correct output after manual cell stop).

Singular.jl was installed before. I also tried to reinstall Singular from Pluto, but the same problem remains.

### A Pluto.jl notebook ###
# v0.17.1

using Markdown
using InteractiveUtils

# ╔═╡ 6cfc7d20-46b0-11ec-33c3-15107f33e361
using Singular

# ╔═╡ c09c9041-557b-4517-b108-28781d14dfe0
R, (t) = PolynomialRing(QQ, ["t"])

# ╔═╡ 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
[deps]
Singular = "bcd08a7b-43d2-5ff7-b6d4-c458787f915c"

[compat]
Singular = "~0.7.0"
"""

# ╔═╡ 00000000-0000-0000-0000-000000000002
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised

[[AbstractAlgebra]]
deps = ["GroupsCore", "InteractiveUtils", "LinearAlgebra", "Markdown", "Random", "RandomExtensions", "SparseArrays", "Test"]
git-tree-sha1 = "94babc7413ae4247d53f8aa3786720157c9b26c3"
uuid = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
version = "0.22.2"

[[Antic_jll]]
deps = ["Artifacts", "FLINT_jll", "GMP_jll", "JLLWrappers", "Libdl", "MPFR_jll", "Pkg"]
git-tree-sha1 = "0b859770975d52aaf54309e75232acd43265535f"
uuid = "e21ec000-9f72-519e-ba6d-10061e575a27"
version = "0.200.500+0"

[[Arb_jll]]
deps = ["Artifacts", "FLINT_jll", "GMP_jll", "JLLWrappers", "Libdl", "MPFR_jll", "Pkg"]
git-tree-sha1 = "9b6e16d49e968d7bf1f9c42cdbde4a99bae5025a"
uuid = "d9960996-1013-53c9-9ba4-74a4155039c3"
version = "200.2000.0+0"

[[Artifacts]]
deps = ["Pkg"]
git-tree-sha1 = "c30985d8821e0cd73870b17b0ed0ce6dc44cb744"
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
version = "1.3.0"

[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[BinaryProvider]]
deps = ["Libdl", "Logging", "SHA"]
git-tree-sha1 = "ecdec412a9abc8db54c0efc5548c64dfce072058"
uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
version = "0.5.10"

[[Calcium_jll]]
deps = ["Antic_jll", "Arb_jll", "Artifacts", "FLINT_jll", "GMP_jll", "JLLWrappers", "Libdl", "MPFR_jll", "Pkg"]
git-tree-sha1 = "d0c304bc221b916bc54716367402a0cc66d13e14"
uuid = "fcfa6d1b-d8ce-59d5-8c0a-c0d7f69e4f40"
version = "0.400.100+0"

[[CxxWrap]]
deps = ["Libdl", "MacroTools", "libcxxwrap_julia_jll"]
git-tree-sha1 = "95196cd23b6135d92079a6de33e1d522cc4cd2a4"
uuid = "1f15a43c-97ca-5a2a-ae31-89f07a497df4"
version = "0.11.2"

[[Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[FLINT_jll]]
deps = ["Artifacts", "GMP_jll", "JLLWrappers", "Libdl", "MPFR_jll", "Pkg"]
git-tree-sha1 = "4102dae42e88c42210f0d606b53b189fd5eef663"
uuid = "e134572f-a0d5-539d-bddf-3cad8db41a82"
version = "200.800.300+0"

[[GLPK_jll]]
deps = ["Artifacts", "GMP_jll", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "01de09b070d4b8e3e1250c6542e16ed5cad45321"
uuid = "e8aa6df9-e6ca-548a-97ff-1f85fc5b8b98"
version = "5.0.0+0"

[[GMP_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "15abc5f976569a1c9d651aff02f7222ef305eb2a"
uuid = "781609d7-10c4-51f6-84f2-b8444358ff6d"
version = "6.1.2+6"

[[GroupsCore]]
deps = ["Markdown", "Random"]
git-tree-sha1 = "9e1a5e9f3b81ad6a5c613d181664a0efc6fe6dd7"
uuid = "d5909c97-4eac-4ecc-a3dc-fdd0858a4120"
version = "0.4.0"

[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[JLLWrappers]]
deps = ["Preferences"]
git-tree-sha1 = "642a199af8b68253517b80bd3bfd17eb4e84df6e"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
version = "1.3.0"

[[LibGit2]]
deps = ["Printf"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"

[[Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

[[LinearAlgebra]]
deps = ["Libdl"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[[LoadFlint]]
deps = ["BinaryProvider", "FLINT_jll", "GMP_jll", "Libdl", "MPFR_jll", "Pkg"]
git-tree-sha1 = "796efcca2ac22a0719ec1bd641ac47a82d36ed0e"
uuid = "472f376f-f1cf-461b-9ac1-d103423be9b7"
version = "0.6.3"

[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[MPFR_jll]]
deps = ["GMP_jll", "Libdl", "Pkg"]
git-tree-sha1 = "301ce96952df90bbaa2c66112b7c1f15ced2b55b"
uuid = "3a97d323-0669-5f0c-9066-3539efd106a3"
version = "4.1.0+1"

[[MacroTools]]
deps = ["Markdown", "Random"]
git-tree-sha1 = "3d3e902b31198a27340d0bf00d6ac452866021cf"
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
version = "0.5.9"

[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[Nemo]]
deps = ["AbstractAlgebra", "Antic_jll", "Arb_jll", "BinaryProvider", "Calcium_jll", "FLINT_jll", "InteractiveUtils", "Libdl", "LinearAlgebra", "LoadFlint", "Markdown", "Pkg", "Random", "RandomExtensions", "SHA", "Test"]
git-tree-sha1 = "941f321cb39ef6e55ccbe5195b11bf0f1f4ee62a"
uuid = "2edaba10-b0f1-5616-af89-8c11ac63239a"
version = "0.27.2"

[[Pkg]]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[[Preferences]]
deps = ["TOML"]
git-tree-sha1 = "00cfd92944ca9c760982747e9a1d0d5d86ab1e5a"
uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.2.2"

[[Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[[REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"

[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[RandomExtensions]]
deps = ["Random", "SparseArrays"]
git-tree-sha1 = "062986376ce6d394b23d5d90f01d81426113a3c9"
uuid = "fb686558-2515-59ef-acaa-46db3789a887"
version = "0.4.3"

[[SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[Singular]]
deps = ["AbstractAlgebra", "CxxWrap", "LinearAlgebra", "Markdown", "Nemo", "Pkg", "Random", "RandomExtensions", "Singular_jll", "Statistics", "lib4ti2_jll", "libsingular_julia_jll"]
git-tree-sha1 = "4bfbb43d3118b298c5f9e193d2763a7eef8e025d"
uuid = "bcd08a7b-43d2-5ff7-b6d4-c458787f915c"
version = "0.7.0"

[[Singular_jll]]
deps = ["Artifacts", "FLINT_jll", "GMP_jll", "JLLWrappers", "Libdl", "MPFR_jll", "Pkg", "cddlib_jll"]
git-tree-sha1 = "415656ab3ade255547d49109cd10ab1039656aef"
uuid = "43d676ae-4934-50ba-8046-7a96366d613b"
version = "402.100.101+0"

[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[SparseArrays]]
deps = ["LinearAlgebra", "Random"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[[Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[[TOML]]
deps = ["Dates"]
git-tree-sha1 = "44aaac2d2aec4a850302f9aa69127c74f0c3787e"
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
version = "1.0.3"

[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[[Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[[cddlib_jll]]
deps = ["Artifacts", "GMP_jll", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "61b6618e9ab74115e13168b85b8e73cbfee6a078"
uuid = "f07e07eb-5685-515a-97c8-3014f6152feb"
version = "0.94.10+1"

[[lib4ti2_jll]]
deps = ["Artifacts", "GLPK_jll", "GMP_jll", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "b4c0837bdc2663b11a6cd1a542bc67bb50a56ae3"
uuid = "1493ae25-0f90-5c0e-a06c-8c5077d6d66f"
version = "1.6.9+2"

[[libcxxwrap_julia_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "48b83f1eb1349f7389dd5bbe4f90eb8534ed5336"
uuid = "3eaa8342-bff7-56a5-9981-c04077f7cee7"
version = "0.8.5+1"

[[libsingular_julia_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Singular_jll", "libcxxwrap_julia_jll"]
git-tree-sha1 = "4dd232c28361e78371759cb2ba5048166860219d"
uuid = "ae4fbd8f-ecdb-54f8-bbce-35570499b30e"
version = "0.18.5+1"
"""

# ╔═╡ Cell order:
# ╠═6cfc7d20-46b0-11ec-33c3-15107f33e361
# ╠═c09c9041-557b-4517-b108-28781d14dfe0
# ╟─00000000-0000-0000-0000-000000000001
# ╟─00000000-0000-0000-0000-000000000002

System info

Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.5.0)
  CPU: Intel(R) Core(TM) i7-4960HQ CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, haswell)