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

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

kgiusti commented on pull request #668: DISPATCH-1509: free core agent timer on 
shutdown
URL: https://github.com/apache/qpid-dispatch/pull/668#discussion_r368703605
 
 

 ##########
 File path: src/router_core/agent.c
 ##########
 @@ -107,6 +122,54 @@ static void qdr_agent_set_columns(qdr_query_t *query, 
qd_parsed_field_t *attribu
 // Interface Functions
 
//==================================================================================
 
+
+// called prior to core thread start
+qdr_agent_t *qdr_agent(qdr_core_t *core)
+{
+    qdr_agent_t *agent = NEW(qdr_agent_t);
+    ZERO(agent);
+
+    DEQ_INIT(agent->outgoing_query_list);
+    agent->query_lock  = sys_mutex();
+    agent->agent_timer = qd_timer(core->qd, qdr_agent_response_handler, core);
+    agent->agent_log_source = qd_log_source("AGENT");
+    return agent;
+}
+
+
+// called after core thread has shutdown
+void qdr_agent_free(qdr_agent_t *agent)
+{
+    if (agent) {
+        qd_timer_free(agent->agent_timer);
+        if (agent->query_lock)
+            sys_mutex_free(agent->query_lock);
+
+        //we can't call qdr_core_unsubscribe on the subscriptions because the 
action processing thread has
+        //already been shut down. But, all the action would have done at this 
point is free the subscriptions
+        //so we just do that directly.
+        free(agent->agent_subscription_mobile);
+        free(agent->agent_subscription_local);
+
 
 Review comment:
   Turns out the log module frees all the log sources up on shutdown.
 
----------------------------------------------------------------
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:
[email protected]


> Leak of core agent timer
> ------------------------
>
>                 Key: DISPATCH-1509
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-1509
>             Project: Qpid Dispatch
>          Issue Type: Bug
>          Components: Router Node
>    Affects Versions: 1.9.0
>            Reporter: Ken Giusti
>            Assignee: Ken Giusti
>            Priority: Trivial
>             Fix For: 1.11.0
>
>




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

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

Reply via email to