[ 
https://issues.apache.org/jira/browse/SLIDER-1156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15381989#comment-15381989
 ] 

ASF subversion and git services commented on SLIDER-1156:
---------------------------------------------------------

Commit 8e80ed131359626a78eb3be5008408c3d4dcf073 in incubator-slider's branch 
refs/heads/develop from [~ste...@apache.org]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-slider.git;h=8e80ed1 ]

SLIDER-1156: outstanding request tracker edits a map while iterating over it. 
Fix had to turn off disk space checking in minidfs clusters...my laptop has run 
out of HDD space


> OutstandingRequestTracker edits map while iterating over it's entries
> ---------------------------------------------------------------------
>
>                 Key: SLIDER-1156
>                 URL: https://issues.apache.org/jira/browse/SLIDER-1156
>             Project: Slider
>          Issue Type: Bug
>          Components: other
>    Affects Versions: Slider 0.91
>            Reporter: Gour Saha
>            Assignee: Steve Loughran
>             Fix For: Slider 1.0.0
>
>
> The following error report is provided by coverity scan report on below 
> method in OutstandingRequestTracker.java -
> {code}
> 398  @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
> 399  public synchronized List<AbstractRMOperation> 
> cancelOutstandingAARequests() {
> 400
> 401    log.debug("Looking for AA request to cancel");
> 402    List<AbstractRMOperation> operations = new ArrayList<>();
> 403
> 404    // first, all placed requests
>       1. return_collection_alias: Call to entrySet returns an Iterable 
> equivalent to placedRequests.
>       2. enhanced_for: Starting an iteration on placedRequests.entrySet().
>       3. Iterating over another element of placedRequests.entrySet()
>       
> CID 120071 (#1 of 1): Using invalid iterator (INVALIDATE_ITERATOR)
> 7. invalid_loop: Attempting to obtain another element from 
> placedRequests.entrySet() after it's been modified.
> 405    for (Map.Entry<RoleHostnamePair, OutstandingRequest> entry : 
> placedRequests.entrySet()) {
> 406      OutstandingRequest outstandingRequest = entry.getValue();
> 407      synchronized (outstandingRequest) {
>       4. Condition outstandingRequest.isAntiAffine(), taking true branch
> 408        if (outstandingRequest.isAntiAffine()) {
> 409          // time to escalate
> 410          operations.add(outstandingRequest.createCancelOperation());
>       5. modify_iterable: Call to remove modifies Iterable placedRequests 
> which invalidates the iterator for the loop on placedRequests.entrySet().
> 411          placedRequests.remove(entry.getKey());
> 412        }
> 413      }
>       6. Jumping back to the beginning of the loop
> 414    }
> 415    // second, all open requests
> 416    ListIterator<OutstandingRequest> orit = openRequests.listIterator();
> 417    while (orit.hasNext()) {
> 418      OutstandingRequest outstandingRequest =  orit.next();
> 419      synchronized (outstandingRequest) {
> 420        if (outstandingRequest.isAntiAffine()) {
> 421          // time to escalate
> 422          operations.add(outstandingRequest.createCancelOperation());
> 423          orit.remove();
> 424        }
> 425      }
> 426    }
> 427    log.info("Cancelling {} outstanding AA requests", operations.size());
> 428
> 429    return operations;
> 430  }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to