You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2020/03/02 16:05:23 UTC

[GitHub] [qpid-dispatch] ChugR opened a new pull request #694: DISPATCH-975: Enforce max message size on message ingress

ChugR opened a new pull request #694: DISPATCH-975: Enforce max message size on message ingress
URL: https://github.com/apache/qpid-dispatch/pull/694
 
 
   This commit has an updated implementation for further review.
   
   Notes:
   
   MaxMessageSize may be specified globally, per vhost, or per vhost user
   group. The global setting applies to all vhosts for which maxMessageSize
   is unspecified. The vhost setting applies to all vhost user groups for
   which maxMessageSize is unspecified. The vhost user group setting
   overrides all other settings. A maxMessageSize setting of zero disables
   maxMessageSize enforcement.
   
   Links over which maxMessageSize is being enforced will advertise the
   size in the _max-message-size_ field of the Attach
   frame. Qpid-dispatch ignores the _max-message-size_ field received in
   incoming Attach frames.
   
   Message size for maxMessageSize purposes is calculated to be the
   number of AMQP octets in the Annotated Message. This includes the
   header, delivery-annotations, message-annotations, properties,
   application-properties, application-data, and footer
   sections. Administrators and users must be aware that a "message"
   consisting a single character string (the application-data) will be
   much larger over the wire after properties and annotations have been
   inserted.
   
   Max message size is enforced on message/transfer ingress only. Once a
   message has entered the router network it is free to go to any
   destination.
   
   When a message exceeds max size then:
   
    * Disposition of _rejected_ is returned to the sender for that delivery.
    * Ingress link to qpid-dispatch is closed with an error.
    * Copies of the message being delivered through the router network are aborted.
   
   In message.c oversize messages are detected and then handled as
   oversize, discarded, and aborted.
   
   In router_node.c oversize messages are logged, links are closed, and
   downstream deliveries are disconnected.
   
   ToDo:
   
   Fix issues in DISPATCH-1581 where policy settings and counters are
   _int_ and not _uint64_. That will be a separate work stream.
   
   Fix all resource leaks. Certain patterns of client activity leak
   qd_message, qd_link, and qd_disposition resources. Sometimes. More
   testing required.
   
   Characterize some issues that AMQP clients suffer when oversize
   messages are denied. Clients fail in mysterious ways and some hints on
   what is happening and what to do about it will speed client
   development.
   
   Improve single-router test to cover multiple routers.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #694: DISPATCH-975: Enforce max message size on message ingress

Posted by GitBox <gi...@apache.org>.
kgiusti commented on a change in pull request #694: DISPATCH-975: Enforce max message size on message ingress
URL: https://github.com/apache/qpid-dispatch/pull/694#discussion_r387298367
 
 

 ##########
 File path: src/router_node.c
 ##########
 @@ -329,12 +330,33 @@ static bool AMQP_rx_handler(void* context, qd_link_t *link)
     qdr_delivery_t *delivery = qdr_node_delivery_qdr_from_pn(pnd);
     bool       next_delivery = false;
 
-    //
-    // Receive the message into a local representation.
-    //
     qd_message_t   *msg   = qd_message_receive(pnd);
+    
+    int oversize = qd_message_exceeded_max_message_size(msg);
+    if (oversize > 0) {
+        // message is bigger than maxMessageSize
+        if (oversize == 1) {
 
 Review comment:
   Q: what if the message is large and was forwarded to the core, then the oversize condition is hit on a later transfer?  Won't there be a qdr_delivery_t outstanding on the core's qdr_link_t undelivered list?  

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #694: DISPATCH-975: Enforce max message size on message ingress

Posted by GitBox <gi...@apache.org>.
kgiusti commented on a change in pull request #694: DISPATCH-975: Enforce max message size on message ingress
URL: https://github.com/apache/qpid-dispatch/pull/694#discussion_r387298396
 
 

 ##########
 File path: src/router_node.c
 ##########
 @@ -329,12 +330,33 @@ static bool AMQP_rx_handler(void* context, qd_link_t *link)
     qdr_delivery_t *delivery = qdr_node_delivery_qdr_from_pn(pnd);
     bool       next_delivery = false;
 
-    //
-    // Receive the message into a local representation.
-    //
     qd_message_t   *msg   = qd_message_receive(pnd);
+    
+    int oversize = qd_message_exceeded_max_message_size(msg);
+    if (oversize > 0) {
+        // message is bigger than maxMessageSize
+        if (oversize == 1) {
+            // went oversize on this pass
+            qdr_link_t *rlink = (qdr_link_t*) qd_link_get_context(link);
+            qd_log(qd_policy_log_source(), QD_LOG_WARNING, "[C%"PRIu64"][L%"PRIu64"] DENY AMQP Transfer maxMessageSize exceeded. rhost:%s",
+                    rlink->conn->identity, rlink->identity, qd_connection_name(conn));
+            // increment policy counters
+            qd_policy_count_max_size_event(pn_link, conn);
+            // reject delivery that went oversize
+            pn_delivery_update(pnd, PN_REJECTED);
+            // Initiate link close with error.
+            pn_condition_t * cond = pn_link_condition(pn_link);
+            (void) pn_condition_set_name(cond, QD_AMQP_COND_MESSAGE_SIZE_EXCEEDED);
+            pn_link_close(pn_link);
+            // Abort outbound deliveries that were receiving this incoming delivery
+            qdr_node_disconnect_deliveries(router->router_core, link, delivery, pnd);
 
 Review comment:
   If the message has not yet been forwarded to the core, then delivery here will be null.  qdr_node_disconnect_deliveries will crash in that case IIUC.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [qpid-dispatch] ChugR closed pull request #694: DISPATCH-975: Enforce max message size on message ingress

Posted by GitBox <gi...@apache.org>.
ChugR closed pull request #694: DISPATCH-975: Enforce max message size on message ingress
URL: https://github.com/apache/qpid-dispatch/pull/694
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [qpid-dispatch] ChugR commented on issue #694: DISPATCH-975: Enforce max message size on message ingress

Posted by GitBox <gi...@apache.org>.
ChugR commented on issue #694: DISPATCH-975: Enforce max message size on message ingress
URL: https://github.com/apache/qpid-dispatch/pull/694#issuecomment-595896127
 
 
   New PR coming soon

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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