Skip to content

Calling workspace on remote workers doesn't work correctly #17433

@jonathanBieler

Description

@jonathanBieler

See the following example, the first issue is that isdefined is returning true, and then including again test.jl (which just contains the definition of test) doesn't load it.

julia> addprocs(1)
1-element Array{Int64,1}:
 2

julia> @everywhere include("test.jl")

julia> remotecall_fetch(test,2)
"hello"

julia> @everywhere workspace()

julia> remotecall_fetch(isdefined,2,:test)
true

julia> remotecall_fetch(test,2)
ERROR: UndefVarError: test not defined
 in eval(::Module, ::Any) at .\boot.jl:234
 in macro expansion at .\REPL.jl:92 [inlined]
 in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at .\event.jl:46

julia> include("test.jl")
test (generic function with 1 method)

julia> remotecall_wait(() -> begin include("test.jl") end,2)
WARNING: Method definition test() in module Main at D:\Julia\Julia-0.5.0-dev\test.jl:1 overwritten at D:\Julia\Julia-0.5.0-dev\test.jl:1.
Future(2,1,8,Nullable{Any}())

julia> remotecall_fetch(test,2)
ERROR: On worker 2:
UndefVarError: #test not defined
 in deserialize_datatype at .\serialize.jl:811
 in handle_deserialize at .\serialize.jl:558
 in deserialize_msg at .\multi.jl:120
 in message_handler_loop at .\multi.jl:1086
 in process_tcp_streams at .\multi.jl:1057
 in #496 at .\event.jl:46
 in #remotecall_fetch#488(::Array{Any,1}, ::Function, ::Function, ::Base.Worker) at .\multi.jl:901
 in remotecall_fetch(::Function, ::Base.Worker) at .\multi.jl:895
 in #remotecall_fetch#489(::Array{Any,1}, ::Function, ::Function, ::Int64) at .\multi.jl:904
 in remotecall_fetch(::Function, ::Int64) at .\multi.jl:904
 in eval(::Module, ::Any) at .\boot.jl:234
 in macro expansion at .\REPL.jl:92 [inlined]
 in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at .\event.jl:46

Here's whos just after calling workspace (no LastMain) :

julia> remotecall_fetch(whos,2)
        From worker 2:                            Base  30397 KB     Module
        From worker 2:                            Main  30398 KB     Module
Julia Version 0.5.0-dev+5364
Commit f47d9fe* (2016-07-12 17:36 UTC)
Platform Info:
  System: NT (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, sandybridge)

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs testsUnit tests are required for this changeparallelismParallel or distributed computation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions