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

Robbie Gemmell edited comment on PROTON-685 at 9/15/14 2:51 PM:
----------------------------------------------------------------

The above commit contains a new Java test to highlight the issue and hopefully 
ensure it doesn't reoccurr.

Also attaching a python test I originally wrote whilst looking at the problem. 
It doesnt actually run against proton-j, because the python test shim is 
missing some bits:
{noformat}
proton.py", line 2470, in next
      return Session._wrap_session(pn_session_next(self._ssn, mask))
  NameError: global name 'pn_session_next' is not defined
{noformat}

However, if modified to do what I believed should still show the problem I was 
unable to make it do so, and it passed against proton-j without the commit made 
above to resolve the issue. Some hacky system.out logging shows this is because 
the free process simply doesnt work the same when running the tests via the 
python shim:
{noformat}
proton_tests.engine.FreeTest. \
    testFreeConnectionWithMultipleSessionsAndSendersAndReceivers ........
doFree'ing sender: org.apache.qpid.proton.engine.impl.SenderImpl@550661b8
doFree'ing above link: org.apache.qpid.proton.engine.impl.SenderImpl@550661b8
doFree'ing sender: org.apache.qpid.proton.engine.impl.SenderImpl@ce20c1e
doFree'ing above link: org.apache.qpid.proton.engine.impl.SenderImpl@ce20c1e
doFree'ing session: org.apache.qpid.proton.engine.impl.SessionImpl@38c07b1d
doFree'ing connection: 
org.apache.qpid.proton.engine.impl.ConnectionImpl@1eabbba2
{noformat}
vs. what was seen in the original Java usage:
{noformat}
doFree'ing connection: 
org.apache.qpid.proton.engine.impl.ConnectionImpl@41786b48
doFree'ing session: org.apache.qpid.proton.engine.impl.SessionImpl@5a9db582
doFree'ing sender: org.apache.qpid.proton.engine.impl.SenderImpl@c91673
doFree'ing above link: org.apache.qpid.proton.engine.impl.SenderImpl@c91673
2014-09-15 11:39:26,004 [ider$1@5ee74be7] - WARN  AmqpProvider                  
 - Caught Exception during update processing: null
java.util.ConcurrentModificationException
        at 
java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:711)
        at 
java.util.LinkedHashMap$LinkedValueIterator.next(LinkedHashMap.java:739)
        at 
org.apache.qpid.proton.engine.impl.SessionImpl.doFree(SessionImpl.java:107)
        at 
org.apache.qpid.proton.engine.impl.EndpointImpl.free(EndpointImpl.java:192)
        at 
org.apache.qpid.proton.engine.impl.ConnectionImpl.doFree(ConnectionImpl.java:196)
        at 
org.apache.qpid.proton.engine.impl.EndpointImpl.free(EndpointImpl.java:192)
    <snip>
{noformat}


was (Author: gemmellr):
The above commit contains a new Java test to highlight the issue and hopefully 
ensure it doesn't reoccurr.

Also attaching a python test I originally wrote whilst looking at the problem. 
It doesnt actually run against proton-j, because the python test shim is 
missing some bits:
{noformat}
proton.py", line 2470, in next
      return Session._wrap_session(pn_session_next(self._ssn, mask))
  NameError: global name 'pn_session_next' is not defined
{noformat}

However, if modified to do what I believed should still show the problem I was 
unable to make it do so, and it passed against proton-j without the commit made 
above to resolve the issue. Some hacky system.out logging shows this is because 
the free process simply doesnt work the same when running the tests via the 
python shim:
{noformat}
doFree'ing connection: 
org.apache.qpid.proton.engine.impl.ConnectionImpl@41786b48
doFree'ing session: org.apache.qpid.proton.engine.impl.SessionImpl@5a9db582
doFree'ing sender: org.apache.qpid.proton.engine.impl.SenderImpl@c91673
doFree'ing above link: org.apache.qpid.proton.engine.impl.SenderImpl@c91673
2014-09-15 11:39:26,004 [ider$1@5ee74be7] - WARN  AmqpProvider                  
 - Caught Exception during update processing: null
java.util.ConcurrentModificationException
        at 
java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:711)
        at 
java.util.LinkedHashMap$LinkedValueIterator.next(LinkedHashMap.java:739)
        at 
org.apache.qpid.proton.engine.impl.SessionImpl.doFree(SessionImpl.java:107)
        at 
org.apache.qpid.proton.engine.impl.EndpointImpl.free(EndpointImpl.java:192)
        at 
org.apache.qpid.proton.engine.impl.ConnectionImpl.doFree(ConnectionImpl.java:196)
        at 
org.apache.qpid.proton.engine.impl.EndpointImpl.free(EndpointImpl.java:192)
    <snip>
{noformat}
{noformat}
proton_tests.engine.FreeTest. \
    testFreeConnectionWithMultipleSessionsAndSendersAndReceivers ........
doFree'ing sender: org.apache.qpid.proton.engine.impl.SenderImpl@550661b8
doFree'ing above link: org.apache.qpid.proton.engine.impl.SenderImpl@550661b8
doFree'ing sender: org.apache.qpid.proton.engine.impl.SenderImpl@ce20c1e
doFree'ing above link: org.apache.qpid.proton.engine.impl.SenderImpl@ce20c1e
doFree'ing session: org.apache.qpid.proton.engine.impl.SessionImpl@38c07b1d
doFree'ing connection: 
org.apache.qpid.proton.engine.impl.ConnectionImpl@1eabbba2
{noformat}

> calling free() on session with multiple Sender or Receiver links leads to 
> ConcurrentModificationException
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: PROTON-685
>                 URL: https://issues.apache.org/jira/browse/PROTON-685
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: proton-j
>            Reporter: Robbie Gemmell
>            Assignee: Robbie Gemmell
>             Fix For: 0.8
>
>         Attachments: 
> 0003-PROTON-685-python-test-which-doesnt-run-against-prot.patch
>
>
> If a session (/parent connection) has free() called on it with multiple 
> Sender or Receiver links then a ConcurrentModificationException is thrown 
> during the process due to modifying a map whilst iterating its values.



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

Reply via email to