# Problem saving SharedArrays with JLD type

**URL:** <https://discourse.julialang.org/t/problem-saving-sharedarrays-with-jld-type/44754>\
**Category:** General Usage\
**Created:** [August 11, 2020, 6:09pm UTC](https://discourse.julialang.org/t/problem-saving-sharedarrays-with-jld-type/44754 "2020-08-11T18:09:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gideonsimpson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gideonsimpson/32/1928_2.png) [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Post date:** [August 11, 2020, 6:09pm UTC](https://discourse.julialang.org/t/problem-saving-sharedarrays-with-jld-type/44754/1 "2020-08-11T18:09:45Z")

</div>

I’ve got the following issue. I generate data using the `Distributed` module, storing it in a `SharedArray`, and then dumping it to disk via `FileIO.` The problem I have is that if I save it as `.jld` when I try to load back in, I am getting the following error:

```julia
┌ Warning: type Distributed.RRID not present in workspace; reconstructing
└ @ JLD /Users/guardian/.julia/packages/JLD/jeGJb/src/jld_types.jl:697
Error encountered while loading "/Users/guardian/.myfile.jld".

Fatal error:

stored type SharedArrays.SharedArray{Core.Float64,2} does not match currently loaded type

Stacktrace:
 [1] handle_error(::JLD.TypeMismatchException, ::File{DataFormat{:JLD}}) at /Users/guardian/.julia/packages/FileIO/zL0JE/src/error_handling.jl:82
 [2] handle_exceptions(::Array{Any,1}, ::String) at /Users/guardian/.julia/packages/FileIO/zL0JE/src/error_handling.jl:77
 [3] load(::FileIO.Formatted; options::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}}) at /Users/guardian/.julia/packages/FileIO/zL0JE/src/loadsave.jl:189
 [4] load at /Users/guardian/.julia/packages/FileIO/zL0JE/src/loadsave.jl:166 [inlined]
 [5] #load#13 at /Users/guardian/.julia/packages/FileIO/zL0JE/src/loadsave.jl:118 [inlined]
 [6] load(::String) at /Users/guardian/.julia/packages/FileIO/zL0JE/src/loadsave.jl:118
 [7] top-level scope at In[2]:8
 [8] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091

```

In contrast, if I save as `.jld2` (which I know is deprecated/abandoned), there is no issue. How can I correct this in the JLD format so as to maintain longterm support?

---

<div class="post-metadata">

**Author:** ![js135005](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/js135005/32/8219_2.png) [@js135005](https://discourse.julialang.org/u/js135005)\
**Post date:** [August 11, 2020, 6:45pm UTC](https://discourse.julialang.org/t/problem-saving-sharedarrays-with-jld-type/44754/2 "2020-08-11T18:45:12Z")

</div>

My current understanding is that JLD2 is being actively maintained again despite the warning on the repo. I hope so because I moved some code from JLD to JLD2 quite some time ago and do not wish to make another change.

---

<div class="post-metadata">

**Author:** ![oskar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oskar/32/12494_2.png) [@oskar](https://discourse.julialang.org/u/oskar)\
**Post date:** [November 24, 2020, 4:53pm UTC](https://discourse.julialang.org/t/problem-saving-sharedarrays-with-jld-type/44754/3 "2020-11-24T16:53:00Z")

</div>

I always saved SharedArrays using JLD and it (suddenly) gave me the same error.  
Uncommenting lines 723-725 of jld\_types.jl solved it for me.

I.e. uncomment these lines:

```julia
# if T !== Expr # in julia >= 0.7 Expr has 1 fewer fields; the trailing field can be ignored.
# dtype == newtype || throw(TypeMismatchException(typename))
# end

```

I tried to print out dtype and newtype and they are identical, I don’t know why it thinks they are not…

---

<div class="post-metadata">

**Author:** ![oskar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oskar/32/12494_2.png) [@oskar](https://discourse.julialang.org/u/oskar)\
**Post date:** [November 24, 2020, 5:10pm UTC](https://discourse.julialang.org/t/problem-saving-sharedarrays-with-jld-type/44754/4 "2020-11-24T17:10:32Z")

</div>

Actually this [#281](https://github.com/JuliaIO/JLD.jl/issues/281) solves it. Just need to upgrade HDF5 to v13.7 or downgrade HDF5\_jll to v1.10.5
