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

Harmless (?!) code leads to illegal instruction #29066

Closed
SimonDanisch opened this issue Sep 6, 2018 · 11 comments
Closed

Harmless (?!) code leads to illegal instruction #29066

SimonDanisch opened this issue Sep 6, 2018 · 11 comments
Labels
bug Indicates an unexpected problem or unintended behavior compiler:optimizer Optimization passes (mostly in base/compiler/ssair/)

Comments

@SimonDanisch
Copy link
Contributor

record_reference_images = true
recordpath = "blah"
if record_reference_images
   cd(homedir()) do
       isdir(dirname(recordpath)) || run(`git clone [email protected]:SimonDanisch/ReferenceImages.git`)
       isdir(recordpath) && rm(recordpath)
   end
end
Unreachable reached at 0x7f4bd800eda3

signal (4): Illegal instruction
in expression starting at no file:0
cd at ./file.jl:99
unknown function (ip: 0x7f4bd800edc5)
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1829
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:324
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:428
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:363 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:686
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:799
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f4be357ff2f)
unknown function (ip: 0x9)
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:808
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:787
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/builtins.c:622
eval at ./boot.jl:319
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
eval_user_input at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:85
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:117 [inlined]
#28 at ./task.jl:259
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1536 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:268
unknown function (ip: 0xffffffffffffffff)
Allocations: 263206 (Pool: 263125; Big: 81); GC: 0
Illegal instruction (core dumped)

Versioninfo:

julia> versioninfo()
Julia Version 1.0.0
Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
@JeffBezanson
Copy link
Sponsor Member

Worked for me. Maybe a stupid question, but should the blah directory exist?

@SimonDanisch
Copy link
Contributor Author

No, I don't think so - at least it wasn't in the origin example, and it didn't need to in the MWE.
Actually, I just came home to my windows machine, where the behaviour is a bit different:

(the error comes when pressing enter)

if record_reference_images
          cd(homedir()) do
                 isdir(dirname(recordpath)) || run(`git clone [email protected]:SimonDanisch/ReferenceImages.git`)
                        isdir(recordpath) && rm(recordpath)
                           end
                           end
Cloning into 'ReferenceImages'...
Enter passphrase for key '/c/Users/sdani/.ssh/id_rsa':
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Unreachable reached at 00000000290D0F94

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ILLEGAL_INSTRUCTION at 0x290d0f94 -- cd at .\file.jl:85
in expression starting at no file:0
cd at .\file.jl:87
unknown function (ip: 00000000290D0FBB)
jl_fptr_trampoline at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:1829
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2182
do_call at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:324
eval_value at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:428
eval_stmt_value at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:363 [inlined]
eval_body at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:682
jl_interpret_toplevel_thunk_callback at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:799
unknown function (ip: FFFFFFFFFFFFFFFE)
unknown function (ip: 00000000106AEDAF)
unknown function (ip: 0000000000000009)
jl_toplevel_eval_flex at /home/Administrator/buildbot/worker/package_win64/build/src\toplevel.c:787
jl_toplevel_eval_in at /home/Administrator/buildbot/worker/package_win64/build/src\builtins.c:622
eval at .\boot.jl:319
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2182
eval_user_input at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\REPL\src\REPL.jl:85
macro expansion at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\REPL\src\REPL.jl:117 [inlined]
#28 at .\task.jl:259
jl_fptr_trampoline at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:1829
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2182
jl_apply at /home/Administrator/buildbot/worker/package_win64/build/src\julia.h:1536 [inlined]
start_task at /home/Administrator/buildbot/worker/package_win64/build/src\task.c:268
Allocations: 2684473 (Pool: 2683974; Big: 499); GC: 5

And then just the command alone:

julia> run(`git clone [email protected]:SimonDanisch/ReferenceImages.git`)
Cloning into 'ReferenceImages'...
Enter passphrase for key '/c/Users/sdani/.ssh/id_rsa':
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
ERROR: failed process: Process(`git clone [email protected]:SimonDanisch/ReferenceImages.git`, ProcessExited(128)) [128]
Stacktrace:
 [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at .\error.jl:42
 [2] pipeline_error at .\process.jl:695 [inlined]
 [3] #run#505(::Bool, ::Function, ::Cmd) at .\process.jl:653
 [4] run(::Cmd) at .\process.jl:651
 [5] top-level scope at none:0

@SimonDanisch
Copy link
Contributor Author

I just run into the same error in some other unrelated, but also harmless looking code:
The error points to:
https://github.com/JuliaLang/julia/blob/v1.0.0/base/boot.jl#L581

Unreachable reached at 0x7fe1fe6630fb

signal (4): Illegal instruction
in expression starting at cell:1
check_top_bit at ./boot.jl:581 [inlined]
toUInt64 at ./boot.jl:692 [inlined]
Type at ./boot.jl:722 [inlined]
convert at ./number.jl:7 [inlined]
cconvert at ./essentials.jl:344 [inlined]
== at ./strings/string.jl:102 [inlined]
#84 at /root/.julia/packages/WebIO/myl19/src/providers/generic_http.jl:116

The code in generic_http is:
https://github.com/JuliaGizmos/WebIO.jl/blob/master/src/providers/generic_http.jl#L116

Seems like #25430 is unrelated?!

@JeffBezanson
Copy link
Sponsor Member

Would be good to test with #29406 and #29380 if you can.

@SimonDanisch
Copy link
Contributor Author

Tested with latest master, which fixes #29468 but still fails with the issue here:

julia> cd(homedir()) do
                    run(`blah`)
                    rand(Bool) && nothing
                end
Unreachable reached at 0x7f5ee4334d73

signal (4): Illegal instruction
in expression starting at no file:0
cd at ./file.jl:99
unknown function (ip: 0x7f5ee4334d95)
jl_fptr_trampoline at /home/sd/juliastuff/julia/src/gf.c:1843
jl_apply_generic at /home/sd/juliastuff/julia/src/gf.c:2198
do_call at /home/sd/juliastuff/julia/src/interpreter.c:323
eval_value at /home/sd/juliastuff/julia/src/interpreter.c:411
eval_stmt_value at /home/sd/juliastuff/julia/src/interpreter.c:362 [inlined]
eval_body at /home/sd/juliastuff/julia/src/interpreter.c:768
jl_interpret_toplevel_thunk_callback at /home/sd/juliastuff/julia/src/interpreter.c:880
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f5ef1d5b57f)
unknown function (ip: 0x7)
jl_interpret_toplevel_thunk at /home/sd/juliastuff/julia/src/interpreter.c:889
jl_toplevel_eval_flex at /home/sd/juliastuff/julia/src/toplevel.c:818
jl_toplevel_eval_in at /home/sd/juliastuff/julia/src/builtins.c:622
eval at ./boot.jl:319
jl_apply_generic at /home/sd/juliastuff/julia/src/gf.c:2198
eval_user_input at /home/sd/juliastuff/julia/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:85
macro expansion at /home/sd/juliastuff/julia/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:117 [inlined]
#26 at ./task.jl:259
jl_apply_generic at /home/sd/juliastuff/julia/src/gf.c:2198
jl_apply at /home/sd/juliastuff/julia/src/julia.h:1562 [inlined]
start_task at /home/sd/juliastuff/julia/src/task.c:504
unknown function (ip: 0xffffffffffffffff)
Allocations: 1138948 (Pool: 1138767; Big: 181); GC: 1
Illegal instruction (core dumped)

As you can see I reduced the example a bit... Right hand of short circuit doesn't matter - just seems to be important that the compiler can't infer whether it's true or false!
Doesn't crash without cd - since cd uses libuv and run as well, maybe there is something funky going on with libuv

@vtjnash
Copy link
Sponsor Member

vtjnash commented Oct 4, 2018

Yeah, there's many cases where we can't handle errors with catch right now without segfaulting. Keno started work on a PR to fix that (#29158)

@SimonDanisch
Copy link
Contributor Author

Oh wow^^ Well, seems like #29158 fixes this :)

@PetrKryslUCSD
Copy link

Is this crash related (segmentation violation)?

signal (11): Segmentation fault
in expression starting at /mnt/c/Users/PetrKrysl/Documents/Work-in-progress/H2Libjl/src/SolidMatrices.jl:16
jl_array_ptr_ref at /buildworker/worker/package_linux64/build/src/julia.h:785 [inlined]
body_attributes at /buildworker/worker/package_linux64/build/src/toplevel.c:404 [inlined]
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:761
resolve_globals at /buildworker/worker/package_linux64/build/src/method.c:34
jl_method_set_source at /buildworker/worker/package_linux64/build/src/method.c:559 [inlined]
jl_new_method at /buildworker/worker/package_linux64/build/src/method.c:628 [inlined]
jl_method_def at /buildworker/worker/package_linux64/build/src/method.c:790
eval_methoddef at /buildworker/worker/package_linux64/build/src/interpreter.c:310
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:659
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:799
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f7b9db9294f)
unknown function (ip: 0x13)
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:808
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:787
jl_eval_module_expr at /buildworker/worker/package_linux64/build/src/toplevel.c:233
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:616
jl_parse_eval_all at /buildworker/worker/package_linux64/build/src/ast.c:838
jl_load at /buildworker/worker/package_linux64/build/src/toplevel.c:821
include at ./boot.jl:317 [inlined]
include_relative at ./loading.jl:1038
include at ./sysimg.jl:29 [inlined]
include at /mnt/c/Users/PetrKrysl/Documents/Work-in-progress/H2Libjl/src/H2Libjl.jl:1
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:324
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:428
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:363 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:686
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:799
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f7b9d00ea3f)
unknown function (ip: 0xffffffffffffffff)
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:808
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:787
jl_eval_module_expr at /buildworker/worker/package_linux64/build/src/toplevel.c:233
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:616
jl_parse_eval_all at /buildworker/worker/package_linux64/build/src/ast.c:838
jl_load at /buildworker/worker/package_linux64/build/src/toplevel.c:821
include at ./boot.jl:317 [inlined]
include_relative at ./loading.jl:1038
_require at ./loading.jl:950
require at ./loading.jl:852
macro expansion at ./logging.jl:311 [inlined]
require at ./loading.jl:834
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1536 [inlined]
call_require at /buildworker/worker/package_linux64/build/src/toplevel.c:441 [inlined]
eval_import_path at /buildworker/worker/package_linux64/build/src/toplevel.c:476
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:633
jl_eval_module_expr at /buildworker/worker/package_linux64/build/src/toplevel.c:233
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:616
jl_parse_eval_all at /buildworker/worker/package_linux64/build/src/ast.c:838
jl_load at /buildworker/worker/package_linux64/build/src/toplevel.c:821
include at ./boot.jl:317 [inlined]
include_relative at ./loading.jl:1038
include at ./sysimg.jl:29
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
include at ./client.jl:388
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1829
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:324
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:428
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:363 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:686
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:799
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f7b9b6fe94f)
unknown function (ip: 0xffffffffffffffff)
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:808
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:787
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:734
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/builtins.c:622
eval at ./boot.jl:319
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
eval_user_input at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:85
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:117 [inlined]
#28 at ./task.jl:259
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1536 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:268
unknown function (ip: 0xffffffffffffffff)
Allocations: 7076016 (Pool: 7074879; Big: 1137); GC: 15
Segmentation fault (core dumped)

@JeffBezanson
Copy link
Sponsor Member

It's hard to say. If you haven't filed it yet, please file an issue with instructions for reproducing it. If it turns out to be a duplicate of something else we'll figure that out eventually.

@SimonDanisch
Copy link
Contributor Author

I think it's related... I can reproduce it on julia 1.0, while i get an error on @Keno branch:

julia> c = h5open("mydata.h5", "r") do file
           read(file, "A")
       end
HDF5-DIAG: Error detected in HDF5 (1.10.0-patch1) thread 139890977341632:
  #000: ../../../src/H5O.c line 257 in H5Oopen(): unable to open object
    major: Object header
    minor: Can't open object
  #001: ../../../src/H5O.c line 1499 in H5O_open_name(): object not found
    major: Object header
    minor: Object not found
  #002: ../../../src/H5Gloc.c line 430 in H5G_loc_find(): can't find object
    major: Symbol table
    minor: Object not found
  #003: ../../../src/H5Gtraverse.c line 869 in H5G_traverse(): internal path traversal failed
    major: Symbol table
    minor: Object not found
  #004: ../../../src/H5Gtraverse.c line 641 in H5G_traverse_real(): traversal operator failed
    major: Symbol table
    minor: Callback failed
  #005: ../../../src/H5Gloc.c line 385 in H5G_loc_find_cb(): object 'A' doesn't exist
    major: Symbol table
    minor: Object not found

@JeffBezanson JeffBezanson added compiler:optimizer Optimization passes (mostly in base/compiler/ssair/) bug Indicates an unexpected problem or unintended behavior labels Nov 12, 2018
@maleadt
Copy link
Member

maleadt commented Dec 11, 2018

Appears to be fixed after #29158.

@maleadt maleadt closed this as completed Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior compiler:optimizer Optimization passes (mostly in base/compiler/ssair/)
Projects
None yet
Development

No branches or pull requests

5 participants