Skip to content

Commit b0ccc89

Browse files
authored
Merge pull request syslog-ng#5148 from HofiOne/fix-threaded-source-stuck
logthrsource: fix sources getting stuck due to unclosed batches
2 parents 9967654 + c3bc389 commit b0ccc89

File tree

5 files changed

+8
-2
lines changed

5 files changed

+8
-2
lines changed

lib/filterx/filterx-eval.h

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ filterx_eval_prepare_for_fork(FilterXEvalContext *context, LogMessage **pmsg, co
7979
filterx_eval_sync_message(context, pmsg, path_options);
8080
if (context)
8181
filterx_scope_write_protect(context->scope);
82-
log_msg_write_protect(*pmsg);
8382
}
8483

8584
#endif

lib/logmpx.c

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ log_multiplexer_queue(LogPipe *s, LogMessage *msg, const LogPathOptions *path_op
9494
* data we still need */
9595

9696
filterx_eval_prepare_for_fork(path_options->filterx_context, &msg, path_options);
97+
log_msg_write_protect(msg);
9798
}
9899
for (fallback = 0; (fallback == 0) || (fallback == 1 && self->fallback_exists && !delivered); fallback++)
99100
{

lib/logthrsource/logthrsourcedrv.c

+4
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,10 @@ log_threaded_source_worker_blocking_post(LogThreadedSourceWorker *self, LogMessa
431431
{
432432
log_threaded_source_worker_post(self, msg);
433433

434+
/* unlocked, as only this thread can decrease the window size */
435+
if (!self->control->auto_close_batches && !log_threaded_source_worker_free_to_send(self))
436+
log_threaded_source_worker_close_batch(self);
437+
434438
/*
435439
* The wakeup lock must be held before calling free_to_send() and suspend(),
436440
* otherwise g_cond_signal() might be called between free_to_send() and

lib/logthrsource/logthrsourcedrv.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void log_threaded_source_worker_close_batch(LogThreadedSourceWorker *self);
127127
/* blocking API */
128128
void log_threaded_source_worker_blocking_post(LogThreadedSourceWorker *self, LogMessage *msg);
129129

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

news/bugfix-5148.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
`opentelemetry()` sources: fix source hang-up on flow-controlled paths

0 commit comments

Comments
 (0)