You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ig...@apache.org on 2012/10/13 10:31:00 UTC

[2/2] git commit: Log.cc: Acquire flush_mutex before using it in ink_cond_wait, or we risk unknown behavior.

Log.cc: Acquire flush_mutex before using it in ink_cond_wait, or we risk unknown behavior.

On FreeBSD/OpenBSD, ink_cond_wait requires the mutex to be locked prior to being callled,
or it will fail with EPERM and cause an infinite loop with no waiting time (i.e. 100% cpu).
This should in theory also apply to Linux, at least according to documentation, so adding an
acquisition of the mutex before the wait should apply to all OSes. This also, in part, solves
issues 1 through 3 described in TS-993.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a61b0b06
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a61b0b06
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a61b0b06

Branch: refs/heads/3.2.x
Commit: a61b0b06defd578253d137f1a3068fec11701513
Parents: 93b6e05
Author: Daniel Gruno <hu...@apache.org>
Authored: Tue Sep 18 12:46:40 2012 +0200
Committer: Igor Galić <i....@brainsware.org>
Committed: Sat Oct 13 10:28:07 2012 +0200

----------------------------------------------------------------------
 proxy/logging/Log.cc |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a61b0b06/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 9b06b63..db0680c 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -1214,6 +1214,7 @@ Log::flush_thread_main(void *args)
     // check the queue and find there is nothing to do, then wait
     // again.
     //
+    ink_mutex_try_acquire(&flush_mutex); // acquire if not already acquired, so ink_cond_wait doesn't fail us
     ink_cond_wait (&flush_cond, &flush_mutex);
   }
   /* NOTREACHED */