Lyceum / LyceumBase.jl

A set of common definitions and interfaces for the Lyceum ecosystem.
MIT License
6 stars 2 forks source link

access to undefined reference in seed_threadrngs! #8

Open colinxs opened 4 years ago

colinxs commented 4 years ago

Ran into this:

(LyceumAI) pkg> test
   Testing LyceumAI
 Resolving package versions...
LyceumAI.jl: Error During Test at /home/colinxs/workspace/juliadev/LyceumAI/test/runtests.jl:30
  Got exception outside of a @test
  TaskFailedException:
  UndefRefError: access to undefined reference
  Stacktrace:
   [1] getindex at ./array.jl:744 [inlined]
   [2] ht_keyindex2!(::Dict{BigInt,Random.DSFMT.GF2X}, ::BigInt) at ./dict.jl:326
   [3] setindex!(::Dict{BigInt,Random.DSFMT.GF2X}, ::Random.DSFMT.GF2X, ::BigInt) at ./dict.jl:381
   [4] calc_jump(::BigInt, ::Random.DSFMT.GF2X) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Random/src/DSFMT.jl:179
   [5] calc_jump at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Random/src/DSFMT.jl:177 [inlined]
   [6] randjump at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Future/src/Future.jl:39 [inlined]
   [7] macro expansion at /home/colinxs/.julia/packages/LyceumBase/jOq5k/src/Tools/threading.jl:21 [inlined]
   [8] (::LyceumBase.Tools.var"#750#threadsfor_fun#52"{BigInt,Array{Random.MersenneTwister,1},UnitRange{Int64}})(::Bool) at ./threadingconstructs.jl:61
   [9] (::LyceumBase.Tools.var"#750#threadsfor_fun#52"{BigInt,Array{Random.MersenneTwister,1},UnitRange{Int64}})() at ./threadingconstructs.jl:28
  Stacktrace:
   [1] wait(::Task) at ./task.jl:251
   [2] macro expansion at ./threadingconstructs.jl:69 [inlined]
   [3] #seed_threadrngs!#51(::BigInt, ::typeof(seed_threadrngs!), ::Array{Random.MersenneTwister,1}, ::Int64) at /home/colinxs/.julia/packages/LyceumBase/jOq5k/src/Tools/threading.jl:18
   [4] #seed_threadrngs! at ./none:0 [inlined]
   [5] #seed_threadrngs!#50 at /home/colinxs/.julia/packages/LyceumBase/jOq5k/src/Tools/threading.jl:4 [inlined]
   [6] seed_threadrngs!(::Int64) at /home/colinxs/.julia/packages/LyceumBase/jOq5k/src/Tools/threading.jl:4
   [7] top-level scope at /home/colinxs/workspace/juliadev/LyceumAI/test/runtests.jl:32
   [8] top-level scope at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1107
   [9] top-level scope at /home/colinxs/workspace/juliadev/LyceumAI/test/runtests.jl:32
   [10] include at ./boot.jl:328 [inlined]
   [11] include_relative(::Module, ::String) at ./loading.jl:1105
   [12] include(::Module, ::String) at ./Base.jl:31
   [13] include(::String) at ./client.jl:424
   [14] top-level scope at none:6
   [15] eval(::Module, ::Any) at ./boot.jl:330
   [16] exec_options(::Base.JLOptions) at ./client.jl:263
   [17] _start() at ./client.jl:460

coming from https://github.com/Lyceum/LyceumBase.jl/blob/f9d133243ff7de191175603a7ae6ad310e2fc1bc/src/Tools/threading.jl#L7

Not really sure how this is happening as we clearly assign to rngs[1]. 06753943c788e7f78f04cf03460a8c0085665dfb adds a few "hail mary" attemps to fix this, namely 1) not inlining the function and 2) using a local variable MT for the call to randjump, but I don't see how this would actually do anything to address the issue (it should be semantically the same thing?!). That commit also adds some assert statements to hopefully catch the issue before the UndefRefError.

This issue is mostly just to track the problem and see if it comes up again.

colinxs commented 4 years ago

Just ran into it again when running pkg> test...

colinxs commented 4 years ago

So I think the issue is in how I'm testing, not in seed_threadrngs! itself