You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2020/10/21 20:15:17 UTC

[qpid-dispatch] branch master updated: Revert "DISPATCH-1751: Rework how AMQP session incoming-window is derived"

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

chug 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 c1a7f59  Revert "DISPATCH-1751: Rework how AMQP session incoming-window is derived"
c1a7f59 is described below

commit c1a7f59baaf0ba5944074b3c9544732538b2e310
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Wed Oct 21 16:14:45 2020 -0400

    Revert "DISPATCH-1751: Rework how AMQP session incoming-window is derived"
    
    This reverts commit 7525ac665c3600805615c86796482914cdba783d.
---
 src/connection_manager.c                | 42 +++++++++++++--------------------
 tests/system_tests_protocol_settings.py | 22 +++++------------
 2 files changed, 23 insertions(+), 41 deletions(-)

diff --git a/src/connection_manager.c b/src/connection_manager.c
index 04ce135..aa95417 100644
--- a/src/connection_manager.c
+++ b/src/connection_manager.c
@@ -438,33 +438,25 @@ static qd_error_t load_server_config(qd_dispatch_t *qd, qd_server_config_t *conf
         config->max_frame_size = QD_AMQP_MIN_MAX_FRAME_SIZE;
 
     //
-    // Given session frame count and max frame size, compute session incoming_capacity
-    //   On 64-bit systems the capacity has no limit.
-    //   On 32-bit systems the largest capacity is defined as half the process address space.
+    // Given session frame count and max frame size compute session incoming_capacity
     //
-    if (ssn_frames != 0) {
-        // Limited incoming frames.
-        // Specify this to proton by setting capacity to be
-        // the product (max_frame_size * ssn_frames).
-        size_t capacity = config->max_frame_size * ssn_frames;
-
-        if (sizeof(size_t) == 8) {
-            // 64-bit systems use the configured, unbounded capacity
-            config->incoming_capacity = capacity;
+    if (ssn_frames == 0)
+        config->incoming_capacity = (sizeof(size_t) < 8) ? 0x7FFFFFFFLL : 0x7FFFFFFFLL * config->max_frame_size;
+    else {
+        uint64_t mfs      = (uint64_t) config->max_frame_size;
+        uint64_t trial_ic = ssn_frames * mfs;
+        uint64_t limit    = (sizeof(size_t) < 8) ? (1ll << 31) - 1 : 0;
+        if (limit == 0 || trial_ic < limit) {
+            // Silently promote incoming capacity of zero to one
+            config->incoming_capacity = 
+                (trial_ic < QD_AMQP_MIN_MAX_FRAME_SIZE ? QD_AMQP_MIN_MAX_FRAME_SIZE : trial_ic);
         } else {
-            // 32-bit systems have an upper bound to the capacity
-#define AMQP_MAX_WINDOW_SIZE (2147483647)
-            if (capacity <= AMQP_MAX_WINDOW_SIZE) {
-                config->incoming_capacity = capacity;
-            } else {
-                config->incoming_capacity = AMQP_MAX_WINDOW_SIZE;
-
-                qd_log(qd->connection_manager->log_source, QD_LOG_WARNING,
-                    "Server configuation for I/O adapter entity name:'%s', host:'%s', port:'%s', "
-                    "requested maxSessionFrames truncated from %"PRId64" to %"PRId64,
-                    config->name, config->host, config->port, ssn_frames,
-                    AMQP_MAX_WINDOW_SIZE / config->max_frame_size);
-            }
+            config->incoming_capacity = limit;
+            uint64_t computed_ssn_frames = limit / mfs;
+            qd_log(qd->connection_manager->log_source, QD_LOG_WARNING,
+                   "Server configuation for I/O adapter entity name:'%s', host:'%s', port:'%s', "
+                   "requested maxSessionFrames truncated from %"PRId64" to %"PRId64,
+                   config->name, config->host, config->port, ssn_frames, computed_ssn_frames);
         }
     }
 
diff --git a/tests/system_tests_protocol_settings.py b/tests/system_tests_protocol_settings.py
index 6b0d91d..546ffe6 100644
--- a/tests/system_tests_protocol_settings.py
+++ b/tests/system_tests_protocol_settings.py
@@ -26,7 +26,6 @@ from system_test import TestCase, Qdrouterd, main_module
 from system_test import unittest
 from proton.utils import BlockingConnection
 import subprocess
-import sys
 
 class MaxFrameMaxSessionFramesTest(TestCase):
     """System tests setting proton negotiated size max-frame-size and incoming-window"""
@@ -235,11 +234,8 @@ class MaxSessionFramesDefaultTest(TestCase):
             # if frame size not set then a default is used
             self.assertTrue(" max-frame-size=16384" in open_lines[0])
             begin_lines = [s for s in log_lines if "-> @begin" in s]
-            # incoming-window is defaulted to 2^31-1 (64-bit) or 2^17-1 (32-bit)
-            is_64bits = sys.maxsize > 2 ** 32
-            expected = " incoming-window=2147483647," if is_64bits else " incoming-window=131071,"
-            self.assertTrue(expected in begin_lines[0],
-                            "Expected:'%s' not found in '%s'" % (expected, begin_lines[0]))
+            # incoming-window is defaulted to 2^31-1 (Proton default)
+            self.assertTrue(" incoming-window=2147483647," in begin_lines[0])
 
 
 class MaxFrameMaxSessionFramesZeroTest(TestCase):
@@ -274,11 +270,8 @@ class MaxFrameMaxSessionFramesZeroTest(TestCase):
             # max-frame gets set to protocol min
             self.assertTrue(' max-frame-size=512,' in open_lines[0])
             begin_lines = [s for s in log_lines if "-> @begin" in s]
-            # incoming-window is defaulted to 2^31-1 (64-bit) or 2^17-1 (32-bit)
-            is_64bits = sys.maxsize > 2 ** 32
-            expected = " incoming-window=2147483647," if is_64bits else " incoming-window=131071,"
-            self.assertTrue(expected in begin_lines[0],
-                            "Expected:'%s' not found in '%s'" % (expected, begin_lines[0]))
+            # incoming-window is defaulted to 2^31-1 (Proton default)
+            self.assertTrue(" incoming-window=2147483647," in begin_lines[0])
 
 
 class ConnectorSettingsDefaultTest(TestCase):
@@ -330,11 +323,8 @@ class ConnectorSettingsDefaultTest(TestCase):
             self.assertTrue(' max-frame-size=16384,' in open_lines[0])
             self.assertTrue(' channel-max=32767,' in open_lines[0])
             begin_lines = [s for s in log_lines if "<- @begin" in s]
-            # incoming-window is defaulted to 2^31-1 (64-bit) or 2^17-1 (32-bit)
-            is_64bits = sys.maxsize > 2 ** 32
-            expected = " incoming-window=2147483647," if is_64bits else " incoming-window=131071,"
-            self.assertTrue(expected in begin_lines[0],
-                            "Expected:'%s' not found in '%s'" % (expected, begin_lines[0]))
+            # defaults
+            self.assertTrue(" incoming-window=2147483647," in begin_lines[0])
 
 
 class ConnectorSettingsNondefaultTest(TestCase):


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