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/21 14:28:29 UTC

[qpid-dispatch] branch master updated: DISPATCH-1485 - Setting limit=0 on qdstat means setting the limit to unlimited. Fixed infinite loop. This closes #622.

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 47d38c1  DISPATCH-1485 - Setting limit=0 on qdstat means setting the limit to unlimited. Fixed infinite loop. This closes #622.
47d38c1 is described below

commit 47d38c1720bd084aab150db03f5d0070b11ddc44
Author: Ganesh Murthy <gm...@apache.org>
AuthorDate: Tue Nov 19 16:08:30 2019 -0500

    DISPATCH-1485 - Setting limit=0 on qdstat means setting the limit to unlimited. Fixed infinite loop. This closes #622.
---
 python/qpid_dispatch/management/client.py      |  2 +-
 python/qpid_dispatch_internal/tools/command.py |  2 +-
 tests/system_tests_qdstat.py                   | 11 +++++++++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/python/qpid_dispatch/management/client.py b/python/qpid_dispatch/management/client.py
index 3fc8364..570a8b6 100644
--- a/python/qpid_dispatch/management/client.py
+++ b/python/qpid_dispatch/management/client.py
@@ -244,7 +244,7 @@ class Node(object):
         if offset is None:
             offset = 0
 
-        if count is None:
+        if count is None or count==0:
             # count has not been specified. For each request the
             # maximum number of rows we can get without proton
             # failing is MAX_ALLOWED_COUNT_PER_REQUEST
diff --git a/python/qpid_dispatch_internal/tools/command.py b/python/qpid_dispatch_internal/tools/command.py
index 55abb9f..bb98196 100644
--- a/python/qpid_dispatch_internal/tools/command.py
+++ b/python/qpid_dispatch_internal/tools/command.py
@@ -182,7 +182,7 @@ def _qdstat_parser(BusManager):
     # can be used in conjunction with options
     # like -c, -l, -a, --autolinks, --linkroutes and --log.
     # By default, the limit is not set, which means the limit is unlimited.
-    parser.add_argument("--limit", help="Limit number of output rows", type=int, default=None)
+    parser.add_argument("--limit", help="Limit number of output rows. Unlimited if limit is zero or if limit not specified", type=int, default=None)
 
     add_connection_options(parser)
     return parser
diff --git a/tests/system_tests_qdstat.py b/tests/system_tests_qdstat.py
index 9bee375..d3ec87d 100644
--- a/tests/system_tests_qdstat.py
+++ b/tests/system_tests_qdstat.py
@@ -241,6 +241,17 @@ class QdstatTest(system_test.TestCase):
 
         self.assertEqual(links, 500)
 
+        # DISPATCH-1485. Try to run qdstat with a limit=0. Without the fix for DISPATCH-1485
+        # this following command will hang and the test will fail.
+        outs = self.run_qdstat(['--links', '--limit=0'])
+        out_list = outs.split("\n")
+
+        links = 0
+        for out in out_list:
+            if "endpoint" in out and "examples" in out:
+                links += 1
+        self.assertEqual(links, COUNT*2)
+
 
         # This test would fail without the fix for DISPATCH-974
         outs = self.run_qdstat(['--address'])


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