You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/11/16 20:32:00 UTC

[jira] [Commented] (DISPATCH-2065) AttributeError: 'DeleteConnectionWithReceiver' object has no attribute 'n_sent'

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

ASF GitHub Bot commented on DISPATCH-2065:
------------------------------------------

kgiusti commented on a change in pull request #1420:
URL: https://github.com/apache/qpid-dispatch/pull/1420#discussion_r750632336



##########
File path: tests/system_tests_two_routers.py
##########
@@ -470,19 +497,17 @@ def on_message(self, event):
                                 'adminStatus': 'deleted'}
                             request.reply_to = self.mgmt_receiver_1.remote_source.address
                             self.mgmt_sender.send(request)
+                            self.n_sent += 1
         elif event.receiver == self.mgmt_receiver_1:
+            self.n_received += 1
             if event.message.properties['statusDescription'] == 'OK' and event.message.body['adminStatus'] == 'deleted':

Review comment:
       I would argue if this response is not OK and deleted the test should immediately fail.

##########
File path: tests/system_tests_two_routers.py
##########
@@ -439,16 +447,35 @@ def bail(self, error):
 
     def on_link_opened(self, event):
         if event.receiver == self.mgmt_receiver:
+            self.mgmt_receiver_link_opened = True
+        elif event.receiver == self.mgmt_receiver_1:
+            self.mgmt_receiver_1_link_opened = True
+        elif event.receiver == self.mgmt_receiver_2:
+            self.mgmt_receiver_2_link_opened = True
+

Review comment:
       shouldn't this check also ensure that "receiver_to_kill" link is also opened?  That ensures the "connection_to_kill" exists before the testing starts.

##########
File path: tests/system_tests_two_routers.py
##########
@@ -470,19 +497,17 @@ def on_message(self, event):
                                 'adminStatus': 'deleted'}
                             request.reply_to = self.mgmt_receiver_1.remote_source.address
                             self.mgmt_sender.send(request)
+                            self.n_sent += 1

Review comment:
       If you add the additional check to wait for "receiver_to_kill", then the test should immediately fail if this loop exits without finding the connection to delete.

##########
File path: tests/system_tests_two_routers.py
##########
@@ -409,6 +409,14 @@ def __init__(self, address):
         self.mgmt_sender = None
         self.success = False
         self.error = None
+        self.receiver_to_kill = None
+        self.timer = None
+        self.n_sent = 0
+        self.n_received = 0
+        self.mgmt_receiver_link_opened = False
+        self.mgmt_receiver_1_link_opened = False
+        self.mgmt_receiver_2_link_opened = False
+        self.query_timer = None
 
     def on_start(self, event):
         self.timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))

Review comment:
       Sorry but github won't let me comment on line 438:
   The timeout(self) method should not simply close self.mgmt_conn - it should call self.bail() with the given error message

##########
File path: tests/system_tests_two_routers.py
##########
@@ -439,16 +447,35 @@ def bail(self, error):
 

Review comment:
       bail() needs to cancel the query timer as well if it is not None

##########
File path: tests/system_tests_two_routers.py
##########
@@ -470,19 +497,17 @@ def on_message(self, event):
                                 'adminStatus': 'deleted'}
                             request.reply_to = self.mgmt_receiver_1.remote_source.address
                             self.mgmt_sender.send(request)
+                            self.n_sent += 1
         elif event.receiver == self.mgmt_receiver_1:
+            self.n_received += 1
             if event.message.properties['statusDescription'] == 'OK' and event.message.body['adminStatus'] == 'deleted':
-                request = Message()
-                request.address = "amqp:/_local/$management"
-                request.properties = {'type': 'org.apache.qpid.dispatch.connection',
-                                      'operation': 'QUERY'}
-                request.reply_to = self.mgmt_receiver_2.remote_source.address
-                self.mgmt_sender.send(request)
+                # Wait for 3 sends for the connection to be gone completely.
+                self.query_timer = event.reactor.schedule(3.0, PollTimeout(self))
 
         elif event.receiver == self.mgmt_receiver_2:
+            self.n_received += 1
             attribute_names = event.message.body['attributeNames']
             property_index = attribute_names .index('properties')
-            identity_index = attribute_names .index('identity')
 
             for result in event.message.body['results']:
                 if result[property_index]:

Review comment:
       If you're super paranoid (like me) and assume that CI will be sadistically slow (it will be), instead of calling bail() on line 516, you'd re-schedule the query_timer and try again.  If the connection never gets deleted then the test will fail when the TIMEOUT timer expires.




-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> AttributeError: 'DeleteConnectionWithReceiver' object has no attribute 'n_sent'
> -------------------------------------------------------------------------------
>
>                 Key: DISPATCH-2065
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-2065
>             Project: Qpid Dispatch
>          Issue Type: Test
>          Components: Tests
>    Affects Versions: 1.15.0
>            Reporter: Jiri Daněk
>            Priority: Minor
>             Fix For: 1.18.0
>
>
> https://github.com/apache/qpid-dispatch/pull/1052/checks?check_run_id=2394806073#step:9:2728
> The stacktrace below is caused by a copy-paste error. The test object does not have the attributes that are accessed.
> Furthermore, the test output does not provide any useful diagnostics in its output to investigate why the timeout happened.
> {noformat}
> 34: ======================================================================
> 34: ERROR: test_21_delete_connection_with_receiver (system_tests_two_routers.TwoRouterTest)
> 34: ----------------------------------------------------------------------
> 34: Traceback (most recent call last):
> 34:   File "/home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/tests/system_tests_two_routers.py", line 377, in test_21_delete_connection_with_receiver
> 34:     test.run()
> 34:   File "/home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/tests/system_tests_two_routers.py", line 496, in run
> 34:     Container(self).run()
> 34:   File "/opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/proton/_reactor.py", line 182, in run
> 34:     while self.process():
> 34:   File "/opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/proton/_reactor.py", line 240, in process
> 34:     event.dispatch(handler)
> 34:   File "/opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/proton/_events.py", line 162, in dispatch
> 34:     _dispatch(handler, type.method, self)
> 34:   File "/opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/proton/_events.py", line 123, in _dispatch
> 34:     m(*args)
> 34:   File "/home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/tests/system_test.py", line 1327, in on_timer_task
> 34:     self.parent.timeout()
> 34:   File "/home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/tests/system_tests_two_routers.py", line 432, in timeout
> 34:     self.error = "Timeout Expired: sent=%d, received=%d" % (self.n_sent, self.n_received)
> 34: AttributeError: 'DeleteConnectionWithReceiver' object has no attribute 'n_sent'
> 34: 
> 34: ----------------------------------------------------------------------
> 34: Ran 32 tests in 124.158s
> 34: 
> 34: FAILED (errors=1)
> 34: 
> 18/37 Test #34: system_tests_two_routers ..........................***Failed  124.31 sec
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org