Updated Branches:
  refs/heads/master aeec26d4f -> 8665bbb1e

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/8665bbb1
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/8665bbb1
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/8665bbb1

Branch: refs/heads/master
Commit: 8665bbb1e5f34e6de5d709b0314a8fcb1eefec8d
Parents: aeec26d
Author: Daniel Gruno <[email protected]>
Authored: Tue Sep 18 12:46:40 2012 +0200
Committer: Daniel Gruno <[email protected]>
Committed: Tue Sep 18 12:46:40 2012 +0200

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8665bbb1/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 14f734a..dd463f0 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 */

Reply via email to