From e9a336a34473113df2186ae16a38ec7b6baddcd8 Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Fri, 7 Oct 2016 12:31:57 -0700 Subject: [PATCH] Fix incorrect free. (#9) --- photon_scheduler.c | 1 - test/test.py | 12 +++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/photon_scheduler.c b/photon_scheduler.c index b876bc9f2..1ce5fb916 100644 --- a/photon_scheduler.c +++ b/photon_scheduler.c @@ -74,7 +74,6 @@ void handle_submit_task(local_scheduler_state *s, task_spec *task) { (uint8_t *)task); /* Remove the available worker from the queue and free the struct. */ utarray_pop_back(s->available_worker_queue); - free(worker); } else { /* Add the task to the task queue. This passes ownership of the task queue. * And the task will be freed when it is assigned to a worker. */ diff --git a/test/test.py b/test/test.py index 1d4cbc5af..2db6df314 100644 --- a/test/test.py +++ b/test/test.py @@ -43,7 +43,7 @@ class TestPhotonClient(unittest.TestCase): os._exit(self.p2.returncode) else: self.p2.kill() - + def test_submit_and_get_task(self): # TODO(rkn): This should be a FunctionID. @@ -94,6 +94,16 @@ class TestPhotonClient(unittest.TestCase): else: self.assertEqual(args[i], retrieved_args[i]) + # Submit all of the tasks. + for args in args_list: + for num_return_vals in [0, 1, 2, 3, 5, 10, 100]: + task = photon.Task(function_id, args, num_return_vals) + self.photon_client.submit(task) + # Get all of the tasks. + for args in args_list: + for num_return_vals in [0, 1, 2, 3, 5, 10, 100]: + new_task = self.photon_client.get_task() + if __name__ == "__main__": if len(sys.argv) > 1: # pop the argument so we don't mess with unittest's own argument parser