Stream: helpdesk (published)

Topic: JET fails to catch error - intermittently


view this post on Zulip Jesper Stemann Andersen (May 05 2022 at 12:07):

Any idea why once(!) yesterday JET.jl (v0.5.14) managed to catch this error: https://github.com/IHPSystems/NonBlockingChannels.jl/blob/master/src/leakingchannel.jl#L43 - and then subsequently failed.

$ docker run -it --rm -v `pwd`:/project julia:1.7 bash
Unable to find image 'julia:1.7' locally
1.7: Pulling from library/julia
1fe172e4850f: Pull complete
0d0100a9853f: Pull complete
b0da1dd0a48f: Pull complete
Digest: sha256:f69c5ccac101532e873a1166dff43906d12a1790ef9c687f6a4964624d6b058d
Status: Downloaded newer image for julia:1.7
root@70ecb8ce870b:/# cd /project/

root@70ecb8ce870b:/project# julia --project
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.2 (2022-02-06)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Pkg

julia> Pkg.project().name
"NonBlockingChannels"

julia> using JET
 │ Package JET not found, but a package named JET is available from a registry.
 │ Install package?
 │   (NonBlockingChannels) pkg> add JET
 └ (y/n) [y]: y
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
   Installed CodeTracking ───── v1.0.9
   Installed MacroTools ─────── v0.5.9
   Installed JuliaInterpreter ─ v0.9.13
   Installed LoweredCodeUtils ─ v2.2.2
   Installed Requires ───────── v1.3.0
   Installed JET ────────────── v0.5.14
   Installed Revise ─────────── v3.3.3
┌ Warning: The active manifest file at `/project/Manifest.toml` has an old format that is being maintained.
│ To update to the new format run `Pkg.upgrade_manifest()` which will upgrade the format without re-resolving.
└ @ Pkg.Types /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/Pkg/src/manifest.jl:287
    Updating `/project/Project.toml`
  [c3a54625] + JET v0.5.14
    Updating `/project/Manifest.toml`
  [da1fd8a2] + CodeTracking v1.0.9
  [c3a54625] + JET v0.5.14
  [aa1ae85d] + JuliaInterpreter v0.9.13
  [6f1432cf] + LoweredCodeUtils v2.2.2
  [1914dd2f] + MacroTools v0.5.9
  [bac558e1] + OrderedCollections v1.4.1
  [ae029012] + Requires v1.3.0
  [295af30f] + Revise v3.3.3
  [0dad84c5] + ArgTools
  [56f22d72] + Artifacts
  [ade2ca70] + Dates
  [f43a241f] + Downloads
  [7b1f6079] + FileWatching
  [b27032c2] + LibCURL
  [76f85450] + LibGit2
  [37e2e46d] - LinearAlgebra
  [ca575930] + NetworkOptions
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [ea8e919c] + SHA
  [fa267f1f] + TOML
  [a4e569a6] + Tar
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [deac9b47] + LibCURL_jll
  [29816b5a] + LibSSH2_jll
  [c8ffd9c3] + MbedTLS_jll
  [14a3606d] + MozillaCACerts_jll
  [83775a58] + Zlib_jll
  [8e850ede] + nghttp2_jll
  [3f19e933] + p7zip_jll
┌ Warning: The active manifest file is an older format with no julia version entry. Dependencies may have been resolved with a different julia version.
└ @ /project/Manifest.toml:0
Precompiling project...
  8 dependencies successfully precompiled in 16 seconds (4 already precompiled)

julia> pwd()
"/project"

julia> report_package(Pkg.project().name; analyze_from_definitions = true)
[toplevel-info] virtualized the context of Main (took 0.03 sec)
[toplevel-info] entered into /project/src/NonBlockingChannels.jl
[toplevel-info] entered into /project/src/leakingchannel.jl
[toplevel-info]  exited from /project/src/leakingchannel.jl (took 0.331 sec)
[toplevel-info]  exited from /project/src/NonBlockingChannels.jl (took 3.498 sec)
[toplevel-info] analyzing from top-level definitions ... 14/14
═════ 1 possible error found ═════
┌ @ /project/src/leakingchannel.jl:44 result = NonBlockingChannels.popfirst(Base.getproperty(c, :channel))
│ variable NonBlockingChannels.popfirst is not defined: result = NonBlockingChannels.popfirst(Base.getproperty(c::NonBlockingChannels.LeakingChannel, :channel::Symbol)::AbstractChannel{Any})
└─────────────────────────────────────


julia>

I have not been able to catch it with JET.jl since:

$ docker run -it --rm -v `pwd`:/project julia:1.7 bash
root@6f54b6630403:/# julia --eval 'using Pkg; Pkg.activate(); Pkg.add("JET"); Pkg.activate("."); using JET; @info "Analyzing package $(Pkg.project().name)"; report_package(Pkg.project().name)'
  Activating project at `~/.julia/environments/v1.7`
  Installing known registries into `~/.julia`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
   Installed Requires ─────────── v1.3.0
   Installed CodeTracking ─────── v1.0.9
   Installed LoweredCodeUtils ─── v2.2.2
   Installed OrderedCollections  v1.4.1
   Installed MacroTools ───────── v0.5.9
   Installed JuliaInterpreter ─── v0.9.13
   Installed Revise ───────────── v3.3.3
   Installed JET ──────────────── v0.5.14
    Updating `~/.julia/environments/v1.7/Project.toml`
  [c3a54625] + JET v0.5.14
    Updating `~/.julia/environments/v1.7/Manifest.toml`
  [da1fd8a2] + CodeTracking v1.0.9
  [c3a54625] + JET v0.5.14
  [aa1ae85d] + JuliaInterpreter v0.9.13
  [6f1432cf] + LoweredCodeUtils v2.2.2
  [1914dd2f] + MacroTools v0.5.9
  [bac558e1] + OrderedCollections v1.4.1
  [ae029012] + Requires v1.3.0
  [295af30f] + Revise v3.3.3
  [0dad84c5] + ArgTools
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [8ba89e20] + Distributed
  [f43a241f] + Downloads
  [7b1f6079] + FileWatching
  [b77e0a4c] + InteractiveUtils
  [b27032c2] + LibCURL
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [ca575930] + NetworkOptions
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [6462fe0b] + Sockets
  [fa267f1f] + TOML
  [a4e569a6] + Tar
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [deac9b47] + LibCURL_jll
  [29816b5a] + LibSSH2_jll
  [c8ffd9c3] + MbedTLS_jll
  [14a3606d] + MozillaCACerts_jll
  [83775a58] + Zlib_jll
  [8e850ede] + nghttp2_jll
  [3f19e933] + p7zip_jll

...

root@6f54b6630403:/project# julia --project --eval 'using Pkg; Pkg.activate(); Pkg.add("JET"); Pkg.activate("."); using JET; @info "Analyzing package $(Pkg.project().name)"; report_package(Pkg.project().name)'
  Activating project at `~/.julia/environments/v1.7`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.7/Project.toml`
  No Changes to `~/.julia/environments/v1.7/Manifest.toml`
  Activating project at `/project`
[ Info: Analyzing package NonBlockingChannels
[toplevel-info] virtualized the context of Main (took 0.028 sec)
[toplevel-info] entered into /project/src/NonBlockingChannels.jl
[toplevel-info] entered into /project/src/leakingchannel.jl
[toplevel-info]  exited from /project/src/leakingchannel.jl (took 0.292 sec)
[toplevel-info]  exited from /project/src/NonBlockingChannels.jl (took 3.453 sec)
[toplevel-info] analyzing from top-level definitions ... 14/14
root@6f54b6630403:/project#

view this post on Zulip Jesper Stemann Andersen (May 06 2022 at 07:16):

I managed to isolate the problem: JET.jl finds the bug when run from the REPL with julia --project, but not when run from the command line with julia --project --eval:

Running in clone of https://github.com/IHPSystems/NonBlockingChannels.jl :

jsa-mac:NonBlockingChannels jsa$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
jsa-mac:NonBlockingChannels jsa$ docker run -it --rm -v `pwd`:/project --workdir=/project julia:1.7 bash
root@b0a5da3e7b70:/project# julia --project
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.2 (2022-02-06)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> versioninfo()
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
  JULIA_GPG = 3673DF529D9049477F76B37566E3C7DC03D6E495
  JULIA_VERSION = 1.7.2
  JULIA_PATH = /usr/local/julia

julia> using Pkg

julia> Pkg.activate()
  Activating project at `~/.julia/environments/v1.7`

julia> Pkg.add("JET")
  Installing known registries into `~/.julia`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
   Installed Requires ─────────── v1.3.0
   Installed CodeTracking ─────── v1.0.9
   Installed MacroTools ───────── v0.5.9
   Installed LoweredCodeUtils ─── v2.2.2
   Installed OrderedCollections ─ v1.4.1
   Installed JuliaInterpreter ─── v0.9.13
   Installed JET ──────────────── v0.5.14
   Installed Revise ───────────── v3.3.3
    Updating `~/.julia/environments/v1.7/Project.toml`
  [c3a54625] + JET v0.5.14
    Updating `~/.julia/environments/v1.7/Manifest.toml`
  [da1fd8a2] + CodeTracking v1.0.9
  [c3a54625] + JET v0.5.14
  [aa1ae85d] + JuliaInterpreter v0.9.13
  [6f1432cf] + LoweredCodeUtils v2.2.2
  [1914dd2f] + MacroTools v0.5.9
  [bac558e1] + OrderedCollections v1.4.1
  [ae029012] + Requires v1.3.0
  [295af30f] + Revise v3.3.3
  [0dad84c5] + ArgTools
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [8ba89e20] + Distributed
  [f43a241f] + Downloads
  [7b1f6079] + FileWatching
  [b77e0a4c] + InteractiveUtils
  [b27032c2] + LibCURL
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [ca575930] + NetworkOptions
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [6462fe0b] + Sockets
  [fa267f1f] + TOML
  [a4e569a6] + Tar
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [deac9b47] + LibCURL_jll
  [29816b5a] + LibSSH2_jll
  [c8ffd9c3] + MbedTLS_jll
  [14a3606d] + MozillaCACerts_jll
  [83775a58] + Zlib_jll
  [8e850ede] + nghttp2_jll
  [3f19e933] + p7zip_jll
Precompiling project...
  11 dependencies successfully precompiled in 15 seconds

julia> Pkg.activate(".")
  Activating project at `/project`

julia> using JET

julia> report_package(Pkg.project().name)
[toplevel-info] virtualized the context of Main (took 0.026 sec)
[toplevel-info] entered into /project/src/NonBlockingChannels.jl
[toplevel-info] entered into /project/src/leakingchannel.jl
[toplevel-info]  exited from /project/src/leakingchannel.jl (took 0.283 sec)
[toplevel-info]  exited from /project/src/NonBlockingChannels.jl (took 3.317 sec)
[toplevel-info] analyzing from top-level definitions ... 14/14
═════ 1 possible error found ═════
┌ @ /project/src/leakingchannel.jl:43 result = NonBlockingChannels.popfirst(Base.getproperty(c, :channel))
│ variable NonBlockingChannels.popfirst is not defined: result = NonBlockingChannels.popfirst(Base.getproperty(c::NonBlockingChannels.LeakingChannel, :channel::Symbol)::AbstractChannel{Any})
└─────────────────────────────────────


julia>

So all is good from the REPL - JET.jl finds the bug.

But fails when run with --eval

root@b0a5da3e7b70:/project# julia --project --eval 'using Pkg; using JET; report_package(Pkg.project().name)'
[toplevel-info] virtualized the context of Main (took 0.031 sec)
[toplevel-info] entered into /project/src/NonBlockingChannels.jl
[toplevel-info] entered into /project/src/leakingchannel.jl
[toplevel-info]  exited from /project/src/leakingchannel.jl (took 0.286 sec)
[toplevel-info]  exited from /project/src/NonBlockingChannels.jl (took 3.257 sec)
[toplevel-info] analyzing from top-level definitions ... 14/14

Trying again from the REPL:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.2 (2022-02-06)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Pkg; using JET; report_package(Pkg.project().name)
[toplevel-info] virtualized the context of Main (took 0.025 sec)
[toplevel-info] entered into /project/src/NonBlockingChannels.jl
[toplevel-info] entered into /project/src/leakingchannel.jl
[toplevel-info]  exited from /project/src/leakingchannel.jl (took 0.291 sec)
[toplevel-info]  exited from /project/src/NonBlockingChannels.jl (took 3.216 sec)
[toplevel-info] analyzing from top-level definitions ... 14/14
═════ 1 possible error found ═════
┌ @ /project/src/leakingchannel.jl:43 result = NonBlockingChannels.popfirst(Base.getproperty(c, :channel))
│ variable NonBlockingChannels.popfirst is not defined: result = NonBlockingChannels.popfirst(Base.getproperty(c::NonBlockingChannels.LeakingChannel, :channel::Symbol)::AbstractChannel{Any})
└─────────────────────────────────────


julia>

view this post on Zulip Jesper Stemann Andersen (May 06 2022 at 07:24):

Argh! Problem solved - sort of - it's just the output being silenced somehow:

root@b0a5da3e7b70:/project# julia --project --eval 'using Pkg; using JET; @show report_package(Pkg.project().name)'
[toplevel-info] virtualized the context of Main (took 0.031 sec)
[toplevel-info] entered into /project/src/NonBlockingChannels.jl
[toplevel-info] entered into /project/src/leakingchannel.jl
[toplevel-info]  exited from /project/src/leakingchannel.jl (took 0.291 sec)
[toplevel-info]  exited from /project/src/NonBlockingChannels.jl (took 3.259 sec)
[toplevel-info] analyzing from top-level definitions ... 14/14
report_package((Pkg.project()).name) = ═════ 1 possible error found ═════
 @ /project/src/leakingchannel.jl:43 result = NonBlockingChannels.popfirst(Base.getproperty(c, :channel))
 variable NonBlockingChannels.popfirst is not defined: result = NonBlockingChannels.popfirst(Base.getproperty(c::NonBlockingChannels.LeakingChannel, :channel::Symbol)::AbstractChannel{Any})
└─────────────────────────────────────

view this post on Zulip Jakob Nybo Nissen (May 09 2022 at 06:50):

You should make an issue

view this post on Zulip Jesper Stemann Andersen (May 11 2022 at 07:38):

Jakob Nybo Nissen said:

You should make an issue

I were about too, but as I found out it was merely output not being displayed (when not running in the REPL, of course) there was no need.

The outcome of my struggles is now available: https://gitlab.com/IHPSystems/julia/julia-gitlab-ci-templates/-/blob/v1.3.1/templates.gitlab-ci.yaml#L103


Last updated: Oct 02 2023 at 04:34 UTC