Re: [PATCH] Balancers, VirtualHost and ProxyPass

2015-03-19 Thread Jan Kaluža

On 12/12/2014 02:23 PM, Jan Kaluža wrote:

On 12/12/2014 02:17 PM, Yann Ylavic wrote:

On Fri, Dec 12, 2014 at 2:09 PM, Plüm, Rüdiger, Vodafone Group
ruediger.pl...@vodafone.com wrote:



-Ursprüngliche Nachricht-
Von: Jan Kaluža [mailto:jkal...@redhat.com]
Gesendet: Freitag, 12. Dezember 2014 14:00
An: dev@httpd.apache.org
Betreff: Re: [PATCH] Balancers, VirtualHost and ProxyPass

You are right :(. Fix attached. Order of errstatuses should not be a
problem. Its values are checked against r-status to determine status
code on which is balancer worker marked as in error.


Guess it is fine now :-)


+1


I forgot to commit this one. Done in trunk in r1667707 now.


Thanks you both, that one was painful :(.

Jan Kaluza


Regards,
Yann.





Regards,
Jan Kaluza



Re: How to wait on a global lock with timeout

2015-03-19 Thread Yann Ylavic
Hi Micha,

a few times later, commited in [1] and [2] :)

Can you please check if it works for you?

I also attached the patch against 1.6.x, if that can help...
It should also apply to 1.5.x, though it will never be backported
there (due to API changes).

Thanks for your interest,
Yann.

[1] http://svn.apache.org/r1667900
[2] http://svn.apache.org/r1667901

On Tue, Sep 30, 2014 at 8:22 PM, Micha Lenk mi...@lenk.info wrote:
 Hi Yann,

 On 30.09.2014 18:16, Yann Ylavic wrote:

 On Tue, Sep 30, 2014 at 5:30 PM, Yann Ylavic ylavic@gmail.com wrote:

 I have been working on a patch to provide
 apr_[thread/proc]_mutex_timedlock() in APR, [...]


 I think that is exactly what I was looking for...

 Your idea to use the native mutex functions is probably better than nothing.
 It provides the needed functionality at least for some platforms.

 I think I'll give my patch a new chance, at least for proc-mutexes
 (and hence global-mutexes), but this is not a today's solution in any
 case since I would be at best an APR-1.6 feature (if accepted)...


 That would be great. I am looking forward to test that, as soon as
 available... ;)

 Regards,
 Micha
Index: configure.in
===
--- configure.in	(revision 1667923)
+++ configure.in	(working copy)
@@ -2137,11 +2137,18 @@ AC_SUBST(struct_rlimit)
 dnl - Checking for Locking Characteristics 
 echo ${nl}Checking for Locking...
 
-AC_CHECK_FUNCS(semget semctl flock)
-AC_CHECK_HEADERS(semaphore.h OS.h)
+AC_CHECK_FUNCS(semget semctl semop semtimedop flock)
+APR_IFALLYES(func:semtimedop, have_semtimedop=1, have_semtimedop=0)
+
+AC_CHECK_HEADERS(semaphore.h)
 AC_SEARCH_LIBS(sem_open, rt)
-AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait create_sem)
+AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait sem_timedwait)
+APR_IFALLYES(func:sem_timedwait, have_sem_timedwait=1, have_sem_timedwait=0)
 
+AC_CHECK_HEADERS(OS.h)
+AC_CHECK_FUNCS(create_sem acquire_sem acquire_sem_etc)
+APR_IFALLYES(header:OS.h func:acquire_sem_etc, have_acquire_sem_etc=1, have_acquire_sem_etc=0)
+
 # Some systems return ENOSYS from sem_open.
 AC_CACHE_CHECK(for working sem_open,ac_cv_func_sem_open,[
 AC_TRY_RUN([
@@ -2199,7 +2206,10 @@ APR_CHECK_DEFINE_FILES(POLLIN, poll.h sys/poll.h)
 
 if test $threads = 1; then
 APR_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h)
-AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
+AC_CHECK_FUNCS(pthread_mutex_timedlock pthread_mutexattr_setpshared)
+APR_IFALLYES(header:pthread.h func:pthread_mutex_timedlock,
+ have_pthread_mutex_timedlock=1, have_pthread_mutex_timedlock=0)
+AC_SUBST(have_pthread_mutex_timedlock)
 # Some systems have setpshared and define PROCESS_SHARED, but don't 
 # really support PROCESS_SHARED locks.  So, we must validate that we 
 # can go through the steps without receiving some sort of system error.
@@ -2237,8 +2247,8 @@ fi
 APR_IFALLYES(header:semaphore.h func:sem_open func:sem_close dnl
  func:sem_unlink func:sem_post func:sem_wait,
  hasposixser=1, hasposixser=0)
-APR_IFALLYES(func:semget func:semctl define:SEM_UNDO, hassysvser=1, 
- hassysvser=0)
+APR_IFALLYES(func:semget func:semctl func:semop define:SEM_UNDO,
+ hassysvser=1, hassysvser=0)
 APR_IFALLYES(func:flock define:LOCK_EX, hasflockser=1, hasflockser=0)
 APR_IFALLYES(header:fcntl.h define:F_SETLK, hasfcntlser=1, hasfcntlser=0)
 # note: the current APR use of shared mutex requires /dev/zero
@@ -2263,9 +2273,9 @@ APR_IFALLYES(func:flock define:LOCK_EX,
 APR_DECIDE(USE_FLOCK_SERIALIZE, [4.2BSD-style flock()]))
 APR_IFALLYES(header:fcntl.h define:F_SETLK,
 APR_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()]))
-APR_IFALLYES(func:semget func:semctl define:SEM_UNDO,
+APR_IFALLYES(func:semget func:semctl func:semop define:SEM_UNDO,
 APR_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()]))
-APR_IFALLYES(header:OS.h func:create_sem, 
+APR_IFALLYES(header:OS.h func:create_sem func:acquire_sem func:acquire_sem_etc, 
 APR_DECIDE(USE_BEOSSEM, [BeOS Semaphores])) 
 if test x$apr_lock_method != x; then
 APR_DECISION_FORCE($apr_lock_method)
Index: include/apr_global_mutex.h
===
--- include/apr_global_mutex.h	(revision 1667923)
+++ include/apr_global_mutex.h	(working copy)
@@ -29,6 +29,7 @@
 #if APR_PROC_MUTEX_IS_GLOBAL
 #include apr_proc_mutex.h
 #endif
+#include apr_time.h
 
 #ifdef __cplusplus
 extern C {
@@ -66,6 +67,7 @@ typedef struct apr_global_mutex_t apr_global_mutex
  *APR_LOCK_POSIXSEM
  *APR_LOCK_PROC_PTHREAD
  *APR_LOCK_DEFAULT pick the default mechanism for the platform
+ *APR_LOCK_DEFAULT_TIMED pick the default timed mechanism
  * /PRE
  * @param pool the pool from which to allocate the mutex.
  * @warning Check APR_HAS_foo_SERIALIZE