Made Julia quit and now won't run even after re-install

I pasted the error message here

I was using callbacks with differential equations and comprehension. Julia quit and when I tried to run Atom again there was an error regarding resolve (?). I de-installed and re-installed Julia but now when I try to run any code it exits or is unresponsive.

I am an amateur programmer so it feels like this

Please help me…

Without the ability to reproduce the error, it is not easy to help you.
Anyway, here are some general directions:
First I would try to find out whether the problem stems from atom or Julia itself.
To do this open a shell (type cmd in the search bar and hit enter)
navigate to the Julia bin folder (should be in C:\Users\aw21sodo\AppData\Local\Programs\Julia\Julia-1.x.y\bin)
where x y replaced with your version. (e.g., Julia-1.4.1 for the latest stable release)
cd C:\Users\aw21sodo\AppData\Local\Programs\Julia\Julia-1.4.1\bin
If you are using older versions of Julia (I guess pre 1.3, the directory might be somewhere else)
Then enter
julia "C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\clearance comparison.jl"
If this works your Julia installation is fine and the problem stems from Atom.
If this is the case, close all Atom instances and type in the shell
apm update and follow the instructions on screen.

Could this be related to the recent Atom update?
See ANN: Juno 0.12.5 - #3 by yha
I had the same problem, reinstalling Juno helped.

Thank you for your replies - I ended up uninstalling and reinstalling Atom (and then reinstalling Juno) before I read them. If it happens again I will follow @Rudi79’s instructions.

I managed to produce the error again and want to make a backtrace but I don’t understand the instructions how.

Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core™ i5-8350U CPU @ 1.70GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
JULIA_NUM_THREADS = 4

I’ve managed to make a slightly different error when I stopped using callbacks. If anyone is interested I will share my depository with you, as I can’t think of how to make a MWE.

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.    
Exception: EXCEPTION_ACCESS_VIOLATION at 0x13aaee8 -- getindex at .\array.jl:788 [inlined]
create_N at C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\Function set-up.jl:120
in expression starting at C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\Schneider et al 2016 vectors & biomass.jl:40  
getindex at .\array.jl:788 [inlined]
create_N at C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\Function set-up.jl:120
unknown function (ip: 00000000013AB1D3)
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_call at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:369
eval_value at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:458
eval_stmt_value at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:409 [inlined]
eval_body at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:799
jl_interpret_toplevel_thunk at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:911
jl_toplevel_eval_flex at /cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:814
jl_parse_eval_all at /cygdrive/d/buildbot/worker/package_win64/build/src\ast.c:872
jl_load at /cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:872 [inlined]
jl_load_ at /cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:879
include at .\client.jl:439
create_initial_conditions at C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\clearance comparison.jl:7
run_one_foodweb at C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\clearance comparison.jl:77
#30 at .\none:0 [inlined]
iterate at .\generator.jl:47 [inlined]
collect at .\array.jl:665
unknown function (ip: 000000000141AC70)
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_call at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:369
eval_value at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:458
eval_stmt_value at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:409 [inlined]
eval_body at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:799
jl_interpret_toplevel_thunk at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:911
jl_toplevel_eval_flex at /cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:814
jl_parse_eval_all at /cygdrive/d/buildbot/worker/package_win64/build/src\ast.c:872
include_string at .\loading.jl:1080
include_string at C:\Users\aw21sodo\.julia\packages\CodeTools\kosGY\src\eval.jl:30
unknown function (ip: 000000006123CF19)
#206 at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:119
withpath at C:\Users\aw21sodo\.julia\packages\CodeTools\kosGY\src\utils.jl:30
withpath at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:9
#205 at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:118 [inlined]
with_logstate at .\logging.jl:398
with_logger at .\logging.jl:505 [inlined]
#204 at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:117 [inlined]
hideprompt at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\repl.jl:127
macro expansion at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:116 [inlined]
macro expansion at C:\Users\aw21sodo\.julia\packages\Media\ItEPc\src\dynamic.jl:24 [inlined]
eval at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:113
unknown function (ip: 0000000061229BC3)
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:643
jl_f__apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:657 [inlined]
jl_f__apply_latest at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:693
#invokelatest#1 at .\essentials.jl:712
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:643
invokelatest at .\essentials.jl:711
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:643
macro expansion at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:41 [inlined]
#188 at .\task.jl:358
unknown function (ip: 0000000061164C03)
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
start_task at /cygdrive/d/buildbot/worker/package_win64/build/src\task.c:687
Allocations: 1598562874 (Pool: 1598523878; Big: 38996); GC: 355

I also seem to be unable to change the title of this post - Julia and Atom are running (for the moment).

Slightly different error when I remove one call back but leave the other call back in place. First I create a dynamic food web, and use the output of the food web as the beginning values of the same differential equations but with species harvesting. I have four different types of harvesting (called clearance in the model). Then I create a new food web and the process repeats.

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.    
Exception: EXCEPTION_ACCESS_VIOLATION at 0x668eedae -- jl_field_offset at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1020 [inlined]
set_nth_field at /cygdrive/d/buildbot/worker/package_win64/build/src\datatype.c:1067
in expression starting at C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\clearance comparison.jl:89
jl_field_offset at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1020 [inlined]
set_nth_field at /cygdrive/d/buildbot/worker/package_win64/build/src\datatype.c:1067
jl_f_tuple at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:725
apply_clearance at C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\clearance comparison.jl:37
#24 at .\none:0 [inlined]
iterate at .\generator.jl:47 [inlined]
collect at .\array.jl:665
run_one_foodweb at C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\clearance comparison.jl:83
#26 at .\none:0 [inlined]
iterate at .\generator.jl:47 [inlined]
collect_to! at .\array.jl:711
collect_to_with_first! at .\array.jl:689
unknown function (ip: 0000000000EF54EF)
collect at .\array.jl:670
unknown function (ip: 0000000000EAB180)
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_call at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:369
eval_value at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:458
eval_stmt_value at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:409 [inlined]
eval_body at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:799
jl_interpret_toplevel_thunk at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:911
jl_toplevel_eval_flex at /cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:814
jl_parse_eval_all at /cygdrive/d/buildbot/worker/package_win64/build/src\ast.c:872
include_string at .\loading.jl:1080
include_string at C:\Users\aw21sodo\.julia\packages\CodeTools\kosGY\src\eval.jl:30
unknown function (ip: 0000000000EA8BB9)
#206 at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:119
withpath at C:\Users\aw21sodo\.julia\packages\CodeTools\kosGY\src\utils.jl:30
withpath at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:9
#205 at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:118 [inlined]
with_logstate at .\logging.jl:398
with_logger at .\logging.jl:505 [inlined]
#204 at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:117 [inlined]
hideprompt at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\repl.jl:127
macro expansion at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:116 [inlined]
macro expansion at C:\Users\aw21sodo\.julia\packages\Media\ItEPc\src\dynamic.jl:24 [inlined]
eval at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:113
unknown function (ip: 00000000601C4CC3)
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:643
jl_f__apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:657 [inlined]
jl_f__apply_latest at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:693
#invokelatest#1 at .\essentials.jl:712
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:643
invokelatest at .\essentials.jl:711
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:643
macro expansion at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:41 [inlined]
#188 at .\task.jl:358
unknown function (ip: 00000000600F4C03)
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
start_task at /cygdrive/d/buildbot/worker/package_win64/build/src\task.c:687
Allocations: 735090915 (Pool: 735056474; Big: 34441); GC: 186

The running code is

include("Schneider et al 2016 parameters.jl") # list of constants
include("Function set-up.jl") # list of functions
include("Function running.jl") # differential equations

# create the initial conditions for a given network
function create_initial_conditions(target_species)
    include("Schneider et al 2016 vectors & biomass.jl") # constants that are randomized per food web

    tmax = 50000.0
    tspan = (0.0,tmax)

    function condition(out, u, t, integrator)
        out .= u[1:(end-1)] .- 1e-6
    end

    function affect!(integrator, event_index)
        integrator.u[event_index] = 0.0
    end

    extinction_cb = VectorContinuousCallback(condition,affect!,length(bioS[1:(end-1)]))
    p = (D, S, K, v, r, X, num_nutrient, num_plant, num_animal, num_vessel_types, bm, foodWeb, b, q, ω, c, h, e, target_species, catch_max, b0V, μ, elasticity, clearance_V_type)

    prob = ODEProblem(dBdT,bioS,tspan,p)
    global base_simulation=solve(prob, alg = CVODE_BDF()) # global so it can be passed to apply_clearance()


    return base_simulation[end]
end

# applies a clearance type and a target species
function apply_clearance(bioS, clearance_V_type, target_species)
    results =  fill(NaN,5) # how ever many values we ar comparing between scenarios

    num_extinct_base = sum(base_simulation[end] .<= 0.0)

    p = (D, S, K, v, r, X, num_nutrient, num_plant, num_animal, num_vessel_types, bm, foodWeb, b, q, ω, c, h, e, target_species, catch_max, b0V, μ, elasticity, clearance_V_type)

    function condition(out, u, t, integrator)
        out .= u[1:(end-1)] .- 1e-6
    end
    
     function affect!(integrator, event_index)
         integrator.u[event_index] = 0.0
    end
    tmax = 50000.0
    tspan = (0.0,tmax)
    extinction_cb = VectorContinuousCallback(condition,affect!,length(bioS) - 1)

    fishing_prob = ODEProblem(dBdT,bioS,tspan,p, callback=extinction_cb)

    fishing_sol = solve(fishing_prob, alg = CVODE_BDF()) # global so we can create a graph
    num_extinct_clearance = abs(num_extinct_base-sum(fishing_sol[end] .<= 0.0))

    vessel_final = log10(fishing_sol[end][(num_nutrient+num_plant+num_animal+num_vessel_types)])
    target_final = log10(fishing_sol[end][target_species])

fishing_sol[target_species,end] num_extinct]
    results = [fish_price vessel_final target_final num_extinct_base num_extinct_clearance]
    return results
end


# run the 4 different scenarios and store the results in one_foodweb_result:
function run_one_foodweb()

    initial = create_initial_conditions(0)
    bioS = deepcopy(initial)
    # and then continue the simulations with one clearance type
    # apply_clearance(bioS, 1, 82)

    # or run the 4 different scenarios and store the results in result:
    one_foodweb_result = [apply_clearance(bioS, x, 82) for x in 1:4]

    return one_foodweb_result
end

# now run however many food webs you want and store it
all_foodweb_result = [run_one_foodweb() for x in 1:20]

I would try running my code with (and run out of Atom to rule any issue with that out):

julia --check-bounds=no --O1 --startup-file=no [your_main_program_file.jl]

at least the first option. I doubt the other matters (note, could make slower), as the default -O2 optimization shouldn’t introduce bugs, maybe -O3 might?

I didn’t look carefully at the errors, and it’s not like I can replicate with the included files missing, why I predictably got an error, and another (below) by commenting out.

If the above doesn’t resolve, then this seems like an excellent candidate for new option in Julia 1.5 (download the nightly), plus possibly the others:

$ ~/julia-1.5-ea669c3d3e/bin/julia --bug-report=yes your_main_program_file.jl
[ Info: Loading BugReporting package...

As Julia 1.5 is not out I’m not sure if submitting such (automatic) reports is yet supported, but seems to work, and I think could be received, in theory.

ERROR: LoadError: syntax: extra token "num_extinct" after end of expression
Stacktrace:
 [1] include at ./boot.jl:317 [inlined]
 [2] include_relative(::Module, ::String) at ./loading.jl:1044
 [3] include(::Module, ::String) at ./sysimg.jl:29
 [4] exec_options(::Base.JLOptions) at ./client.jl:266
 [5] _start() at ./client.jl:425
in expression starting at /home/pharaldsson_sym/fenics/pyjulia/pyjulia/test2.jl:57
1 Like

Is it possible that your .julia folder got corrupted? I would sometimes “clean up” completely by removing the folder altogether. When Julia is installed and run for the first time, it reconstructs this folder, so there is little to fear from this step.

Before deleting the .julia folder, saving and restoring the .julia\environments\v1.x\Project.toml file will make reinstantiating your libraries easier.

1 Like

The error has stopped appearing after I deleted .julia and reinstalled. Not sure why.

I will be using this thread for trouble shooting in the future, so thank you for your replies.

I spoke too soon.

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.    
Exception: EXCEPTION_ACCESS_VIOLATION at 0x668beb9c -- jl_f_tuple at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:709
in expression starting at C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\test for clearance comparison error.jl:80     
jl_f_tuple at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:709
create_initial_conditions at C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\test for clearance comparison error.jl:21  
run_one_foodweb at C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\test for clearance comparison error.jl:68
#49 at .\none:0 [inlined]
iterate at .\generator.jl:47 [inlined]
collect_to! at .\array.jl:711
collect_to_with_first! at .\array.jl:689
unknown function (ip: 000000000149D5BF)
collect at .\array.jl:670
unknown function (ip: 000000000146B6C0)
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_call at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:369
eval_value at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:458
eval_stmt_value at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:409 [inlined]
eval_body at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:799
jl_interpret_toplevel_thunk at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:911
jl_toplevel_eval_flex at /cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:819
jl_parse_eval_all at /cygdrive/d/buildbot/worker/package_win64/build/src\ast.c:872
include_string at .\loading.jl:1080
include_string at C:\Users\aw21sodo\.julia\packages\CodeTools\kosGY\src\eval.jl:30
unknown function (ip: 0000000001C3C769)
#206 at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:119
withpath at C:\Users\aw21sodo\.julia\packages\CodeTools\kosGY\src\utils.jl:30
withpath at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:9
#205 at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:118 [inlined]
with_logstate at .\logging.jl:398
with_logger at .\logging.jl:505 [inlined]
#204 at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:117 [inlined]
hideprompt at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\repl.jl:127
macro expansion at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:116 [inlined]
macro expansion at C:\Users\aw21sodo\.julia\packages\Media\ItEPc\src\dynamic.jl:24 [inlined]
eval at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:113
unknown function (ip: 0000000001C292D3)
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:643
jl_f__apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:657 [inlined]
jl_f__apply_latest at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:693
#invokelatest#1 at .\essentials.jl:712
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:643
invokelatest at .\essentials.jl:711
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:643
macro expansion at C:\Users\aw21sodo\.julia\packages\Atom\9h5Up\src\eval.jl:41 [inlined]
#188 at .\task.jl:358
unknown function (ip: 000000001B2E6143)
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
start_task at /cygdrive/d/buildbot/worker/package_win64/build/src\task.c:687
Allocations: 4219352105 (Pool: 4219313859; Big: 38246); GC: 723

Will now go through the suggestions.

It doesn’t seem to error using cmd, but I may not be able to generate the error like in Atom.

Using

julia "C:\Users\aw21sodo\Documents\Julia\Julia WD\phd-julia-code\test for clearance comparison error.jl"

relaunches Julia each time I run it, whereas in Atom I can re-run the code without having to open a new Julia session each time. I think this what causes the error to occur - the more the code repeats the higher chance of the fatal error.

I just want to check if this is what it’s supposed to look like when I use apm update

C:\Users\aw21sodo>apm update
Package Updates Available (0)
└── (empty)

Output of apm update looks fine.
If your code runs fine from the shell but not from Atom, try to set the number of threads to one.
You can do this in Atom → Juno → Settings → Julia Options → Number of Threads
After the change restart Atom. Enter Threads.nthreads() in the REPL to make sure it is set to one.