Skip to content

Commit

Permalink
Merge pull request #43398 from krynju/kr/distributed-remote-fetch-fix
Browse files Browse the repository at this point in the history
[Distributed] Return value obtained from `call_on_owner` directly
  • Loading branch information
Sacha0 authored Dec 11, 2021
2 parents 524bca4 + 4b97df7 commit 4d1bf0b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
10 changes: 9 additions & 1 deletion stdlib/Distributed/src/remotecall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,15 @@ function fetch(r::Future)
# why? local put! performs caching and putting into channel under r.lock

# for local put! use the cached value, for call_on_owner cases just take the v_local as it was just cached in r.v
v_cache = status ? v_local : v_old

# remote calls getting the value from `call_on_owner` used to return the value directly without wrapping it in `Some(x)`
# so we're doing the same thing here
if status
send_del_client(r)
return v_local
else # this `v_cache` is returned at the end of the function
v_cache = v_old
end
end

send_del_client(r)
Expand Down
10 changes: 10 additions & 0 deletions stdlib/Distributed/test/distributed_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,16 @@ v15406 = remotecall_wait(() -> 1, id_other)
fetch(v15406)
remotecall_wait(fetch, id_other, v15406)


# issue #43396
# Covers the remote fetch where the value returned is `nothing`
# May be caused by attempting to unwrap a non-`Some` type with `something`
# `call_on_owner` ref fetches return values not wrapped in `Some`
# and have to be returned directly
@test nothing === fetch(remotecall(() -> nothing, workers()[1]))
@test 10 === fetch(remotecall(() -> 10, workers()[1]))


# Test various forms of remotecall* invocations

@everywhere f_args(v1, v2=0; kw1=0, kw2=0) = v1+v2+kw1+kw2
Expand Down

2 comments on commit 4d1bf0b

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here.

Please sign in to comment.