[
https://issues.apache.org/jira/browse/DISPATCH-1679?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17337561#comment-17337561
]
ASF GitHub Bot commented on DISPATCH-1679:
------------------------------------------
ganeshmurthy commented on a change in pull request #1170:
URL: https://github.com/apache/qpid-dispatch/pull/1170#discussion_r624075058
##########
File path: src/timer.c
##########
@@ -110,16 +174,37 @@ qd_timer_t *qd_timer(qd_dispatch_t *qd, qd_timer_cb_t cb,
void* context)
void qd_timer_free(qd_timer_t *timer)
{
if (!timer) return;
+
sys_mutex_lock(lock);
- timer_cancel_LH(timer);
- DEQ_REMOVE(idle_timers, timer);
+
+ assert(timer->state != QD_TIMER_STATE_DELETED); // double free!!!
+
+ if (timer->state == QD_TIMER_STATE_RUNNING) {
+ if (sys_thread_self() != callback_thread) {
+ // Another thread is running the callback (see qd_timer_visit())
+ // Wait until the callback finishes
+ timer->state = QD_TIMER_STATE_BLOCKED;
+ sys_cond_wait(timer->condition, lock);
Review comment:
If the timer callback executes for say 10 seconds, will this thread wait
for 10 seconds until that callback finishes and signals this condition? Instead
can this timer be moved to say a deleted_timers list (with a status of
QD_TIMER_STATE_DELETED) and when the callback completes, check if the timer was
deleted, then remove it from the deleted_timers list and free it ?
--
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: qd_connector_t and qd_timer_t
> -----------------------------------
>
> Key: DISPATCH-1679
> URL: https://issues.apache.org/jira/browse/DISPATCH-1679
> Project: Qpid Dispatch
> Issue Type: Bug
> Components: Routing Engine
> Affects Versions: 1.12.0
> Reporter: Ken Giusti
> Assignee: Ken Giusti
> Priority: Major
> Labels: leak
> Fix For: Backlog
>
>
> Every unit test that involves use of a connector leaks the connector and a
> related qd_timer_t. These leak warnings overwhelm other warnings in the test
> output.
> The qd_connector_t is reference counted. It also contains a qd_timer_t.
> From initial debug the reference count is never dropping below 1.
> It appears that every time the timer is scheduled the refcount is
> incremented. This appears to be an attempt to prevent the deletion of the
> qd_connector_t while the timer is outstanding. This appears likely to be the
> source of the outstanding ref count.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]