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

Gordon Sim commented on DISPATCH-1407:
--------------------------------------

When link attach fails on policy, the pn_link_t does not have a corresponding 
qd_link_t created. This means the link is not freed when the peer responds to 
the detach. Possible fix:

{noformat}
diff --git a/src/container.c b/src/container.c
index 22a42867..303beab9 100644
--- a/src/container.c
+++ b/src/container.c
@@ -617,6 +617,8 @@ void qd_container_handle_event(qd_container_t *container, 
pn_event_t *event,
                 if (node) {
                     node->ntype->link_detach_handler(node->context, qd_link, 
dt);
                 }
+            } else {
+                pn_link_free(pn_link);
             }
         }
         break;
{noformat}

> Memory leak on link policy denial
> ---------------------------------
>
>                 Key: DISPATCH-1407
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-1407
>             Project: Qpid Dispatch
>          Issue Type: Bug
>          Components: Policy Engine
>    Affects Versions: 1.8.0
>            Reporter: Chuck Rolke
>            Assignee: Chuck Rolke
>            Priority: Major
>         Attachments: A.conf, default.json
>
>
> A router with a simple policy that denies most addresses starts and uses 10M 
> bytes of memory. A test client loops 25k times opening a link to a denied 
> address over a single connection and session. Now the router uses 276 Mbytes.
> An example policy is
> ```
> [
>    ["vhost", {
>      "hostname": "$default",
>      "allowUnknownUser": true,
>      "groups" : {
>        "$default": {
>          "remoteHosts": "*",
>          "allowDynamicSource": true,
>          "allowAnonymousSender": true,
>          "sources": "$management, examples, q1",
>          "targets": "$management, examples, q1"
>        }
>      }
>    }]
> ]
> ```



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to