132
132
testf (id_me)
133
133
testf (id_other)
134
134
135
+ function loop_until_false (f:: Function ; timeout_seconds:: Integer = 60 )
136
+ start_time = time_ns ()
137
+ while f () != false
138
+ sleep (1 )
139
+ if ( ( time_ns () - start_time )/ 1e9 ) > timeout_seconds
140
+ @error " Timed out" timeout_seconds
141
+ return nothing
142
+ end
143
+ end
144
+ return nothing
145
+ end
146
+
135
147
# Distributed GC tests for Futures
136
148
function test_futures_dgc (id)
137
149
f = remotecall (myid, id)
@@ -143,16 +155,17 @@ function test_futures_dgc(id)
143
155
@test fetch (f) == id
144
156
@test f. v != = nothing
145
157
yield (); # flush gc msgs
158
+ loop_until_false (() -> remotecall_fetch (k-> (yield ();haskey (Distributed. PGRP. refs, k)), id, fid))
146
159
@test remotecall_fetch (k-> (yield ();haskey (Distributed. PGRP. refs, k)), id, fid) == false
147
160
148
-
149
161
# if unfetched, it should be deleted after a finalize
150
162
f = remotecall (myid, id)
151
163
fid = remoteref_id (f)
152
164
@test remotecall_fetch (k-> (yield ();haskey (Distributed. PGRP. refs, k)), id, fid) == true
153
165
@test f. v === nothing
154
166
finalize (f)
155
167
yield (); # flush gc msgs
168
+ loop_until_false (() -> remotecall_fetch (k-> (yield ();haskey (Distributed. PGRP. refs, k)), id, fid))
156
169
@test remotecall_fetch (k-> (yield ();haskey (Distributed. PGRP. refs, k)), id, fid) == false
157
170
end
158
171
@@ -243,6 +256,7 @@ function test_remoteref_dgc(id)
243
256
@test remotecall_fetch (k-> (yield ();haskey (Distributed. PGRP. refs, k)), id, rrid) == true
244
257
finalize (rr)
245
258
yield (); # flush gc msgs
259
+ loop_until_false (() -> remotecall_fetch (k-> (yield ();haskey (Distributed. PGRP. refs, k)), id, rrid))
246
260
@test remotecall_fetch (k-> (yield ();haskey (Distributed. PGRP. refs, k)), id, rrid) == false
247
261
end
248
262
test_remoteref_dgc (id_me)
0 commit comments