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 Revise can make the REPL evaluation get delayed by one step #195

Closed
KristofferC opened this issue Sep 23, 2018 · 15 comments
Closed

Using Revise can make the REPL evaluation get delayed by one step #195

KristofferC opened this issue Sep 23, 2018 · 15 comments

Comments

@KristofferC
Copy link
Collaborator

Note: It is still unknown if this is the fault of Revise but I have yet had it happened without using Revise.

The problem is that the execution in the REPL gets "delayed" by one step. For example:

julia> error("foo")
TestException

julia> 1
ERROR: foo
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at none:0

julia> "fo"
1

julia> 2
"fo"

872184a changed something with the REPL so might be relevant?

@timholy
Copy link
Owner

timholy commented Sep 23, 2018

Does this always happen or only under certain circumstances? And what does your startup.jl file look like? (Old style or new one?)

@KristofferC
Copy link
Collaborator Author

This is just using Revise in the REPL. Will investigate further and report back.

@timholy
Copy link
Owner

timholy commented Sep 24, 2018

Also please report environment details (julia version, startup.jl contents, other packages in use). I suspect if this were widespread I would have heard about it by now, so it may depend on something specific.

@KristofferC
Copy link
Collaborator Author

KristofferC commented Sep 30, 2018

Will close this and reopen if I can make this happen again.

@KristofferC
Copy link
Collaborator Author

I managed to repro this without using Revise by Ctrl-C a threaded loop that was spewing output to stdout. So not a Revise issue :)

@timholy
Copy link
Owner

timholy commented Oct 10, 2018

OK. FWIW I saw this delayed response when fixing #199. So I know this really happens. Perhaps there is a way to prevent that, but since it seems triggered by other bugs mostly I'm planning on getting rid of all bugs 😉.

@KristofferC KristofferC reopened this Jan 16, 2019
@KristofferC
Copy link
Collaborator Author

Might as well keep this open then (JuliaLang/julia#30727)

@KristofferC KristofferC changed the title (Maybe!) Using Revise can make the REPL evaluation get "confused" Using Revise can make the REPL evaluation get delayed by one step Jan 16, 2019
@mkborregaard
Copy link

mkborregaard commented Feb 8, 2019

I seem to only encounter this in Juno:
skaermbillede 2019-02-08 kl 08 16 25
I've got Revise, Rebugger and OhMyREPL loading in my startup.jl file.

@timholy
Copy link
Owner

timholy commented Feb 8, 2019

Combining with OhMyREPL could be the problem. We need a common framework for packages that intercept the REPL.

@PhilipVinc
Copy link

I don't have a screenshot, but I see this often (2-3/day) while working in Juno. I don't have OhMyREPL and Rebugger installed.
I'm not sure what causes it, but I have the feeling that it happens often after I Ctrl-C midway during a loop.

@timholy
Copy link
Owner

timholy commented Feb 8, 2019

Oh wow, that's surprising. I keep falling back to my old habits of using the REPL, but I'll try to do more stuff in Juno and see if I can catch it in the act. I do know this sometimes happens if Revise itself errors, but it sounds like this isn't such a case.

@felixcremer
Copy link

I have seen this on the REPL as well without Rebugger or OhMyREPL installed.
This was using Julia 1.1, below you find the Error messages that came right before the issue.
The last error message belongs to the @reliable_digits 4.0 + 3.0 call on the second to last REPL.
Unfortunately, I can't reproduce this anymore.

(v1.1) pkg> activate .

julia> using Revise

julia> using EmpiricalModeDecomposition
[ Info: Recompiling stale cache file ~/.julia/compiled/v1.1/EmpiricalModeDecomposition/ajpmx.ji for EmpiricalModeDecomposition [13f08ee4-7ac9-11e8-319c-07f4727f0a09]
ERROR: LoadError: LoadError: ArgumentError: Package EmpiricalModeDecomposition does not have TimeseriesSurrogates in its dependencies:
- If you have EmpiricalModeDecomposition checked out for development and have
  added TimeseriesSurrogates as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with EmpiricalModeDecomposition
Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:836
 [2] include at ./boot.jl:326 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1038
 [4] include at ./sysimg.jl:29 [inlined]
 [5] include(::String) at /home/user/.julia/dev/EmpiricalModeDecomposition/src/EmpiricalModeDecomposition.jl:1
 [6] top-level scope at none:0
 [7] include at ./boot.jl:326 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:1038
 [9] include(::Module, ::String) at ./sysimg.jl:29
 [10] top-level scope at none:2
 [11] eval at ./boot.jl:328 [inlined]
 [12] eval(::Expr) at ./client.jl:404
 [13] top-level scope at ./none:3
in expression starting at /home/user/.julia/dev/EmpiricalModeDecomposition/src/bootstrap.jl:1
in expression starting at /home/user/.julia/dev/EmpiricalModeDecomposition/src/EmpiricalModeDecomposition.jl:10
ERROR: Failed to precompile EmpiricalModeDecomposition [13f08ee4-7ac9-11e8-319c-07f4727f0a09] to /home/user/.julia/compiled/v1.1/EmpiricalModeDecomposition/ajpmx.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1197
 [3] _require(::Base.PkgId) at ./loading.jl:960
 [4] require(::Base.PkgId) at ./loading.jl:858
 [5] require(::Module, ::Symbol) at ./loading.jl:853

julia> using EmpiricalModeDecomposition
[ Info: Precompiling EmpiricalModeDecomposition [13f08ee4-7ac9-11e8-319c-07f4727f0a09]
ERROR: LoadError: LoadError: ArgumentError: Package EmpiricalModeDecomposition does not have TimeseriesSurrogates in its dependencies:
- If you have EmpiricalModeDecomposition checked out for development and have
  added TimeseriesSurrogates as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with EmpiricalModeDecomposition
Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:836
 [2] include at ./boot.jl:326 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1038
 [4] include at ./sysimg.jl:29 [inlined]
 [5] include(::String) at /home/user/.julia/dev/EmpiricalModeDecomposition/src/EmpiricalModeDecomposition.jl:1
 [6] top-level scope at none:0
 [7] include at ./boot.jl:326 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:1038
 [9] include(::Module, ::String) at ./sysimg.jl:29
 [10] top-level scope at none:2
 [11] eval at ./boot.jl:328 [inlined]
 [12] eval(::Expr) at ./client.jl:404
 [13] top-level scope at ./none:3
in expression starting at /home/user/.julia/dev/EmpiricalModeDecomposition/src/bootstrap.jl:1
in expression starting at /home/user/.julia/dev/EmpiricalModeDecomposition/src/EmpiricalModeDecomposition.jl:10
ERROR: Failed to precompile EmpiricalModeDecomposition [13f08ee4-7ac9-11e8-319c-07f4727f0a09] to /home/user/.julia/compiled/v1.1/EmpiricalModeDecomposition/ajpmx.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1197
 [3] _require(::Base.PkgId) at ./loading.jl:960
 [4] require(::Base.PkgId) at ./loading.jl:858
 [5] require(::Module, ::Symbol) at ./loading.jl:853

(emd_test) pkg> resolve
 Resolving package versions...
  Updating `~/Documents/Programmieren/julia_projects/emd_test/Project.toml`
 [no changes]
  Updating `~/Documents/Programmieren/julia_projects/emd_test/Manifest.toml`
  [621f4979] + AbstractFFTs v0.3.2
  [7d9fca2a] + Arpack v0.3.0
  [9e28174c] + BinDeps v0.8.10
  [3da002f7] + ColorTypes v0.7.5
  [5ae59095] + Colors v0.9.5
  [8f4d0f93] + Conda v1.2.0
  [d38c429a] + Contour v0.5.1
  [717857b8] + DSP v0.5.2
  [864edb3b] + DataStructures v0.15.0
  [31c24e10] + Distributions v0.16.4
  [7a1cc6ca] + FFTW v0.2.4
  [53c48c17] + FixedPointNumbers v0.5.3
  [28b8d3ca] + GR v0.37.0
  [505f98c9] + InplaceOps v0.3.0
  [682c06a0] + JSON v0.20.0
  [442fdcdd] + Measures v0.3.0
  [e1d29d7a] + Missings v0.4.0
  [77ba4419] + NaNMath v0.3.2
  [bac558e1] + OrderedCollections v1.0.2
  [90014a1f] + PDMats v0.9.6
  [ccf2f8ad] + PlotThemes v0.3.0
  [995b91a9] + PlotUtils v0.5.5
  [91a5bcdd] + Plots v0.23.0
  [f27b6e38] + Polynomials v0.5.2
  [1fd47b50] + QuadGK v2.0.3
  [3cdcf5f2] + RecipesBase v0.6.0
  [189a3867] + Reexport v0.2.0
  [ae029012] + Requires v0.5.2
  [79098fc4] + Rmath v0.5.0
  [992d4aef] + Showoff v0.2.1
  [a2af1166] + SortingAlgorithms v0.3.1
  [276daf66] + SpecialFunctions v0.7.2
  [2913bbd2] + StatsBase v0.27.0
  [4c63d2b9] + StatsFuns v0.8.0
  [c804724b] + TimeseriesSurrogates v0.2.1
  [30578b45] + URIParser v0.4.0
  [81def892] + VersionParsing v1.1.3
  [29a6e085] + Wavelets v0.8.0
  [4607b0f0] + SuiteSparse 

julia> using EmpiricalModeDecomposition
[ Info: Precompiling EmpiricalModeDecomposition [13f08ee4-7ac9-11e8-319c-07f4727f0a09]
WARNING: Method definition intp(Array{T, 1} where T, Array{T, 1} where T, Int64) in module TimeseriesSurrogates at /home/user/.julia/packages/TimeseriesSurrogates/WDk4B/src/interpolation.jl:6 overwritten at /home/user/.julia/packages/TimeseriesSurrogates/WDk4B/src/interpolation.jl:6.
┌ Warning: Replacing docs for `TimeseriesSurrogates.intp :: Tuple{Array{T,1} where T,Array{T,1} where T,Int64}` in module `TimeseriesSurrogates`
└ @ Base.Docs docs/Docs.jl:223

(emd_test) pkg> dev https://github.com/ffevotte/StochasticArithmetic.jl.git
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Cloning git-repo `https://github.com/ffevotte/StochasticArithmetic.jl.git`
  Updating git-repo `https://github.com/ffevotte/StochasticArithmetic.jl.git`
 Resolving package versions...
 Installed Formatting ─ v0.3.5
  Updating `~/Documents/Programmieren/julia_projects/emd_test/Project.toml`
  [f771ca10] + StochasticArithmetic v0.1.0 [`~/.julia/dev/StochasticArithmetic`]
  Updating `~/Documents/Programmieren/julia_projects/emd_test/Manifest.toml`
  [34da2185]  Compat v1.4.0  v1.5.1
  [59287772] + Formatting v0.3.5
  [6fe1bfb0]  OffsetArrays v0.9.1  v0.10.0
  [f771ca10] + StochasticArithmetic v0.1.0 [`~/.julia/dev/StochasticArithmetic`]

julia> using StochasticArithmetic
ERROR: could not open file /home/user/Documents/Programmieren/julia_projects/emd_test/compatmacro.jl[ Info: Precompiling StochasticArithmetic [f771ca10-1b0b-53f6-a01e-a0d756bd6223]

Stacktrace:
 [1] include at ./boot.jl:326 [inlined]
 [2] include_relative(::Module, ::String) at ./loading.jl:1038
 [3] include at ./sysimg.jl:29 [inlined]
 [4] include(::String) at /home/user/.julia/packages/Compat/HVYNa/src/Compat.jl:3
 [5] top-level scope at none:0

julia> using StochasticArithmetic

julia> @reliable_digits 4.0 + 3.0

julia> @reliable_digits SFloat64.(ts) + SFloat64.(ts) 
ERROR: MethodError: no method matching value(::Float64)
Closest candidates are:
  value(::SFloat64) at /home/user/.julia/dev/StochasticArithmetic/src/sfloat.jl:13
Stacktrace:
 [1] _broadcast_getindex_evalf at ./broadcast.jl:578 [inlined]
 [2] _broadcast_getindex at ./broadcast.jl:551 [inlined]
 [3] getindex at ./broadcast.jl:511 [inlined]
 [4] copy at ./broadcast.jl:763 [inlined]
 [5] materialize at ./broadcast.jl:753 [inlined]
 [6] (::getfield(Main, Symbol("##7#8")))(::Int64) at ./none:0
 [7] iterate at ./generator.jl:47 [inlined]
 [8] collect(::Base.Generator{UnitRange{Int64},getfield(Main, Symbol("##7#8"))}) at ./array.jl:606
 [9] top-level scope at /home/user/.julia/dev/StochasticArithmetic/src/sfloat.jl:35

These have been the packages installed in the activated and global environment:

(emd_test) pkg> st
    Status `~/Documents/Programmieren/julia_projects/emd_test/Project.toml`
  [13f08ee4] EmpiricalModeDecomposition v0.1.0 [`~/.julia/dev/EmpiricalModeDecomposition`]
  [a98d9a8b] Interpolations v0.11.1
  [cf272ae8] LibEEMD v0.1.0 [`~/.julia/dev/LibEEMD`]
  [f771ca10] StochasticArithmetic v0.1.0 [`~/.julia/dev/StochasticArithmetic`]

(emd_test) pkg> activate 

(v1.1) pkg> st
    Status `~/.julia/environments/v1.1/Project.toml`
  [13f08ee4] EmpiricalModeDecomposition v0.0.0 [`~/.julia/dev/EmpiricalModeDecomposition`]
  [7a1cc6ca] FFTW v0.2.4+ [`~/.julia/dev/FFTW`]
  [14b8a8f1] PkgTemplates v0.4.1
  [295af30f] Revise v1.0.2

Hopefully this is helpful.

@AlexRobson
Copy link

AlexRobson commented Feb 15, 2019

I'm also seeing this a few times now. Unfortunately I can't find a MWE to reproduce it. It start appearing after I've been working in the REPL for a period. Below is an example. FWIW, I saw the error stacktrace in DiffRules in a couple of instances where I saw this occur, although I have no direct call to that package in the package I am working on, nor any reference to api.jl in my package.

And, fwiw, reading the other comments that lead to this

  • I usually tend to see some kind of error message just before it starts to happen.
  • I do not have Juno or rebugger
<working REPL history>
julia> [1,2,3]]
ERROR: could not open file /Users/alexr/.julia/dev/<myproject>/api.jl
Stacktrace:
 [1] include at ./boot.jl:317 [inlined]
 [2] include_relative(::Module, ::String) at ./loading.jl:1044
 [3] include at ./sysimg.jl:29 [inlined]
 [4] include(::String) at /Users/alexr/.julia/packages/DiffRules/QCJTT/src/DiffRules.jl:3
 [5] top-level scope at none:0

julia> [1,2,3]
ERROR: syntax: extra token "]" after end of expression

julia> [1,2,3]
3-element Array{Int64,1}:
 1
 2
 3

This is in my startup.jl:

 @info "Loading OHMyREPL"
 using OhMyREPL
 atreplinit() do repl
     try
         @eval using Revise
         @async Revise.wait_steal_repl_backend()
         @info "Loading Revise.jl"
     catch err
         @warn "Could not load Revise.jl"
         error(err)
     end
 end

@timholy
Copy link
Owner

timholy commented Feb 17, 2019

Thanks very much for the reports. I'm pretty swamped right now with JuliaInterpreter.jl, but will come back to this. I'm sure these reports will be useful.

timholy added a commit that referenced this issue Feb 24, 2019
`backend.response_channel` handles errors but it has a capacity
of 1. If it already has an item in it, `put!` will wait until
the previous message has been delivered. This avoids that fate by
terminating revision processing once there is an error.
@timholy
Copy link
Owner

timholy commented Feb 24, 2019

While working on a big rewrite of this package based on JuliaInterpreter, by just reading through the code I may have figured out the problem here. See #242.

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

6 participants