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 describing a data frame with #NA DataValue #29639

Closed
tk3369 opened this issue Oct 14, 2018 · 6 comments
Closed

Crash when describing a data frame with #NA DataValue #29639

tk3369 opened this issue Oct 14, 2018 · 6 comments

Comments

@tk3369
Copy link
Contributor

tk3369 commented Oct 14, 2018

Ref: Discourse Post

julia> using DataFrames, DataValues

julia> x = DataFrame(a = [DataValue{Any}()])
1×1 DataFrame
│ Row │ a         │
│     │ DataValu… │
├─────┼───────────┤
│ 1   │ #NA       │

julia> describe(x)
Unreachable reached at 0x12d8c7486

signal (4): Illegal instruction: 4
in expression starting at no file:0
setindex! at ./dict.jl:381
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
grow_to! at ./dict.jl:159
unknown function (ip: 0x12d8c6c0e)
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
grow_to! at ./dict.jl:160
Type at ./dict.jl:145
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
Type at ./dict.jl:125
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
get_stats at /Users/tomkwong/.julia/packages/DataFrames/1PqZ3/src/abstractdataframe/abstractdataframe.jl:510
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
iterate at ./generator.jl:47 [inlined]
collect at ./array.jl:619
#describe#16 at /Users/tomkwong/.julia/packages/DataFrames/1PqZ3/src/abstractdataframe/abstractdataframe.jl:457
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
describe at /Users/tomkwong/.julia/packages/DataFrames/1PqZ3/src/abstractdataframe/abstractdataframe.jl:429
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
do_call at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:324
eval_stmt_value at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:363 [inlined]
eval_body at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:682
jl_interpret_toplevel_thunk_callback at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:795
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x11c75f43f)
unknown function (ip: 0xffffffffffffffff)
jl_interpret_toplevel_thunk at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:804
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:813
jl_toplevel_eval_in at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:622
eval at ./boot.jl:319
eval_user_input at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:85
macro expansion at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:117 [inlined]
#28 at ./task.jl:259
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1537 [inlined]
start_task at /Users/osx/buildbot/slave/package_osx64/build/src/task.c:268
Allocations: 80806894 (Pool: 80789250; Big: 17644); GC: 181
Illegal instruction: 4

Package versions:

  [a93c6f00] DataFrames v0.14.1
  [e7dc6d0d] DataValues v0.4.5

Julia version

julia> versioninfo()
Julia Version 1.0.1
Commit 0d713926f8 (2018-09-29 19:05 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, haswell)
Environment:
  JULIA_NUM_THREADS = 2
@simonbyrne
Copy link
Contributor

A simpler example:

julia> using DataValues

julia> Dict(:a => nothing, :b => DataValue{Any}(), :c => 1)
Unreachable reached at 0x1118c2556

signal (4): Illegal instruction: 4
in expression starting at no file:0
setindex! at ./dict.jl:381
merge! at ./abstractdict.jl:181
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
grow_to! at ./dict.jl:158
unknown function (ip: 0x1118c1f1e)
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
grow_to! at ./dict.jl:160
grow_to! at ./dict.jl:145 [inlined]
dict_with_eltype at ./abstractdict.jl:544 [inlined]
Type at ./dict.jl:129
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
Type at ./dict.jl:125
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
do_call at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:324
eval_stmt_value at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:363 [inlined]
eval_body at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:682
jl_interpret_toplevel_thunk_callback at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:795
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x11c22986f)
unknown function (ip: 0x4)
jl_interpret_toplevel_thunk at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:804
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:813
jl_toplevel_eval_in at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:622
eval at ./boot.jl:319
eval_user_input at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:85
macro expansion at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:117 [inlined]
#28 at ./task.jl:259
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1537 [inlined]
start_task at /Users/osx/buildbot/slave/package_osx64/build/src/task.c:268
Allocations: 12342502 (Pool: 12339714; Big: 2788); GC: 26
Illegal instruction: 4

@simonbyrne
Copy link
Contributor

It seems to be something to do with how DataValues handles promotion

julia> using DataValues

julia> promote(nothing,DataValue{Any}())
Segmentation fault: 11

@simonbyrne
Copy link
Contributor

Simplest minimal example I can create:

julia> struct DataValue{T} x::T end

julia> Base.promote_rule(::Type{DataValue{S}}, ::Type{DataValue{T}}) where {S,T} = DataValue{promote_type(S, T)}

julia> Base.promote_rule(::Type{DataValue{S}}, ::Type{T}) where {S,T} = DataValue{promote_type(S, T)}

julia> promote(nothing,DataValue{Float64}(1))
Segmentation fault: 11

@ararslan
Copy link
Member

Running Simon's minimal example on v1.1.0-DEV.397 gives me a stack overflow instead of a segfault, so perhaps this is just a matter of misspecified promotion that results in a stack overflow, and the segfaulting is the same issue as #17109?

@davidanthoff
Copy link
Contributor

Any idea what is misspecified about that promotion rule?

@KristofferC
Copy link
Member

KristofferC commented Oct 16, 2018

S and T jumps between

(S, T) = (Float64, Union{Nothing, Float64})
(S, T) = (Union{Nothing, Float64}, Union{Nothing, DataValue{Float64}})
(S, T) = (Float64, Union{Nothing, Float64})
(S, T) = (Union{Nothing, Float64}, Union{Nothing, DataValue{Float64}})
...

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

5 participants