JuliaLang / JuliaLang/Distributed.jl
remotecall_fetch vulnerable to hash collisions?
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 55
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
I've bumped into this behavior by accident after defining hash incorrectly for arrays. I'm absolutely not sure it indicates a bug, but I figured I'd better report it since this kind of exceptional situation is rarely tested.
It appears that when hash collisions happen, remotecall_fetch is not able to detect that the contents of an array have been updated. This can easily be reproduced by always returning the same hash for all arrays. This is surprising to me, as I would have expected that differing hashes are sufficient, but not necessary, to consider that two arrays are different, i.e. that isequal would always be called to check for hash collisions.
julia> using Distributed
julia> Base.hash(::AbstractArray, ::UInt) = zero(UInt)
julia> x = [1]
1-element Array{Int64,1}:
1
julia> remotecall_fetch(()->x, 2)
1-element Array{Int64,1}:
1
julia> x[1] = 2
2
julia> remotecall_fetch(()->x, 2) # Woops, not updated
1-element Array{Int64,1}:
1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Distributed.jl implementation of remotecall_fetch and reproduce the provided Julia session with deliberately colliding array hashes. Trace how repeated calls determine whether a value has changed. Done means the collision behavior is resolved or clarified, with a regression test covering the shown sequence if it is confirmed as a bug.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100