File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -266,7 +266,7 @@ def migrate( pid )
266
266
end
267
267
268
268
# Send the migration request (bump up the timeout to 60 seconds)
269
- response = client . send_request ( request , 60 )
269
+ client . send_request ( request , 60 )
270
270
271
271
if client . passive_service
272
272
# Sleep for 5 seconds to allow the full handoff, this prevents
@@ -282,12 +282,25 @@ def migrate( pid )
282
282
# Now communicating with the new process
283
283
###
284
284
285
- # Renegotiate SSL over this socket
286
- client . swap_sock_ssl_to_plain ( )
287
- client . swap_sock_plain_to_ssl ( )
285
+ # If renegotiation takes longer than a minute, it's a pretty
286
+ # good bet that migration failed and the remote side is hung.
287
+ # Since we have the comm_mutex here, we *must* release it to
288
+ # keep from hanging the packet dispatcher thread, which results
289
+ # in blocking the entire process. See Redmine #8794
290
+ begin
291
+ Timeout . timeout ( 60 ) do
292
+ # Renegotiate SSL over this socket
293
+ client . swap_sock_ssl_to_plain ( )
294
+ client . swap_sock_plain_to_ssl ( )
295
+ end
296
+ rescue TimeoutError
297
+ client . alive = false
298
+ return false
299
+ end
288
300
289
301
# Restart the socket monitor
290
302
client . monitor_socket
303
+
291
304
end
292
305
end
293
306
You can’t perform that action at this time.
0 commit comments