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

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

gemmellr commented on a change in pull request #847:
URL: https://github.com/apache/qpid-dispatch/pull/847#discussion_r492169846



##########
File path: src/connection_manager.c
##########
@@ -438,25 +438,37 @@ 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
+    // 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 AMQP_MAX_WINDWOW_SIZE.
     //
-    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);
+    if (ssn_frames == 0) {

Review comment:
       I'd agree with the above being clearer.

##########
File path: src/connection_manager.c
##########
@@ -438,25 +438,37 @@ 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
+    // 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 AMQP_MAX_WINDWOW_SIZE.
     //
-    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);
+    if (ssn_frames == 0) {
+        // Unlimited incoming frames.
+        // config->incoming_capacity is zero. Proton incoming_window is always 
AMQP_MAX_WINDOW_SIZE
+    } else {
+        // 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;
+        assert(capacity >= (size_t)QD_AMQP_MIN_MAX_FRAME_SIZE);

Review comment:
       The assert seems redundant if there is any verification of the actual 
max frame size setting..and if there isnt, maybe there should be? The 
ssn_frames is known to be non zero, and if its >=1 the assert cant trigger 
unless the frame size is illegal.
   
   Ah, unless the assert  is also trying to handle overflow in the capacity 
calculation? In which case it doesnt really do that very completely, just 
checks it isnt under max frame size.




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

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


> unexpected incoming-window in begin frame when running Dispatch on 32 bit 
> system
> --------------------------------------------------------------------------------
>
>                 Key: DISPATCH-1751
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-1751
>             Project: Qpid Dispatch
>          Issue Type: Bug
>    Affects Versions: 1.13.0
>            Reporter: Ganesh Murthy
>            Priority: Major
>
> On 32bit systems, an unexpected incoming-window value is set. This for 
> example causes system_tests_protocol_settings failures on 32bit systems, with 
> test expecting to see the incoming-window be 2147483647 but instead finding 
> it much less, e.g 131071.
> This is due to the way the session capacity is configured, particularly on 
> 32bit systems. See more details (output, code, etc) from prior discussions on 
> PROTON-2255 (raised when this was incorrectly thought to be a proton issue).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to