yangwwei opened a new pull request #235:
URL: https://github.com/apache/incubator-yunikorn-core/pull/235


   The data race happens 
[here](https://github.com/apache/incubator-yunikorn-core/blob/5471d84cd619dc9b6c40e970b0e9d53aa3f8e07f/pkg/scheduler/objects/sorters.go#L84):
 
   
   ```
   func filterOnPendingResources(apps map[string]*Application) []*Application {
     ////
     if resources.StrictlyGreaterThanZero(app.GetPendingResource())
     ////
   ```
   
   this is because, at the same time, the app is being updated by adding an 
ask. this updates the `pending` resource of this app, which is a pointer 
`*resources.Resource`. And above code will read `app.pending` without holding 
app's RLock. 
   
   ```
   func (sa *Application) AddAllocationAsk(ask *AllocationAsk) error {
      ...
      // Update total pending resource
      delta.SubFrom(oldAskResource)
      sa.pending.AddTo(delta)
      sa.queue.incPendingResource(delta)
     ....
   }
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to