jacksonwilliams / arsenalsuite

Automatically exported from code.google.com/p/arsenalsuite
GNU General Public License v2.0
1 stars 0 forks source link

Max (job) assignment per host occasionally unreliable #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set the 'Max Assignments' for a specific host (under 'Host Info') to 1
2. Submit a job to this specific host only - the job should be a shell
script sleeping for a few seconds

What is the expected output? What do you see instead?
There should always only be one task getting processed at a time.
But occasionally two tasks will get assigned at once.

Possible issue:
There is a race condition between the job assignment and the host selection.
As the job gets assigned it decrements the 'activeassignmentcount' value in
the hoststatus table via a trigger. The manager loop will keep looking for
available hosts for waiting tasks, so it potentially picks the same host
since the trigger has not yet decremented the 'activeassignmentcount'.

To be investigated further.

Original issue reported on code.google.com by jmuenzner on 8 Apr 2010 at 4:50

GoogleCodeExporter commented 9 years ago
There was no race condition.

The jobassignment_insert_trigger function was called before inserting the
jobassignment row. So at that point it would update the hoststatus
activeassignmentcount to 0 although it should be 1.

This was fixed by putting the update_host_assignment_count call into a 
_after_insert
trigger.

Original comment by jmuenzner on 15 Apr 2010 at 2:48