Details
-
Sub-task
-
Status: Patch Available
-
Major
-
Resolution: Unresolved
-
3.0.0
-
None
-
None
-
Patch
Description
FSStarvedApps is not thread safe, this may make one starve app is processed for two times continuously.
For example, when app1 is fair share starved, it has been added to appsToProcess. After that, app1 is taken but appBeingProcessed is not yet update to app1. At the moment, app1 is starved by min share, so this app is added to appsToProcess again! Because appBeingProcessed is null and appsToProcess also have not this one.
void addStarvedApp(FSAppAttempt app) { if (!app.equals(appBeingProcessed) && !appsToProcess.contains(app)) { appsToProcess.add(app); } } FSAppAttempt take() throws InterruptedException { // Reset appBeingProcessed before the blocking call appBeingProcessed = null; // Blocking call to fetch the next starved application FSAppAttempt app = appsToProcess.take(); appBeingProcessed = app; return app; }