mirror of
https://github.com/yusufipk/dikte.git
synced 2026-09-11 10:56:10 +00:00
Take the process with a start that goes wrong
_wait_ready can raise rather than return, and the process it was waiting on is ours with nothing else holding a reference to it. Leaving it running leaks a loaded model with nobody left to ask it anything, which is the whole failure this class is careful about everywhere else. Found by two stand-in servers still running after a test run.
This commit is contained in:
@@ -509,6 +509,22 @@ class Servers(Local):
|
||||
def test_no_pid_file_is_nothing_to_sweep(self):
|
||||
self.assertFalse(self.server().sweep())
|
||||
|
||||
def test_a_start_that_goes_wrong_takes_its_process_with_it(self):
|
||||
started = []
|
||||
|
||||
def explode(inner, proc, port):
|
||||
started.append(proc)
|
||||
raise RuntimeError("something in the wait went wrong")
|
||||
|
||||
self.patch_attr(ggml.Server, "_wait_ready", explode)
|
||||
server = self.server()
|
||||
with self.assertRaises(RuntimeError):
|
||||
server.serve()
|
||||
# Nothing else holds a reference to it, so leaving it running would leak
|
||||
# a loaded model with nobody left to ask it anything.
|
||||
self.assertIsNotNone(started[0].poll())
|
||||
self.assertFalse(server.sweep()) # and the pid file went with it
|
||||
|
||||
|
||||
class Arguments(Local):
|
||||
"""What the two command lines say, since neither program is here to say it."""
|
||||
|
||||
Reference in New Issue
Block a user