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

SharedArray(Void, 1) errors #17047

Closed
mauro3 opened this issue Jun 21, 2016 · 6 comments · Fixed by #17067
Closed

SharedArray(Void, 1) errors #17047

mauro3 opened this issue Jun 21, 2016 · 6 comments · Fixed by #17067

Comments

@mauro3
Copy link
Contributor

mauro3 commented Jun 21, 2016

SharedArray(Void, 1) errors on 0.5:

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.0-dev+4754 (2016-06-14 05:04 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit dab5c8d* (7 days old master)
|__/                   |  x86_64-pc-linux-gnu

julia> SharedArray(Void, 1)
ERROR: BoundsError: attempt to access 0-element Array{Void,1} at index [1:1]
 in throw_boundserror(::Array{Void,1}, ::Tuple{UnitRange{Int64}}) at ./abstractarray.jl:281
 in checkbounds at ./abstractarray.jl:290 [inlined]
 in sub at ./subarray.jl:121 [inlined]
 in sub_1dim(::SharedArray{Void,1}, ::Int64) at ./sharedarray.jl:329
 in init_loc_flds(::SharedArray{Void,1}) at ./sharedarray.jl:341
 in initialize_shared_array(::SharedArray{Void,1}, ::Array{Void,1}, ::Bool, ::Bool, ::Array{Int64,1}) at ./sharedarray.jl:200
 in #SharedArray#446(::Bool, ::Array{Int64,1}, ::Type{T}, ::Type{T}, ::Tuple{Int64}) at ./sharedarray.jl:100
 in #SharedArray#451(::Array{Any,1}, ::Type{T}, ::Type{T}, ::Int64, ::Vararg{Int64,N}) at ./sharedarray.jl:111
 in SharedArray{T,N}(::Type{T}, ::Int64) at ./sharedarray.jl:111
 in eval(::Module, ::Any) at ./boot.jl:225
 in macro expansion at ./REPL.jl:92 [inlined]
 in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:46

and 0.4:

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.6 (2016-06-19 17:16 UTC)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |  x86_64-pc-linux-gnu

julia> SharedArray(Void, 1)
ERROR: ArgumentError: requested size must be > 0, got 0
 in tryparse_internal at ./parse.jl:118
 in tryparse_internal at ./parse.jl:136
 in parse at parse.jl:146
 in print_shmem_limits at sharedarray.jl:463
 in shm_mmap_array at sharedarray.jl:490
 in __SharedArray#138__ at sharedarray.jl:58
 in SharedArray at sharedarray.jl:117
@amitmurthy
Copy link
Contributor

The size of the required shmem segment is calculated by multiplying the size of the element type with the size of the array.

The issue is isbits(Void) is true and sizeof(Void) is 0.

We should probably not allow shared arrays of type Void.

@mauro3
Copy link
Contributor Author

mauro3 commented Jun 22, 2016

Note, all other singleton immutables also have this property too (and throw the same errors).

For generic programming it would be nice to have this work, although special casing is not the end of the world. But for sure, a better error message.

@amitmurthy
Copy link
Contributor

Yes, for zero sized types, we shouldn't actually create and map any segment but just have local arrays of the requested type. Should work.

@mauro3
Copy link
Contributor Author

mauro3 commented Jun 23, 2016

Thanks! Could this be back-ported?

@amitmurthy
Copy link
Contributor

Marking it for back-porting though I don't know if are going to have a 0.4.7 anytime soon.

@amitmurthy
Copy link
Contributor

Marking it on the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants