[
https://issues.apache.org/jira/browse/DISPATCH-749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15979966#comment-15979966
]
ASF GitHub Bot commented on DISPATCH-749:
-----------------------------------------
Github user pmoravec commented on the issue:
https://github.com/apache/qpid-dispatch/pull/160
This approach (deep copy of the list and calling `.remove`) might be
inefficient for long lists. If this can be an issue, some different approach
shall be used, e.g.:
while len(self.mobile_addresses)>0:
self.unmap_address(self.mobile_addresses[0])
> unmapping all link-routing addresses leaves half of addresses mapped
> --------------------------------------------------------------------
>
> Key: DISPATCH-749
> URL: https://issues.apache.org/jira/browse/DISPATCH-749
> Project: Qpid Dispatch
> Issue Type: Bug
> Components: Router Node
> Reporter: Pavel Moravec
> Assignee: Pavel Moravec
>
> Setup:
> qpidd < - > qdrouterd(S) < - > qdrouterd(C) < - clients
> where clients are link-routing via the qdrouterd network to qpidd.
> Under specific situations (see
> https://bugzilla.redhat.com/show_bug.cgi?id=1426242 for details), when
> qdrouterd(S) is not available for some time, qdrouterd(C) returns
> "qd:no-route-to-dest" to its clients - so far so good.
> But the error persists even after qdrouterd(S) is up, connected from
> qdrouterd(C), all links established and addresses mapped.
> The cause is,
> https://github.com/apache/qpid-dispatch/blob/master/python/qpid_dispatch_internal/router/node.py#L536-L537
> does _not_ unmap all addresses:
> {code}
> $ python
> Python 2.7.5 (default, Aug 2 2016, 04:20:16)
> [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> mobile_addresses = ['a.', 'b.', 'c.', 'd.']
> >>> for addr in mobile_addresses:
> ... mobile_addresses.remove(addr)
> ...
> >>> print mobile_addresses
> ['b.', 'd.']
> >>>
> {code}
> We can't iterate a list that way while removing items from it.
> Trivial fix allows so:
> {code}
> for addr in mobile_addresses[:]:
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]