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

logthrsource: fix sources getting stuck due to unclosed batches #314

Merged
merged 3 commits into from
Sep 30, 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
1 change: 0 additions & 1 deletion lib/filterx/filterx-eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ filterx_eval_prepare_for_fork(FilterXEvalContext *context, LogMessage **pmsg, co
filterx_eval_sync_message(context, pmsg, path_options);
if (context)
filterx_scope_write_protect(context->scope);
log_msg_write_protect(*pmsg);
}

#endif
1 change: 1 addition & 0 deletions lib/logmpx.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ log_multiplexer_queue(LogPipe *s, LogMessage *msg, const LogPathOptions *path_op
* data we still need */

filterx_eval_prepare_for_fork(path_options->filterx_context, &msg, path_options);
log_msg_write_protect(msg);
}
for (fallback = 0; (fallback == 0) || (fallback == 1 && self->fallback_exists && !delivered); fallback++)
{
Expand Down
4 changes: 4 additions & 0 deletions lib/logthrsource/logthrsourcedrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,10 @@ log_threaded_source_worker_blocking_post(LogThreadedSourceWorker *self, LogMessa
{
log_threaded_source_worker_post(self, msg);

/* unlocked, as only this thread can decrease the window size */
if (!self->control->auto_close_batches && !log_threaded_source_worker_free_to_send(self))
log_threaded_source_worker_close_batch(self);

/*
* The wakeup lock must be held before calling free_to_send() and suspend(),
* otherwise g_cond_signal() might be called between free_to_send() and
Expand Down
2 changes: 1 addition & 1 deletion lib/logthrsource/logthrsourcedrv.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void log_threaded_source_worker_close_batch(LogThreadedSourceWorker *self);
/* blocking API */
void log_threaded_source_worker_blocking_post(LogThreadedSourceWorker *self, LogMessage *msg);

/* non-blocking API, use it wisely (thread boundaries) */
/* non-blocking API, use it wisely (thread boundaries); call close_batch() at least before suspending */
void log_threaded_source_worker_post(LogThreadedSourceWorker *self, LogMessage *msg);
gboolean log_threaded_source_worker_free_to_send(LogThreadedSourceWorker *self);

Expand Down
1 change: 1 addition & 0 deletions news/bugfix-314.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`opentelemetry()`, `axosyslog-otlp()` sources: fix source hang-up on flow-controlled paths
Loading