Skip to content

Commit

Permalink
Merge pull request #314 from MrAnno/fix-threaded-source-stuck
Browse files Browse the repository at this point in the history
logthrsource: fix sources getting stuck due to unclosed batches
  • Loading branch information
alltilla authored Sep 30, 2024
2 parents f0b42de + 6d73b8e commit 1f591bb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
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

0 comments on commit 1f591bb

Please sign in to comment.