Skip to content

Commit 3f36862

Browse files
committed
Daemon - further work attempting to stop CI Linux servers hanging when running api tests
1 parent b1889b8 commit 3f36862

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

app/server/ruby/bin/daemon.rb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def wait
438438

439439
def kill
440440

441-
if process_running?
441+
if process_running? && @pid
442442
Util.log "Process Booter - killing #{@cmd} with pid #{@pid} and args #{@args.inspect}, wait_thr status: #{@wait_thr}, #{@wait_thr.status}"
443443

444444
unless Util.os == :windows
@@ -489,9 +489,16 @@ def kill
489489
Util.log "Process Booter - no need to kill #{@cmd} with pid #{@pid} and args #{@args.inspect} - already terminated, wait_thr status: #{@wait_thr}, #{@wait_thr.status}"
490490
end
491491

492+
493+
unless @pid
494+
Util.log "Process Booter - Unfortunately we don't have a @pid for #{@cmd} with args #{@args.inspect}. wait_thr: #{@wait_thr}"
495+
end
496+
492497
@io_thr.kill if @io_thr
493498
@log_file.close if @log_file
499+
494500
end
501+
495502
end
496503

497504

@@ -612,7 +619,12 @@ def process_running?
612619
end
613620

614621
def kill
615-
@pid = @tau_pid.get
622+
begin
623+
@pid = @tau_pid.get(30)
624+
rescue SonicPi::PromiseTimeoutError
625+
@pid = nil
626+
Util.log "Didn't receive Tau's Pid after waiting for 30s..."
627+
end
616628
@tau_comms_thread.kill
617629
super
618630
end
@@ -938,7 +950,6 @@ def find_free_port
938950
@last_free_port
939951
end
940952
end
941-
942953
end
943954
end
944955

0 commit comments

Comments
 (0)