Mmap error on windows

Hello,

I am using SharedArrays to accumulate matrices that have been generated by different worker processes in my package Circuitscape. However, on windows, when I run the tests, I get:

Got exception outside of a @test
  could not create mapping view: The operation completed successfully.
  Stacktrace:
   [1] error(::String) at .\error.jl:33
   [2] #mmap#1(::Bool, ::Bool, ::Function, ::Mmap.Anonymous, ::Type{Array{Float64,2}}, ::Tuple{Int64,Int64}, ::Int64) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Mmap\src\Mmap.jl:221
   [3] mmap(::Mmap.Anonymous, ::Type{Array{Float64,2}}, ::Tuple{Int64,Int64}, ::Int64) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Mmap\src\Mmap.jl:186
   [4] _shm_mmap_array(::Type, ::Tuple{Int64,Int64}, ::String, ::UInt16) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\SharedArrays\src\SharedArrays.jl:660
   [5] shm_mmap_array(::Type, ::Tuple{Int64,Int64}, ::String, ::UInt16) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\SharedArrays\src\SharedArrays.jl:639
   [6] #call#3(::Bool, ::Array{Int64,1}, ::Type{SharedArrays.SharedArray{Float64,2}}, ::Tuple{Int64,Int64}) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\SharedArrays\src\SharedArrays.jl:118
   [7] Type at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\SharedArrays\src\SharedArrays.jl:105 [inlined]
   [8] SharedArrays.SharedArray(::Array{Float64,2}) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\SharedArrays\src\SharedArrays.jl:347
   [9] initialize_cum_maps(::Array{Float64,2}, ::Bool) at C:\Users\ranjan\.julia\dev\Circuitscape\src\utils.jl:216
   [10] compute_graph_data_no_polygons(::Circuitscape.RasData{Float64,Int32}, ::Circuitscape.RasterFlags) at C:\Users\ranjan\.julia\dev\Circuitscape\src\raster\pairwise.jl:226
   [11] _pt_file_no_polygons_path(::Circuitscape.RasData{Float64,Int32}, ::Circuitscape.RasterFlags, ::Dict{String,String}) at C:\Users\ranjan\.julia\dev\Circuitscape\src\raster\pairwise.jl:60
   [12] raster_pairwise(::Type, ::Type, ::Dict{String,String}) at C:\Users\ranjan\.julia\dev\Circuitscape\src\raster\pairwise.jl:29
   [13] _compute(::Type, ::Type, ::Dict{String,String}) at C:\Users\ranjan\.julia\dev\Circuitscape\src\run.jl:42
   [14] compute_cholmod(::String, ::Int64) at C:\Users\ranjan\.julia\dev\Circuitscape\src\utils.jl:84
   [15] compute_cholmod at C:\Users\ranjan\.julia\dev\Circuitscape\src\utils.jl:75 [inlined]
   [16] macro expansion at .\logging.jl:311 [inlined]
   [17] macro expansion at C:\Users\ranjan\.julia\dev\Circuitscape\src\utils.jl:263 [inlined]
   [18] macro expansion at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Test\src\Test.jl:1083 [inlined]
   [19] macro expansion at C:\Users\ranjan\.julia\dev\Circuitscape\src\utils.jl:262 [inlined]
   [20] macro expansion at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Test\src\Test.jl:1083 [inlined]
   [21] runtests(::typeof(compute_cholmod)) at C:\Users\ranjan\.julia\dev\Circuitscape\src\utils.jl:260
   [22] top-level scope at C:\Users\ranjan\.julia\dev\Circuitscape\test\runtests.jl:12 [inlined]
   [23] top-level scope at .\none:0
   [24] include at .\boot.jl:317 [inlined]
   [25] include_relative(::Module, ::String) at .\loading.jl:1044
   [26] include(::Module, ::String) at .\sysimg.jl:29
   [27] include(::String) at .\client.jl:392
   [28] top-level scope at none:0
   [29] eval(::Module, ::Any) at .\boot.jl:319
   [30] macro expansion at .\logging.jl:317 [inlined]
   [31] exec_options(::Base.JLOptions) at .\client.jl:219
   [32] _start() at .\client.jl:425

Any ideas on how to debug this? I don’t have an MWE, the easiest way to reproduce is to run Pkg.test("Circuitscape") on Windows. There’s an issue filed here

Bumping the above.

Had the same issue in Windows. My guess it’s probably related to initializing a SharedArray. Also, in my case, this problem is not reproducible every time, roughly 50/50.