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

Sets test failure: !(isequal(s.dict.keys,k)) #11890

Closed
tkelman opened this issue Jun 27, 2015 · 7 comments
Closed

Sets test failure: !(isequal(s.dict.keys,k)) #11890

tkelman opened this issue Jun 27, 2015 · 7 comments
Labels
test This change adds or pertains to unit tests

Comments

@tkelman
Copy link
Contributor

tkelman commented Jun 27, 2015

Seen this in a few PR's, and now a master build: https://travis-ci.org/JuliaLang/julia/jobs/68599318 (osx)

exception on 4: ERROR: LoadError: test failed: !(isequal(s.dict.keys,k))
 in expression: !(isequal(s.dict.keys,k))
 in error at /private/tmp/julia/lib/julia/sys.dylib
 in default_handler at test.jl:29
 in do_test at test.jl:52
 in include at /private/tmp/julia/lib/julia/sys.dylib
 in runtests at /private/tmp/julia/share/julia/test/testdefs.jl:197
 in anonymous at multi.jl:837
 in run_work_thunk at multi.jl:590
 in anonymous at task.jl:837
while loading /private/tmp/julia/share/julia/test/sets.jl, in expression starting on line 95
    From worker 2:       * replutil             in  19.95 seconds
    From worker 5:       * subarray             in 343.62 seconds
    From worker 3:       * ranges               in  80.66 seconds
ERROR: LoadError: LoadError: test failed: !(isequal(s.dict.keys,k))
 in expression: !(isequal(s.dict.keys,k))
 in anonymous at task.jl:1403
while loading /private/tmp/julia/share/julia/test/sets.jl, in expression starting on line 95
while loading /private/tmp/julia/share/julia/test/runtests.jl, in expression starting on line 5
    From worker 4:       * sets                

Can anyone reproduce locally?

@tkelman tkelman added the test This change adds or pertains to unit tests label Jun 27, 2015
@yuyichao
Copy link
Contributor

The failing test seems to be the newly added rehash! test. From dict.jl, it seems that there's not really a grantee that rehash! should create a new key object.

@yuyichao
Copy link
Contributor

And from the comment, this behavior is GC sensitive which can probably explain that it doesn't happen everytime.

@yuyichao
Copy link
Contributor

Ref #11795

@yuyichao
Copy link
Contributor

Actually that line just cause a retry so it should not be a problem?

@yuyichao
Copy link
Contributor

The issue seems to be that the rehash doesn't really have to do anything (it basically just create another hash table) However, since it doesn't initialize the not used elements in the key table (and it doesn't need to do that), the key array can be equal or not depending on whatever was in the array initiailly.

Best shown like this.

julia> function t()
       s = Set(1:5)
       k = s.dict.keys
       Base.rehash!(s)
       s.dict.keys, k
       end
t (generic function with 1 method)

julia> t()
([0,4,0,0,0,2,3,0,140728686160976,0,0,0,5,0,0,1],[0,4,0,0,0,2,3,0,140728687306304,0,0,0,5,0,0,1])

julia> t()
([140728687306016,4,0,140728687305952,0,2,3,0,0,0,0,0,5,140728687306080,0,1],[140728687304960,4,0,140728687305120,0,2,3,0,0,0,140728687304416,140728687304448,5,140728687305296,0,1])

@yuyichao
Copy link
Contributor

IMHO, the best way to test this might be sth like this.

julia> function t()
       s = Set(["a", "b", "c"])
       Base.rehash!(s)
       k = s.dict.keys
       Base.rehash!(s)
       s.dict.keys, k
       end
t (generic function with 1 method)

julia> t()
(ASCIIString[#undef,#undef,#undef,"c",#undef,#undef,#undef,#undef,"b",#undef,#undef,#undef,#undef,"a",#undef,#undef],ASCIIString[#undef,#undef,#undef,"c",#undef,#undef,#undef,#undef,"b",#undef,#undef,#undef,#undef,"a",#undef,#undef])

julia> t()
(ASCIIString[#undef,#undef,#undef,"c",#undef,#undef,#undef,#undef,"b",#undef,#undef,#undef,#undef,"a",#undef,#undef],ASCIIString[#undef,#undef,#undef,"c",#undef,#undef,#undef,#undef,"b",#undef,#undef,#undef,#undef,"a",#undef,#undef])

P.S. how do we compare two arrays with embeded #undef ?

@yuyichao
Copy link
Contributor

Implemented #11892

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test This change adds or pertains to unit tests
Projects
None yet
Development

No branches or pull requests

2 participants