Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

driver: release the queues of half-initialized pipes #128

Merged
merged 4 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions lib/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,9 @@ _log_dest_driver_unregister_counters(LogDestDriver *self)
stats_unlock();
}

gboolean
log_dest_driver_deinit_method(LogPipe *s)
static inline void
_log_dest_driver_release_queues(LogDestDriver *self)
{
LogDestDriver *self = (LogDestDriver *) s;
GList *l, *l_next;

for (l = self->queues; l; l = l_next)
Expand All @@ -404,7 +403,16 @@ log_dest_driver_deinit_method(LogPipe *s)
* which automatically frees the ref on the list too */
log_dest_driver_release_queue(self, log_queue_ref(q));
}

g_assert(self->queues == NULL);
}

gboolean
log_dest_driver_deinit_method(LogPipe *s)
{
LogDestDriver *self = (LogDestDriver *) s;

_log_dest_driver_release_queues(self);

_log_dest_driver_unregister_counters(self);

Expand All @@ -431,12 +439,9 @@ void
log_dest_driver_free(LogPipe *s)
{
LogDestDriver *self = (LogDestDriver *) s;
GList *l;

for (l = self->queues; l; l = l->next)
{
log_queue_unref((LogQueue *) l->data);
}
g_list_free(self->queues);
/* half-initialized pipes can't release their queue in deinit() */
_log_dest_driver_release_queues(self);

log_driver_free(s);
}
6 changes: 5 additions & 1 deletion lib/logthrdest/logthrdestdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,11 @@ _create_workers(LogThreadedDestDriver *self, gint stats_level, StatsClusterKeyBu

self->workers[self->created_workers] = dw;
if (!_acquire_worker_queue(dw, stats_level, driver_sck_builder))
return FALSE;
{
/* failed worker needs to be destroyed */
self->created_workers++;
return FALSE;
}
}

return TRUE;
Expand Down
3 changes: 3 additions & 0 deletions news/bugfix-128.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
`disk-buffer()`: fix crash when pipeline initialization fails

`log_queue_disk_free_method: assertion failed: (!qdisk_started(self->qdisk))`
Loading