[syslog-ng] [PATCH] afsql: Fix sql stuck problema

Juhasz Viktor jviktor at balabit.hu
Mon Jun 27 12:42:12 CEST 2011


Hi,

Sorry the previous patch is not correct because it causes deadlock in 
case of no multithread.
The correction of the patch is the following:

[afsql] Fix afsql deadlock which is caused the previous patch (send a 
signal to the database thread only in case when the queue is syncronised)
In case of no multithread the push tail call the push notify and it 
causes deadlock of sql

Signed-off-by: Viktor Juhasz (jviktor at balabit.hu)
diff --git a/modules/afsql/afsql.c b/modules/afsql/afsql.c
index bbdd1d2..27fff99 100644
--- a/modules/afsql/afsql.c
+++ b/modules/afsql/afsql.c
@@ -1173,8 +1173,10 @@ afsql_dd_queue(LogPipe *s, LogMessage *msg, const 
LogPathOptions *path_options,
 
   g_mutex_lock(self->db_thread_mutex);
   queue_was_empty = log_queue_get_length(self->queue) == 0;
+  g_mutex_unlock(self->db_thread_mutex);
   log_queue_push_tail(self->queue, msg, path_options);
 
+  g_mutex_lock(self->db_thread_mutex);
   if (queue_was_empty && !self->db_thread_suspended)
     {
       log_queue_set_parallel_push(self->queue, 1, 
afsql_dd_queue_notify, self, NULL);


Juhasz Viktor wrote:
>
> ------------------------------------------------------------------------
>
> ______________________________________________________________________________
> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
> FAQ: http://www.balabit.com/wiki/syslog-ng-faq
>




More information about the syslog-ng mailing list