You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2019/11/26 14:42:20 UTC

[qpid-dispatch] branch master updated: DISPATCH-1492 - Prevent router crash when senders connect to edge listeners on interior routers. This closes #629.

This is an automated email from the ASF dual-hosted git repository.

gmurthy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/master by this push:
     new bab6dbc  DISPATCH-1492 - Prevent router crash when senders connect to edge listeners on interior routers. This closes #629.
bab6dbc is described below

commit bab6dbc6a0a5cdf0aa52566c5512ddd401547546
Author: Ganesh Murthy <gm...@apache.org>
AuthorDate: Fri Nov 22 14:36:53 2019 -0500

    DISPATCH-1492 - Prevent router crash when senders connect to edge listeners on interior routers. This closes #629.
---
 .../edge_addr_tracking/edge_addr_tracking.c        | 15 ++++++----
 tests/system_tests_edge_router.py                  | 32 ++++++++++++++++++++++
 2 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/src/router_core/modules/edge_addr_tracking/edge_addr_tracking.c b/src/router_core/modules/edge_addr_tracking/edge_addr_tracking.c
index c76e3d3..c89a9cf 100644
--- a/src/router_core/modules/edge_addr_tracking/edge_addr_tracking.c
+++ b/src/router_core/modules/edge_addr_tracking/edge_addr_tracking.c
@@ -334,12 +334,15 @@ static void on_link_event(void *context, qdrc_event_t event, qdr_link_t *link)
             qdr_address_t *addr = link->owning_addr;
             if (addr && qdr_address_is_mobile_CT(addr) && DEQ_SIZE(addr->subscriptions) == 0 && link->link_direction == QD_INCOMING) {
                 qdr_addr_endpoint_state_t *endpoint_state = qdrc_get_endpoint_state_for_connection(mc->endpoint_state_list, link->conn);
-                assert(endpoint_state);
-                assert(link->edge_context == 0);
-                link->edge_context = endpoint_state;
-                endpoint_state->ref_count++;
-                if (qdrc_can_send_address(addr, link->conn)) {
-                    qdrc_send_message(mc->core, addr, endpoint_state->endpoint, true);
+                // Fix for DISPATCH-1492. Remove the assert(endpoint_state); and add an if condition check for endpoint_state
+                // We will not prevent regular endpoints from connecting to the edge listener for now.
+                if (endpoint_state) {
+                    assert(link->edge_context == 0);
+                    link->edge_context = endpoint_state;
+                    endpoint_state->ref_count++;
+                    if (qdrc_can_send_address(addr, link->conn)) {
+                        qdrc_send_message(mc->core, addr, endpoint_state->endpoint, true);
+                    }
                 }
             }
             break;
diff --git a/tests/system_tests_edge_router.py b/tests/system_tests_edge_router.py
index 3165cf2..a2238f4 100644
--- a/tests/system_tests_edge_router.py
+++ b/tests/system_tests_edge_router.py
@@ -2697,6 +2697,38 @@ class MobileAddressEventTest(MessagingHandler):
     def run(self):
         Container(self).run()
 
+class EdgeListenerSender(TestCase):
+
+    inter_router_port = None
+
+    @classmethod
+    def setUpClass(cls):
+        super(EdgeListenerSender, cls).setUpClass()
+
+        def router(name, mode, connection, extra=None):
+            config = [
+                ('router', {'mode': mode, 'id': name}),
+                ('address',
+                 {'prefix': 'multicast', 'distribution': 'multicast'}),
+                connection
+            ]
+
+            config = Qdrouterd.Config(config)
+            cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
+
+        cls.routers = []
+
+        edge_port_A = cls.tester.get_port()
+        router('INT.A', 'interior',  ('listener', {'role': 'edge', 'port': edge_port_A}))
+        cls.routers[0].wait_ports()
+
+    # Without the fix for DISPATCH-1492, this test will fail because
+    # of the router crash.
+    def test_edge_listener_sender_crash_DISPATCH_1492(self):
+        addr = self.routers[0].addresses[0]
+        blocking_connection = BlockingConnection(addr)
+        blocking_sender = blocking_connection.create_sender(address="multicast")
+        self.assertTrue(blocking_sender!=None)
 
 if __name__== '__main__':
     unittest.main(main_module())


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