Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"using PlotlyJS" in atreplinit() runs atreplinit() twice #450

Open
takbal opened this issue Oct 22, 2022 · 0 comments
Open

"using PlotlyJS" in atreplinit() runs atreplinit() twice #450

takbal opened this issue Oct 22, 2022 · 0 comments

Comments

@takbal
Copy link

takbal commented Oct 22, 2022

It is a common practice to add "using" directives to the atreplinit() function in startup.jl. However, adding "using PlotlyJS" to this function seems to silently run atreplinit() twice, which is potentially dangerous behaviour.

The initialization seems to belong to the same REPL object, and is likely linked to adding a display when the package is read.

Example startup.jl:

println("startup.jl start")

atreplinit() do repl

    println("atreplinit() start")

    print("repl object: ");
    display(repr(UInt64(pointer_from_objref(repl))))

    print("length of Base.Multimedia.displays: ")
    display(length(Base.Multimedia.displays))

    display(stacktrace())

    println("*** using PlotlyJS ***")
    eval( Meta.parse( "using PlotlyJS" ) )
    println("atreplinit() end")
end
println("startup.jl end")

output:

startup.jl start
startup.jl end
atreplinit() start
repl object: "0x00007f086aaa8f10"
length of Base.Multimedia.displays: 2
11-element Vector{Base.StackTraces.StackFrame}:
 (::var"#1#2")(repl::REPL.LineEditREPL) at startup.jl:13
 __atreplinit(repl::REPL.LineEditREPL) at client.jl:336
 #invokelatest#2 at essentials.jl:708 [inlined]
 invokelatest at essentials.jl:706 [inlined]
 _atreplinit at client.jl:343 [inlined]
 (::Base.var"#875#877"{Bool, Bool, Bool})(REPL::Module) at client.jl:386
 #invokelatest#2 at essentials.jl:708 [inlined]
 invokelatest at essentials.jl:706 [inlined]
 run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool) at client.jl:372
 exec_options(opts::Base.JLOptions) at client.jl:302
 _start() at client.jl:485
*** using PlotlyJS ***
atreplinit() end
atreplinit() start
repl object: "0x00007f086aaa8f10"
length of Base.Multimedia.displays: 3
11-element Vector{Base.StackTraces.StackFrame}:
 (::var"#1#2")(repl::REPL.LineEditREPL) at startup.jl:13
 __atreplinit(repl::REPL.LineEditREPL) at client.jl:336
 #invokelatest#2 at essentials.jl:708 [inlined]
 invokelatest at essentials.jl:706 [inlined]
 _atreplinit at client.jl:343 [inlined]
 (::Base.var"#875#877"{Bool, Bool, Bool})(REPL::Module) at client.jl:386
 #invokelatest#2 at essentials.jl:708 [inlined]
 invokelatest at essentials.jl:706 [inlined]
 run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool) at client.jl:372
 exec_options(opts::Base.JLOptions) at client.jl:302
 _start() at client.jl:485
*** using PlotlyJS ***
atreplinit() end

Can be reproduced in Julia 1.6.4, 1.8.2 and PlotlyJS v0.18.10.

Julia Version 1.6.4
Commit 35f0c911f4 (2021-11-19 03:54 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: AMD Ryzen 7 1700 Eight-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, znver1)

Status ~/.julia/environments/v1.6/Project.toml
[f0f68f2c] PlotlyJS v0.18.10
[0f1e0344] WebIO v0.8.93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant