You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2017/01/11 14:37:06 UTC

qpid-dispatch git commit: DISPATCH-606 - Default Session Window is now maximum (2^31-1) on 64 bit arches. On 32-bit arches, it is the maximum divided by the max_frame_size. This is due to an API limitation in Proton.

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 1f8422095 -> 750224e4e


DISPATCH-606 - Default Session Window is now maximum (2^31-1) on 64 bit arches.  On 32-bit arches, it is the maximum divided by the max_frame_size.  This is due to an API limitation in Proton.


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/750224e4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/750224e4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/750224e4

Branch: refs/heads/master
Commit: 750224e4eb3f77a33bc6679d5f14d16a7677e82b
Parents: 1f84220
Author: Ted Ross <tr...@redhat.com>
Authored: Wed Jan 11 09:35:11 2017 -0500
Committer: Ted Ross <tr...@redhat.com>
Committed: Wed Jan 11 09:35:11 2017 -0500

----------------------------------------------------------------------
 python/qpid_dispatch/management/qdrouter.json |  6 ++--
 src/connection_manager.c                      | 37 ++++++++++++----------
 src/container.c                               |  8 ++++-
 src/policy.c                                  | 12 +++++--
 tests/system_tests_protocol_settings.py       |  8 ++---
 5 files changed, 44 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/750224e4/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch/management/qdrouter.json b/python/qpid_dispatch/management/qdrouter.json
index 3c6bb88..f4ab551 100644
--- a/python/qpid_dispatch/management/qdrouter.json
+++ b/python/qpid_dispatch/management/qdrouter.json
@@ -640,8 +640,7 @@
                 },
                 "maxSessionFrames": {
                     "type": "integer",
-                    "description": "Session incoming window measured in transfer frames for sessions created on this connection. This is the number of transfer frames that may simultaneously be in flight for all links in the session. Setting this value to zero selects the default session window size. Policy settings, if specified, will overwrite this value. The numerical product of maxFrameSize and maxSessionFrames may not exceed 2^31-1. If (maxFrameSize x maxSessionFrames) exceeds 2^31-1 then maxSessionFrames is reduced to (2^31-1 / maxFrameSize). maxSessionFrames has a minimum value of 1. Defaults to 100.",
-                    "default": 100,
+                    "description": "Session incoming window measured in transfer frames for sessions created on this connection. This is the number of transfer frames that may simultaneously be in flight for all links in the session. Setting this value to zero selects the default session window size. Policy settings, if specified, will overwrite this value. The numerical product of maxFrameSize and maxSessionFrames may not exceed 2^31-1. If (maxFrameSize x maxSessionFrames) exceeds 2^31-1 then maxSessionFrames is reduced to (2^31-1 / maxFrameSize). maxSessionFrames has a minimum value of 1. Defaults to 0 (unlimited window).",
                     "required": false,
                     "create": true
                 },
@@ -784,8 +783,7 @@
                 },
                 "maxSessionFrames": {
                     "type": "integer",
-                    "description": "Session incoming window measured in transfer frames for sessions created on this connection. This is the number of transfer frames that may simultaneously be in flight for all links in the session. Setting this value to zero selects the default session window size. Policy settings will not overwrite this value. The numerical product of maxFrameSize and maxSessionFrames may not exceed 2^31-1. If (maxFrameSize x maxSessionFrames) exceeds 2^31-1 then maxSessionFrames is reduced to (2^31-1 / maxFrameSize). maxSessionFrames has a minimum value of 1. Defaults to 100.",
-                    "default": 100,
+                    "description": "Session incoming window measured in transfer frames for sessions created on this connection. This is the number of transfer frames that may simultaneously be in flight for all links in the session. Setting this value to zero selects the default session window size. Policy settings will not overwrite this value. The numerical product of maxFrameSize and maxSessionFrames may not exceed 2^31-1. If (maxFrameSize x maxSessionFrames) exceeds 2^31-1 then maxSessionFrames is reduced to (2^31-1 / maxFrameSize). maxSessionFrames has a minimum value of 1.  Defaults to 0 (unlimited window).",
                     "required": false,
                     "create": true
                 },

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/750224e4/src/connection_manager.c
----------------------------------------------------------------------
diff --git a/src/connection_manager.c b/src/connection_manager.c
index c4253c8..b903f8c 100644
--- a/src/connection_manager.c
+++ b/src/connection_manager.c
@@ -29,6 +29,7 @@
 #include "schema_enum.h"
 #include <string.h>
 #include <stdio.h>
+#include <inttypes.h>
 
 static char* HOST_ADDR_DEFAULT = "127.0.0.1";
 
@@ -247,7 +248,7 @@ static qd_error_t load_server_config(qd_dispatch_t *qd, qd_server_config_t *conf
     config->http = config->http || config->http_root; /* httpRoot implies http */
     config->max_frame_size       = qd_entity_get_long(entity, "maxFrameSize");        CHECK();
     config->max_sessions         = qd_entity_get_long(entity, "maxSessions");         CHECK();
-    uint64_t ssn_frames          = qd_entity_get_long(entity, "maxSessionFrames");    CHECK();
+    uint64_t ssn_frames          = qd_entity_opt_long(entity, "maxSessionFrames", 0); CHECK();
     config->idle_timeout_seconds = qd_entity_get_long(entity, "idleTimeoutSeconds");  CHECK();
     config->sasl_username        = qd_entity_opt_string(entity, "saslUsername", 0);   CHECK();
     config->sasl_password        = qd_entity_opt_string(entity, "saslPassword", 0);   CHECK();
@@ -276,21 +277,25 @@ static qd_error_t load_server_config(qd_dispatch_t *qd, qd_server_config_t *conf
     //
     // Given session frame count and max frame size compute session incoming_capacity
     // Limit total capacity to 2^31-1.
-    // 
-    uint64_t mfs      = (uint64_t)config->max_frame_size;
-    uint64_t trial_ic = ssn_frames * mfs;
-    uint64_t limit    = (1ll << 31) - 1;
-    if (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 {
-        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 %llu to %llu",
-               config->name, config->host, config->port, ssn_frames, computed_ssn_frames);
+    //
+    if (ssn_frames == 0)
+        config->incoming_capacity = 0;
+    else {
+        uint64_t mfs      = (uint64_t) config->max_frame_size;
+        uint64_t trial_ic = ssn_frames * mfs;
+        uint64_t limit    = (1ll << 31) - 1;
+        if (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 {
+            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);
+        }
     }
 
     //

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/750224e4/src/container.c
----------------------------------------------------------------------
diff --git a/src/container.c b/src/container.c
index 5a6d073..d81a80e 100644
--- a/src/container.c
+++ b/src/container.c
@@ -797,7 +797,13 @@ qd_link_t *qd_link(qd_node_t *node, qd_connection_t *conn, qd_direction_t dir, c
     const qd_server_config_t * cf = qd_connection_config(conn);
 
     link->pn_sess = pn_session(qd_connection_pn(conn));
-    pn_session_set_incoming_capacity(link->pn_sess, cf->incoming_capacity);
+
+    if (cf->incoming_capacity > 0)
+        pn_session_set_incoming_capacity(link->pn_sess, cf->incoming_capacity);
+    else {
+        size_t capacity = (sizeof(size_t) < 8) ? 0x7FFFFFFFLL : 0x7FFFFFFFLL * cf->max_frame_size;
+        pn_session_set_incoming_capacity(link->pn_sess, capacity);
+    }
 
     if (dir == QD_OUTGOING)
         link->pn_link = pn_sender(link->pn_sess, name);

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/750224e4/src/policy.c
----------------------------------------------------------------------
diff --git a/src/policy.c b/src/policy.c
index d03257d..8bcfc22 100644
--- a/src/policy.c
+++ b/src/policy.c
@@ -424,13 +424,21 @@ bool qd_policy_approve_amqp_session(pn_session_t *ssn, qd_connection_t *qd_conn)
 void qd_policy_apply_session_settings(pn_session_t *ssn, qd_connection_t *qd_conn)
 {
     size_t capacity;
+    const qd_server_config_t *cf = qd_connection_config(qd_conn);
+
     if (qd_conn->policy_settings && qd_conn->policy_settings->maxSessionWindow) {
         capacity = qd_conn->policy_settings->maxSessionWindow;
     } else {
-        const qd_server_config_t * cf = qd_connection_config(qd_conn);
         capacity = cf->incoming_capacity;
     }
-    pn_session_set_incoming_capacity(ssn, capacity);
+
+    printf("INCOMING_CAPACITY: %ld\n", capacity);
+    if (capacity > 0)
+        pn_session_set_incoming_capacity(ssn, capacity);
+    else {
+        capacity = (sizeof(size_t) < 8) ? 0x7FFFFFFFLL : 0x7FFFFFFFLL * cf->max_frame_size;
+        pn_session_set_incoming_capacity(ssn, capacity);
+    }
 }
 
 //

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/750224e4/tests/system_tests_protocol_settings.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_protocol_settings.py b/tests/system_tests_protocol_settings.py
index 7a9b73d..707f840 100644
--- a/tests/system_tests_protocol_settings.py
+++ b/tests/system_tests_protocol_settings.py
@@ -234,7 +234,7 @@ class MaxSessionFramesDefaultTest(TestCase):
             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 from the config
-            self.assertTrue(" incoming-window=100," in begin_lines[0])
+            self.assertTrue(" incoming-window=2147483647," in begin_lines[0])
 
 
 class MaxFrameMaxSessionFramesTooBigTest(TestCase):
@@ -306,8 +306,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 promoted to 1
-            self.assertTrue(" incoming-window=1," in begin_lines[0])
+            # incoming-window is defaulted to 2^31-1
+            self.assertTrue(" incoming-window=2147483647," in begin_lines[0])
 
 
 class ConnectorSettingsDefaultTest(TestCase):
@@ -361,7 +361,7 @@ class ConnectorSettingsDefaultTest(TestCase):
             self.assertTrue(' channel-max=32767,' in open_lines[0])
             begin_lines = [s for s in log_lines if "<- @begin" in s]
             # defaults
-            self.assertTrue(" incoming-window=100," in begin_lines[0])
+            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