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

Crash when using max() in a function #34972

Closed
LudwigBoess opened this issue Mar 3, 2020 · 3 comments
Closed

Crash when using max() in a function #34972

LudwigBoess opened this issue Mar 3, 2020 · 3 comments

Comments

@LudwigBoess
Copy link

LudwigBoess commented Mar 3, 2020

Hi,
I just encountered a weird crash when using max() in a function. The error output is:

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 0x1f29908b -- + at .\float.jl:401 [inlined]
#sph_center_mapping#9 at C:\Users\ludwi\Documents\Code\Julia\SPH_mapping_min_version\sph_to_grid.jl:215
in expression starting at C:\Users\ludwi\Documents\Code\Julia\SPH_mapping_min_version\sph_to_grid.jl:363
* at .\float.jl:405 [inlined]
#sph_center_mapping#9 at C:\Users\ludwi\Documents\Code\Julia\SPH_mapping_min_version\sph_to_grid.jl:215
#sph_center_mapping at .\none:0
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2141 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2305
##core#404 at C:\Users\ludwi.julia\packages\BenchmarkTools\eCEpo\src\execution.jl:371
##sample#405 at C:\Users\ludwi.julia\packages\BenchmarkTools\eCEpo\src\execution.jl:377
#_run#12 at C:\Users\ludwi.julia\packages\BenchmarkTools\eCEpo\src\execution.jl:405
inner at .\none:0
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2141 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2305
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1631 [inlined]
jl_f__apply at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:627
jl_f__apply_latest at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:665
#invokelatest#1 at .\essentials.jl:713 [inlined]
#invokelatest at .\none:0 [inlined]
#run_result#37 at C:\Users\ludwi.julia\packages\BenchmarkTools\eCEpo\src\execution.jl:32 [inlined]
#run_result at .\none:0 [inlined]
#run#40 at C:\Users\ludwi.julia\packages\BenchmarkTools\eCEpo\src\execution.jl:94
#run at .\none:0 [inlined]
#run at .\none:0 [inlined]
#warmup#45 at C:\Users\ludwi.julia\packages\BenchmarkTools\eCEpo\src\execution.jl:141 [inlined]
warmup at C:\Users\ludwi.julia\packages\BenchmarkTools\eCEpo\src\execution.jl:141
jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2141 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2305
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1631 [inlined]
do_call at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:328
eval_value at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:417
eval_stmt_value at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:368 [inlined]
eval_body at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:764
jl_interpret_toplevel_thunk_callback at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:888
unknown function (ip: FFFFFFFFFFFFFFFE)
unknown function (ip: 000000001268930F)
unknown function (ip: 0000000000000006)
jl_toplevel_eval_flex at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:814
jl_parse_eval_all at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\ast.c:873
jl_load at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:878 [inlined]
jl_load
at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:885
include at .\boot.jl:328 [inlined]
include_relative at .\loading.jl:1105
include at .\Base.jl:31
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2135 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2305
exec_options at .\client.jl:287
_start at .\client.jl:460
jfptr__start_2086.clone_1 at C:\Users\ludwi\AppData\Local\Julia-1.3.0\lib\julia\sys.dll (unknown line)
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2135 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2305
unknown function (ip: 00000000004017DD)
unknown function (ip: 0000000000401BC5)
unknown function (ip: 00000000004013DE)
unknown function (ip: 000000000040151A)
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
Allocations: 13939324 (Pool: 13936004; Big: 3320); GC: 13

versioninfo() gives:

Julia Version 1.3.0
Commit 46ce4d7 (2019-11-26 06:09 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

I think I traced the error down to a function where I need to find the maximum of two values. If I do it by hand it works fine, but if I use the max() function the code crashes.

The error occurs when I use the version of find_min_pixel( ... ) or find_max_pixel( ... ) with max().

Using the max() function by itself works just fine, and as you can see in the error message traces the error to the array access later in the function, not the actual call to find_max_pixel( ... ).

You can find a repo with a minimal (not) working version here

@KristofferC
Copy link
Member

Could you try with 1.3.1 and the 1.4 release candidate (both available at https://julialang.org/downloads/)

@LudwigBoess
Copy link
Author

LudwigBoess commented Mar 3, 2020

Thanks for your reply. I checked with 1.3.1 and it also crashes at the same spot:

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 0x1b2eccb -- + at .\float.jl:401 [inlined]
#sph_center_mapping#9 at C:\Users\ludwi\Documents\Code\Julia\SPH_mapping_min_version\sph_to_grid.jl:215
in expression starting at REPL[3]:1
* at .\float.jl:405 [inlined]
#sph_center_mapping#9 at C:\Users\ludwi\Documents\Code\Julia\SPH_mapping_min_version\sph_to_grid.jl:215
#sph_center_mapping at .\none:0
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2141 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2305
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1631 [inlined]
do_call at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:328
eval_value at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:417
eval_stmt_value at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:368 [inlined]
eval_body at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:764
jl_interpret_toplevel_thunk_callback at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:888
unknown function (ip: FFFFFFFFFFFFFFFE)
unknown function (ip: 0000000012895D0F)
unknown function (ip: 0000000000000004)
jl_toplevel_eval_flex at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:814
jl_toplevel_eval_flex at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:764
jl_toplevel_eval at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:823 [inlined]
jl_toplevel_eval_in at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:843
eval at .\boot.jl:330
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2135 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2305
eval_user_input at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\REPL\src\REPL.jl:86
run_backend at C:\Users\ludwi.julia\packages\Revise\SZ4ae\src\Revise.jl:1070
#85 at .\task.jl:333
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2141 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2305
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1631 [inlined]
start_task at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\task.c:659
Allocations: 74599983 (Pool: 74579664; Big: 20319); GC: 80

Same with 1.4rc2:

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 0x20e7319 -- + at .\float.jl:401 [inlined]
#sph_center_mapping#15 at C:\Users\ludwi\Documents\Code\Julia\SPH_mapping_min_version\sph_to_grid.jl:215
in expression starting at C:\Users\ludwi\Documents\Code\Julia\SPH_mapping_min_version\sph_to_grid.jl:367
+ at .\float.jl:401 [inlined]
#sph_center_mapping#15 at C:\Users\ludwi\Documents\Code\Julia\SPH_mapping_min_version\sph_to_grid.jl:215
sph_center_mapping##kw at C:\Users\ludwi\Documents\Code\Julia\SPH_mapping_min_version\sph_to_grid.jl:154
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2158 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2322
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1692 [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:803
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\ludwi.julia\packages\CodeTools\kosGY\src\eval.jl:30
unknown function (ip: 000000001F5DD059)
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2144 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2322
#186 at C:\Users\ludwi.julia\packages\Atom\N5oSJ\src\eval.jl:74
withpath at C:\Users\ludwi.julia\packages\CodeTools\kosGY\src\utils.jl:30
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2144 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2322
withpath at C:\Users\ludwi.julia\packages\Atom\N5oSJ\src\eval.jl:9
#185 at C:\Users\ludwi.julia\packages\Atom\N5oSJ\src\eval.jl:73 [inlined]
with_logstate at .\logging.jl:398
with_logger at .\logging.jl:505 [inlined]
#184 at C:\Users\ludwi.julia\packages\Atom\N5oSJ\src\eval.jl:72 [inlined]
hideprompt at C:\Users\ludwi.julia\packages\Atom\N5oSJ\src\repl.jl:122
macro expansion at C:\Users\ludwi.julia\packages\Atom\N5oSJ\src\eval.jl:71 [inlined]
macro expansion at C:\Users\ludwi.julia\packages\Media\ItEPc\src\dynamic.jl:24 [inlined]
eval at C:\Users\ludwi.julia\packages\Atom\N5oSJ\src\eval.jl:67
unknown function (ip: 000000001F5D2B93)
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2144 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2322
#182 at C:\Users\ludwi.julia\packages\Atom\N5oSJ\src\eval.jl:62
#94 at C:\Users\ludwi.julia\packages\Revise\SZ4ae\src\Revise.jl:1218
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2144 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2322
handlemsg at C:\Users\ludwi.julia\packages\Atom\N5oSJ\src\comm.jl:166
unknown function (ip: 000000001F5B1712)
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2144 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2322
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1692 [inlined]
do_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\builtins.c:643
#19 at .\task.jl:358
unknown function (ip: 000000001F5AB45A)
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2144 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2322
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1692 [inlined]
start_task at /cygdrive/d/buildbot/worker/package_win64/build/src\task.c:687
Allocations: 67110569 (Pool: 67093231; Big: 17338); GC: 73

However, I also tried it on a remote Linux machine and it works fine there.

@JeffBezanson
Copy link
Member

When I run with --check-bounds=yes I get

ERROR: LoadError: BoundsError: attempt to access 1024-element Array{Float64,1} at index [1025]
Stacktrace:
 [1] getindex at ./array.jl:786 [inlined]
 [2] sph_center_mapping(::Array{Float32,2}, ::Array{Float32,2}, ::Array{Float32,2}, ::Array{Float32,2}, ::Array{Float32,2}; param::mappingParameters, kernel::WendlandC6, show_progress::Bool) at /home/jeff/src/SPH_mapping_min_version/sph_to_grid.jl:207
 [3] ##core#256() at /home/jeff/.julia/packages/BenchmarkTools/7aqwe/src/execution.jl:297

so I believe this is an incorrect @inbounds. If there's something else going on we can reopen this.

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

3 participants