Hello community,
here is the log from the commit of package apache2-mod_mono
checked in at Tue Sep 2 12:41:19 CEST 2008.
--------
--- apache2-mod_mono/apache2-mod_mono.changes 2008-03-25 22:34:52.000000000 +0100
+++ /mounts/work_src_done/STABLE/apache2-mod_mono/apache2-mod_mono.changes 2008-08-26 18:31:26.000000000 +0200
@@ -1,0 +2,11 @@
+Tue Aug 26 08:59:55 MDT 2008 - ajorgensen@novell.com
+
+- Update to 2.0 (preview 2)
+ * Fixes bnc#374272, bnc#392235,
+
+-------------------------------------------------------------------
+Tue Apr 29 15:16:28 MST 2008 - wberrier@suse.de
+
+- Fix .conf and apxs file location for redhat/fedora
+
+-------------------------------------------------------------------
Old:
----
mod_mono-1.9.tar.bz2
New:
----
mod_mono-2.0.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ apache2-mod_mono.spec ++++++
--- /var/tmp/diff_new_pack.mR9035/_old 2008-09-02 12:40:52.000000000 +0200
+++ /var/tmp/diff_new_pack.mR9035/_new 2008-09-02 12:40:52.000000000 +0200
@@ -1,10 +1,17 @@
#
-# spec file for package apache2-mod_mono (Version 1.9)
+# spec file for package apache2-mod_mono (Version 2.0)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
-# This file and all modifications and additions to the pristine
-# package are under the same license as the package itself.
#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
@@ -12,17 +19,17 @@
Name: apache2-mod_mono
+%define apxs /usr/sbin/apxs2
+%define apache2_sysconfdir %(%{apxs} -q SYSCONFDIR)/conf.d
Obsoletes: mod_mono
%define modname mod_mono
-%define apxs /usr/sbin/apxs2
-%define apache2_sysconfdir %(%{apxs} -q SYSCONFDIR)
%define apache2_libexecdir %(%{apxs} -q LIBEXECDIR)
%define apache_mmn %(MMN=$(%{apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)
Url: http://go-mono.com/
License: The Apache Software License
Group: Productivity/Networking/Web/Servers
AutoReqProv: on
-Version: 1.9
+Version: 2.0
Release: 1
Summary: Run ASP.NET Pages on Unix with Apache and Mono
Source: %{modname}-%{version}.tar.bz2
@@ -62,7 +69,7 @@
make
%install
-make install DESTDIR=$RPM_BUILD_ROOT APXS_SYSCONFDIR="%{apache2_sysconfdir}/conf.d"
+make install DESTDIR=$RPM_BUILD_ROOT APXS_SYSCONFDIR="%{apache2_sysconfdir}"
%clean
rm -rf $RPM_BUILD_ROOT
@@ -70,10 +77,15 @@
%files
%defattr(-,root,root)
%{apache2_libexecdir}/*
-%{apache2_sysconfdir}/conf.d/*
+%{apache2_sysconfdir}/*
%{_mandir}/man8/mod_mono.8*
%changelog
+* Tue Aug 26 2008 ajorgensen@novell.com
+- Update to 2.0 (preview 2)
+ * Fixes bnc#374272, bnc#392235,
+* Tue Apr 29 2008 wberrier@suse.de
+- Fix .conf and apxs file location for redhat/fedora
* Tue Mar 25 2008 wberrier@suse.de
- Update to 1.9
-New support for controlling the number of requests that are
++++++ mod_mono-1.9.tar.bz2 -> mod_mono-2.0.tar.bz2 ++++++
++++ 4265 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mod_mono-1.9/ChangeLog new/mod_mono-2.0/ChangeLog
--- old/mod_mono-1.9/ChangeLog 2008-01-29 23:54:57.000000000 +0100
+++ new/mod_mono-2.0/ChangeLog 2008-07-15 19:52:53.000000000 +0200
@@ -1,3 +1,56 @@
+2008-07-14 Joshua Tauberer
+
+ * src/mod_mono.c: Always acquire a lock at the start of processing
+ a request. The active requests counter function now assumes the
+ lock is already aquired. Also added a accepting_requests flag
+ to the dashboard so that xsp configurations can be paused. Now
+ when restarting mod-mono-server from the control panel, the
+ configuration is set to not accepting requests (503s returned)
+ until after the restart. This fixed a problem that when requests
+ came in during a restart, mod-mono-server would never successfully
+ come back but it would keep getting forked. The flag can also
+ be turned on and off through the control panel.
+
+2008-07-14 Marek Habersack
+
+ * src/mod_mono.c (write_string_to_buffer, send_initial_data): use
+ 32-bit integers explicitly.
+
+2008-07-11 Marek Habersack
+
+ * src/mod_mono.h (PROTOCOL_VERSION): bumped to 9
+
+ * src/mod_mono.c: added new structure, initial_data_info, used to
+ optimize the send_initial_data function.
+ (write_string_to_buffer): added new parameter, str_length, which
+ optionally provides the string length.
+ (get_table_send_size, write_table_to_buffer): serialized table
+ contains the whole table size in addition to element count now.
+ (send_initial_data): when calculating the initial data size use
+ the initial_data_info structure to store the figures, so that we
+ don't have to do it again later on in the code.
+ Protocol version is followed by the total block size now, so that
+ mod_mono_server can retrieve the initial data in one recv call
+ instead of in a series of those.
+
+ * configure.in: added support for compiling with profiling
+ information (--enable-gprof)
+
+2008-05-20 Marek Habersack
+
+ * src/mod_mono.c: work correctly with IPv6 sockets, by detecting
+ the socket family instead of hard-coding it to AF_INET.
+ Do not get the default server's socket name until it is known
+ which mode the server should work in (tcp or unix sockets).
+ Fixes bug #392235
+ Patches contributed by Alex Villac�s Lasso
+ , thanks!
+
+2008-04-14 Marek Habersack
+
+ * src/mod_mono.c: add several ifdefs for compilation with apache
+ 1.3. Fixes bug #374272
+
2008-01-28 Wade Berrier
* configure.in: Version bump -> 1.9
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mod_mono-1.9/configure.in new/mod_mono-2.0/configure.in
--- old/mod_mono-1.9/configure.in 2008-01-29 23:54:57.000000000 +0100
+++ new/mod_mono-2.0/configure.in 2008-07-15 19:52:53.000000000 +0200
@@ -1,5 +1,5 @@
AC_INIT(src/mod_mono.c)
-AM_INIT_AUTOMAKE(mod_mono, 1.9)
+AM_INIT_AUTOMAKE(mod_mono, 2.0)
AM_CONFIG_HEADER(include/mod_mono_config.h:config.in)
AC_PROG_CC
@@ -48,6 +48,12 @@
enable_gcov=$enableval, enable_gcov=no)
AC_MSG_RESULT($enable_gcov)
+AC_MSG_CHECKING(if gprof support was requested)
+AC_ARG_ENABLE(gprof,
+ [ --enable-gprof build mono for gprof profiling],
+ enable_gprof=$enableval, enable_gprof=no)
+AC_MSG_RESULT($enable_gprof)
+
dnl AC_MSG_CHECKING([if building mod_mono_old is requested])
dnl AC_ARG_ENABLE(old-module,
dnl [ --enable-old-module enables compilation of the mod_mono_old module],
@@ -322,6 +328,13 @@
fi
#
+# gprof stuff must go at the every end, since we must be sure we turn off the optimizations
+#
+if test "x$enable_gprof" = "xyes" ; then
+ CFLAGS="$CFLAGS -DGPROF -O0 -pg"
+fi
+
+#
# GCOV stuff must go at the every end, since we must be sure we turn off the optimizations
#
if test "x$enable_gcov" = "xyes" ; then
@@ -443,6 +456,7 @@
echo " * CFLAGS = $CFLAGS"
echo " * Verbose logging (debug) = $enable_debug"
echo " * GCOV options used = $enable_gcov"
+echo " * Profiling enabled = $enable_gprof"
echo " * mono prefix = $MONO_PREFIX"
echo " * Default MonoApplicationsConfigDir = $DFLT_MONO_CONFIG_DIR"
dnl echo " * Build old module: $enable_old_module"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mod_mono-1.9/src/mod_mono.c new/mod_mono-2.0/src/mod_mono.c
--- old/mod_mono-1.9/src/mod_mono.c 2008-01-29 23:54:57.000000000 +0100
+++ new/mod_mono-2.0/src/mod_mono.c 2008-07-15 19:52:53.000000000 +0200
@@ -65,8 +65,23 @@
char restart_issued;
int active_requests;
int waiting_requests;
+ int accepting_requests;
} dashboard_data;
+#define INITIAL_DATA_MAX_ALLOCA_SIZE 8192
+typedef struct {
+ size_t method_len;
+ size_t server_hostname_len;
+ size_t uri_len;
+ size_t args_len;
+ size_t protocol_len;
+ size_t local_ip_len;
+ size_t remote_ip_len;
+ const char *remote_name;
+ size_t remote_name_len;
+ size_t filename_len;
+} initial_data_info;
+
typedef struct xsp_data {
char is_default;
char *alias;
@@ -452,6 +467,7 @@
xsp->dashboard->restart_issued = 0;
xsp->dashboard->active_requests = 0;
xsp->dashboard->waiting_requests = 0;
+ xsp->dashboard->accepting_requests = 1;
}
}
}
@@ -719,7 +735,6 @@
server->auto_app_set = FALSE;
add_xsp_server (p, "XXGLOBAL", server, FALSE, FALSE);
- server->servers [0].filename = get_default_global_socket_name (p, SOCKET_FILE);
return server;
}
@@ -1111,6 +1126,7 @@
abort();
}
str = get_client_block_buffer (r, (uint32_t) i, &actual_size);
+ DEBUG_PRINT (2, "requested size == %u, actual size == %u", i, actual_size);
i = ap_get_client_block (r, str, actual_size);
i = LE_FROM_INT (i);
status = write_data (sock, &i, sizeof (int32_t));
@@ -1299,7 +1315,7 @@
}
static apr_status_t
-try_connect (xsp_data *conf, apr_socket_t **sock, apr_pool_t *pool)
+try_connect (xsp_data *conf, apr_socket_t **sock, apr_int32_t family, apr_pool_t *pool)
{
char *error;
struct sockaddr_un unix_address;
@@ -1328,7 +1344,7 @@
apr_sockaddr_t *sa;
la = conf->listen_address ? conf->listen_address : LISTEN_ADDRESS;
- rv = apr_sockaddr_info_get (&sa, la, APR_INET,
+ rv = apr_sockaddr_info_get (&sa, la, family,
atoi (conf->listen_port), 0, pool);
if (rv != APR_SUCCESS) {
@@ -1507,7 +1523,10 @@
return;
}
#endif
-
+ is_master = (0 == strcmp ("XXGLOBAL", config->alias));
+ if (is_master && config->listen_port == NULL && config->filename == NULL)
+ config->filename = get_default_global_socket_name (pool, SOCKET_FILE);
+
/* Running mod-mono-server not requested */
if (!strcasecmp (config->run_xsp, "false")) {
DEBUG_PRINT (1, "Not running mod-mono-server: %s", config->run_xsp);
@@ -1516,7 +1535,6 @@
return;
}
- is_master = (0 == strcmp ("XXGLOBAL", config->alias));
/*
* At least one of MonoApplications, MonoApplicationsConfigFile or
* MonoApplicationsConfigDir must be specified, except for the 'global'
@@ -1718,7 +1736,33 @@
apr_status_t rv;
int family, proto;
- family = (conf->listen_port != NULL) ? AF_UNSPEC : PF_UNIX;
+ if (conf->listen_port != NULL) {
+#if APR_HAVE_IPV6
+ apr_status_t rv;
+ apr_sockaddr_t *sa;
+ char *la = NULL;
+#endif
+ family = AF_UNSPEC;
+
+#if APR_HAVE_IPV6
+ la = conf->listen_address ? conf->listen_address : LISTEN_ADDRESS;
+ rv = apr_sockaddr_info_get (&sa, la, family,
+ atoi (conf->listen_port),
+ APR_IPV6_ADDR_OK,
+ pool);
+
+ if (rv != APR_SUCCESS) {
+ ap_log_error (APLOG_MARK, APLOG_ERR, STATUS_AND_SERVER,
+ "mod_mono: error in address ('%s') or port ('%s'). Assuming AF_UNSPEC.",
+ la, conf->listen_port);
+ } else {
+ family = sa->family;
+ }
+
+#endif
+ } else {
+ family = PF_UNIX;
+ }
/* APR_PROTO_TCP = 6 */
proto = (family == AF_UNSPEC) ? 6 : 0;
#ifdef APACHE2
@@ -1735,27 +1779,33 @@
return rv;
}
- rv = try_connect (conf, sock, pool);
+ rv = try_connect (conf, sock, family, pool);
DEBUG_PRINT (1, "try_connect: %d", (int) rv);
return rv;
}
static int
-write_string_to_buffer (char *buffer, int offset, const char *str)
+write_string_to_buffer (char *buffer, int offset, const char *str, size_t str_length)
{
- int tmp;
- int le;
-
+ uint32_t le;
+ uint32_t tmp;
+
buffer += offset;
- tmp = (str != NULL) ? strlen (str) : 0;
+ if (str && !str_length) {
+ tmp = strlen (str);
+ le = LE_FROM_INT (tmp);
+ } else
+ tmp = (uint32_t)str_length;
+
le = LE_FROM_INT (tmp);
- memcpy (buffer, &le, sizeof (int32_t));
+
+ memcpy (buffer, &le, sizeof (uint32_t));
if (tmp > 0) {
- buffer += sizeof (int32_t);
+ buffer += sizeof (uint32_t);
memcpy (buffer, str, tmp);
}
- return tmp + sizeof (int32_t);
+ return tmp + sizeof (uint32_t);
}
static int32_t
@@ -1770,7 +1820,7 @@
if (elts->nelts == 0)
return sizeof (int32_t);
- size = sizeof (int32_t);
+ size = sizeof (int32_t) * 2;
t_elt = (const apr_table_entry_t *) (elts->elts);
t_end = t_elt + elts->nelts;
@@ -1793,8 +1843,10 @@
const apr_table_entry_t *t_elt;
const apr_table_entry_t *t_end;
char *ptr;
- int32_t count = 0;
-
+ int32_t count = 0, size;
+ char *countLocation = buffer + sizeof (int32_t);
+ char *sizeLocation = buffer;
+
elts = apr_table_elts (table);
if (elts->nelts == 0) { /* size is sizeof (int32_t) */
int32_t *i32 = (int32_t *) buffer;
@@ -1803,16 +1855,17 @@
}
ptr = buffer;
+ /* the size is set after the loop */
/* the count is set after the loop */
- ptr += sizeof (int32_t);
+ ptr += sizeof (int32_t) * 2;
t_elt = (const apr_table_entry_t *) (elts->elts);
t_end = t_elt + elts->nelts;
-
+
do {
if (t_elt->val != NULL) {
DEBUG_PRINT (3, "%s: %s", t_elt->key, t_elt->val);
- ptr += write_string_to_buffer (ptr, 0, t_elt->key);
- ptr += write_string_to_buffer (ptr, 0, t_elt->val);
+ ptr += write_string_to_buffer (ptr, 0, t_elt->key, 0);
+ ptr += write_string_to_buffer (ptr, 0, t_elt->val, 0);
count++;
}
@@ -1820,7 +1873,11 @@
} while (t_elt < t_end);
count = LE_FROM_INT (count);
- memcpy (buffer, &count, sizeof (int32_t));
+ memcpy (countLocation, &count, sizeof (int32_t));
+ size = (ptr - buffer) - sizeof (int32_t);
+ size = LE_FROM_INT (size);
+ memcpy (sizeLocation, &size, sizeof (int32_t));
+
return (ptr - buffer);
}
@@ -1839,62 +1896,97 @@
static int
send_initial_data (request_rec *r, apr_socket_t *sock, char auto_app)
{
- int i;
- char *str, *ptr;
- int size;
- server_rec *s = r->server;
-
- DEBUG_PRINT (2, "Send init1");
- size = 1;
- size += ((r->method != NULL) ? strlen (r->method) : 0) + sizeof (int32_t);
- if (s != NULL)
- size += ((s->is_virtual && s->server_hostname != NULL) ? strlen (s->server_hostname) : 0) + sizeof (int32_t);
- else
+ uint32_t i;
+ char *str, *ptr;
+ uint32_t size;
+ server_rec *s = r->server;
+ initial_data_info info;
+
+ DEBUG_PRINT (2, "Send init");
+ size = 1 + sizeof (size);
+
+ info.method_len = ((r->method != NULL) ? strlen (r->method) : 0);
+ size += info.method_len + sizeof (int32_t);
+ if (s != NULL) {
+ info.server_hostname_len = ((s->is_virtual && s->server_hostname != NULL) ? strlen (s->server_hostname) : 0);
+ size += info.server_hostname_len + sizeof (int32_t);
+ } else {
+ info.server_hostname_len = 0;
size += sizeof (int32_t);
- size += ((r->uri != NULL) ? strlen (r->uri) : 0) + sizeof (int32_t);
- size += ((r->args != NULL) ? strlen (r->args) : 0) + sizeof (int32_t);
- size += ((r->protocol != NULL) ? strlen (r->protocol) : 0) + sizeof (int32_t);
- size += strlen (r->connection->local_ip) + sizeof (int32_t);
+ }
+
+ info.uri_len = ((r->uri != NULL) ? strlen (r->uri) : 0);
+ size += info.uri_len + sizeof (int32_t);
+
+ info.args_len = ((r->args != NULL) ? strlen (r->args) : 0);
+ size += info.args_len + sizeof (int32_t);
+
+ info.protocol_len = ((r->protocol != NULL) ? strlen (r->protocol) : 0);
+ size += info.protocol_len + sizeof (int32_t);
+
+ info.local_ip_len = strlen (r->connection->local_ip);
+ size += info.local_ip_len + sizeof (int32_t);
+
size += sizeof (int32_t);
- size += strlen (r->connection->remote_ip) + sizeof (int32_t);
+
+ info.remote_ip_len = strlen (r->connection->remote_ip);
+ size += info.remote_ip_len + sizeof (int32_t);
+
size += sizeof (int32_t);
- size += strlen (connection_get_remote_name (r)) + sizeof (int32_t);
+
+ info.remote_name = connection_get_remote_name (r);
+ info.remote_name_len = strlen (info.remote_name);
+
+ size += info.remote_name_len + sizeof (int32_t);
+
size += get_table_send_size (r->headers_in);
+
size++; /* byte. TRUE->auto_app, FALSE: configured application */
if (auto_app != FALSE) {
if (r->filename != NULL) {
- size += strlen (r->filename) + sizeof (int32_t);
+ info.filename_len = strlen (r->filename);
+ size += info.filename_len + sizeof (int32_t);
} else {
+ info.filename_len = 0;
auto_app = FALSE;
}
- }
+ } else
+ info.filename_len = 0;
- ptr = str = apr_pcalloc (r->pool, size);
- *ptr++ = PROTOCOL_VERSION; /* version. Keep in sync with ModMonoRequest. */
- ptr += write_string_to_buffer (ptr, 0, r->method);
+ DEBUG_PRINT (2, "Initial data size: %u", size);
+
+ if (size <= INITIAL_DATA_MAX_ALLOCA_SIZE)
+ ptr = str = alloca (size);
+ else
+ ptr = str = apr_pcalloc (r->pool, size);
+ *ptr++ = (char)PROTOCOL_VERSION; /* version. Keep in sync with ModMonoRequest. */
+ i = LE_FROM_INT (size);
+ memcpy (ptr, &i, sizeof (i));
+ ptr += sizeof (int32_t);
+ ptr += write_string_to_buffer (ptr, 0, r->method, info.method_len);
if (s != NULL)
- ptr += write_string_to_buffer (ptr, 0, (s->is_virtual ? s->server_hostname : NULL));
+ ptr += write_string_to_buffer (ptr, 0, (s->is_virtual ? s->server_hostname : NULL), info.server_hostname_len);
else
- ptr += write_string_to_buffer (ptr, 0, NULL);
- ptr += write_string_to_buffer (ptr, 0, r->uri);
- ptr += write_string_to_buffer (ptr, 0, r->args);
- ptr += write_string_to_buffer (ptr, 0, r->protocol);
+ ptr += write_string_to_buffer (ptr, 0, NULL, 0);
+ ptr += write_string_to_buffer (ptr, 0, r->uri, info.uri_len);
+ ptr += write_string_to_buffer (ptr, 0, r->args, info.args_len);
+ ptr += write_string_to_buffer (ptr, 0, r->protocol, info.protocol_len);
- ptr += write_string_to_buffer (ptr, 0, r->connection->local_ip);
+ ptr += write_string_to_buffer (ptr, 0, r->connection->local_ip, info.local_ip_len);
i = request_get_server_port (r);
i = LE_FROM_INT (i);
- memcpy (ptr, &i, sizeof (int32_t));
+ memcpy (ptr, &i, sizeof (i));
ptr += sizeof (int32_t);
- ptr += write_string_to_buffer (ptr, 0, r->connection->remote_ip);
+ ptr += write_string_to_buffer (ptr, 0, r->connection->remote_ip, info.remote_ip_len);
i = connection_get_remote_port (r->connection);
i = LE_FROM_INT (i);
- memcpy (ptr, &i, sizeof (int32_t));
+ memcpy (ptr, &i, sizeof (i));
ptr += sizeof (int32_t);
- ptr += write_string_to_buffer (ptr, 0, connection_get_remote_name (r));
+ ptr += write_string_to_buffer (ptr, 0, info.remote_name, info.remote_name_len);
ptr += write_table_to_buffer (ptr, r->headers_in);
*ptr++ = auto_app;
if (auto_app != FALSE)
- ptr += write_string_to_buffer (ptr, 0, r->filename);
+ ptr += write_string_to_buffer (ptr, 0, r->filename, info.filename_len);
if (write_data (sock, str, size) != size)
return -1;
@@ -1905,6 +1997,14 @@
static int
increment_active_requests (xsp_data *conf)
{
+#ifndef APACHE13
+ /* This function tries to increment the counters that limit
+ * the number of simultaenous requests being processed. It
+ * assumes that the mutex is held when the function is called
+ * and returns with the mutex still held, although it may
+ * unlock and lock the mutex itself.
+ */
+
apr_status_t rv;
int max_active_requests = atoi(conf->max_active_requests);
@@ -1913,21 +2013,20 @@
/* Limit the number of concurrent requests. If no
* limiting is in effect (or can't be done because
* there is no dashboard), return the OK status.
- * Same test as in the decrement function. */
- if (max_active_requests == 0 || !conf->dashboard_mutex || !conf->dashboard)
+ * Same test as in the decrement function and the
+ * control panel. */
+ if (!conf->dashboard_mutex || !conf->dashboard)
return 1;
- rv = apr_global_mutex_lock (conf->dashboard_mutex);
- /* Drop the request on failure to lock the dashboard because
- * we don't want to decrement the counter later since we couldn't
- * increment it here. */
- if (rv != APR_SUCCESS)
- return 0;
-
// From here on, rv holds onto whether we still have
// the lock acquired, just in case some error ocurrs
// acquiring it during the loop.
- if (conf->dashboard->active_requests >= max_active_requests) {
+ rv = APR_SUCCESS;
+
+ /* If any limiting is in effect, and if there are the maximum
+ * allowed concurrent requests, then we have to hold the request
+ * for a bit of time. */
+ if (max_active_requests > 0 && conf->dashboard->active_requests >= max_active_requests) {
/* We need to wait until the active requests
* go below the maximum. */
@@ -1937,7 +2036,6 @@
* is max_active_req+max_waiting_req.
*/
if (conf->dashboard->waiting_requests >= max_waiting_requests) {
- apr_global_mutex_unlock (conf->dashboard_mutex);
ap_log_error (APLOG_MARK, APLOG_ERR, STATUS_AND_SERVER,
"Maximum number of concurrent mod_mono requests to %s reached (%d active, %d waiting). Request dropped.",
conf->dashboard_lock_file, max_active_requests, max_waiting_requests);
@@ -1972,7 +2070,6 @@
// many requests are going, stop processing the
// request.
if (rv == APR_SUCCESS && conf->dashboard->active_requests >= max_active_requests) {
- apr_global_mutex_unlock (conf->dashboard_mutex);
ap_log_error (APLOG_MARK, APLOG_ERR, STATUS_AND_SERVER,
"Maximum number (%d) of concurrent mod_mono requests to %s reached. Droping request.",
max_active_requests, conf->dashboard_lock_file);
@@ -1987,21 +2084,22 @@
return 0;
conf->dashboard->active_requests++;
- apr_global_mutex_unlock (conf->dashboard_mutex);
return 1;
+#else
+ return 1;
+#endif
}
-static void
+ static void
decrement_active_requests (xsp_data *conf)
{
+#ifndef APACHE13
apr_status_t rv;
- int max_active_requests = atoi(conf->max_active_requests);
-
/* Check if limiting is in effect. Same test as in the
- * increment function. */
- if (max_active_requests == 0 || !conf->dashboard_mutex || !conf->dashboard)
+ * increment function and the control panel. */
+ if (!conf->dashboard_mutex || !conf->dashboard)
return;
rv = apr_global_mutex_lock (conf->dashboard_mutex);
@@ -2012,6 +2110,7 @@
if (rv == APR_SUCCESS)
apr_global_mutex_unlock (conf->dashboard_mutex);
+#endif
}
static int
@@ -2098,12 +2197,23 @@
} else
conf->dashboard_mutex_initialized_in_child = 1;
}
+
+ if (conf->dashboard_mutex && conf->dashboard) {
+ if (apr_global_mutex_lock (conf->dashboard_mutex) == APR_SUCCESS) {
+ int ok = conf->dashboard->accepting_requests;
+ if (ok)
+ ok = increment_active_requests (conf);
+
+ apr_global_mutex_unlock (conf->dashboard_mutex);
+
+ if (!ok)
+ return HTTP_SERVICE_UNAVAILABLE;
+ }
+ }
#endif
rv = -1; /* avoid a warning about uninitialized value */
- if (!increment_active_requests (conf))
- return HTTP_SERVICE_UNAVAILABLE;
-
+
while (connect_attempts--) {
rv = setup_socket (&sock, conf, r->pool);
DEBUG_PRINT (2, "After setup_socket");
@@ -2507,6 +2617,31 @@
return terminate_xsp2(data, NULL, 0, 0);
}
+static void
+set_accepting_requests (void *data, char *alias, int accepting_requests)
+{
+ server_rec *server;
+ module_cfg *config;
+ xsp_data *xsp;
+ int i;
+
+ server = (server_rec *) data;
+ config = ap_get_module_config (server->module_config, &mono_module);
+
+ for (i = 0; i < config->nservers; i++) {
+ xsp = &config->servers [i];
+
+ /* If alias isn't null, skip XSPs that don't have that alias. */
+ if (alias != NULL && strcmp(xsp->alias, alias))
+ continue;
+
+#ifndef APACHE13
+ if (xsp->dashboard)
+ xsp->dashboard->accepting_requests = accepting_requests;
+#endif
+ }
+}
+
static int
mono_control_panel_handler (request_rec *r)
{
@@ -2534,43 +2669,63 @@
uri = &r->parsed_uri;
if (!uri->query || !strcmp (uri->query, "")) {
/* No query string -> Emit links for configuration commands. */
- request_send_response_string (r, "\n");
+ request_send_response_string (r, "<ul>\n");
+ request_send_response_string (r, "<li><div>All Backends</div>\n<ul>\n");
request_send_response_string (r, "<li>Restart all mod-mono-server processes</a></li>\n");
+ request_send_response_string (r, "<li>Stop Accepting Requests</a></li>\n");
+ request_send_response_string (r, "<li>Resume Accepting Requests</a></li>\n");
+ request_send_response_string (r, "</ul></li>\n");
for (i = 0; i < config->nservers; i++) {
xsp = &config->servers [i];
if (xsp->run_xsp && !strcasecmp (xsp->run_xsp, "false"))
continue;
- buffer = apr_psprintf (r->pool, "<li>%s: "
- "Restart Server</a>", xsp->alias, xsp->alias);
+ buffer = apr_psprintf (r->pool, "<li><div>%s</div><ul>\n", xsp->alias);
+ request_send_response_string(r, buffer);
+
+ buffer = apr_psprintf (r->pool, "<li>Restart Server</a></li>\n", xsp->alias);
request_send_response_string(r, buffer);
#ifndef APACHE13
ensure_dashboard_initialized (config, xsp, pconf);
- if (xsp->dashboard_mutex) {
- rv = apr_global_mutex_lock (xsp->dashboard_mutex);
- if (rv == APR_SUCCESS) {
- if (xsp->restart_mode == AUTORESTART_MODE_REQUESTS) {
- buffer = apr_psprintf (r->pool, " [%d requests served; limit: %d]",
- xsp->dashboard->handled_requests, xsp->restart_requests);
- request_send_response_string(r, buffer);
- } else if (xsp->restart_mode == AUTORESTART_MODE_TIME) {
- buffer = apr_psprintf (r->pool, " [%ds time running; limit: %ds]",
- (int)(time(NULL) - xsp->dashboard->start_time), (int)xsp->restart_time);
- request_send_response_string(r, buffer);
- }
-
- rv = apr_global_mutex_unlock (xsp->dashboard_mutex);
- if (rv != APR_SUCCESS)
- ap_log_error (APLOG_MARK, APLOG_ALERT, STATCODE_AND_SERVER (rv),
- "Failed to release %s lock after mono-ctrl output, the process may deadlock!",
- xsp->dashboard_lock_file);
+ if (xsp->dashboard_mutex && xsp->dashboard
+ && apr_global_mutex_lock (xsp->dashboard_mutex) == APR_SUCCESS) {
+
+ if (xsp->dashboard->accepting_requests)
+ buffer = apr_psprintf (r->pool, "<li>Stop Accepting Requests</a></li>\n", xsp->alias);
+ else
+ buffer = apr_psprintf (r->pool, "<li>Resume Accepting Requests</a></li>\n", xsp->alias);
+ request_send_response_string(r, buffer);
+
+ if (xsp->restart_mode == AUTORESTART_MODE_REQUESTS) {
+ buffer = apr_psprintf (r->pool, "<li>%d requests served; limit: %d</li>\n",
+ xsp->dashboard->handled_requests, xsp->restart_requests);
+ request_send_response_string(r, buffer);
+ } else if (xsp->restart_mode == AUTORESTART_MODE_TIME) {
+ buffer = apr_psprintf (r->pool, "<li>%ds time running; limit: %ds</li>\n",
+ (int)(time(NULL) - xsp->dashboard->start_time), (int)xsp->restart_time);
+ request_send_response_string(r, buffer);
}
+
+ buffer = apr_psprintf (r->pool, "<li>%d requests currently being processed; limit: %s</li>\n",
+ xsp->dashboard->active_requests, xsp->max_active_requests);
+ request_send_response_string(r, buffer);
+
+ buffer = apr_psprintf (r->pool, "<li>%d requests currently waiting to be processed; limit: %s</li>\n",
+ xsp->dashboard->waiting_requests, xsp->max_waiting_requests);
+ request_send_response_string(r, buffer);
+
+
+ rv = apr_global_mutex_unlock (xsp->dashboard_mutex);
+ if (rv != APR_SUCCESS)
+ ap_log_error (APLOG_MARK, APLOG_ALERT, STATCODE_AND_SERVER (rv),
+ "Failed to release %s lock after mono-ctrl output, the process may deadlock!",
+ xsp->dashboard_lock_file);
}
#endif
- request_send_response_string(r, "</li>\n");
+ request_send_response_string(r, "</ul></li>\n");
}
request_send_response_string (r, "</ul>\n");
@@ -2580,9 +2735,25 @@
char *alias = uri->query + 8; /* +8 == .Substring(8) */
if (!strcmp (alias, "ALL"))
alias = NULL;
+ set_accepting_requests (r->server, alias, 0);
terminate_xsp2 (r->server, alias, 1, 0);
start_xsp (config, 1, alias);
+ set_accepting_requests (r->server, alias, 1);
request_send_response_string (r, "mod-mono-server processes restarted.</div><br>\n");
+ } else if (uri->query && !strncmp (uri->query, "pause=", 6)) {
+ /* Stop accepting requests for this server */
+ char *alias = uri->query + 6; /* +6 == .Substring(6) */
+ if (!strcmp (alias, "ALL"))
+ alias = NULL;
+ set_accepting_requests (r->server, alias, 0);
+ request_send_response_string (r, "
no longer accepting requests</div><br>\n");
+ } else if (uri->query && !strncmp (uri->query, "resume=", 7)) {
+ /* Resume accepting requests for this server */
+ char *alias = uri->query + 7; /* +7 == .Substring(7) */
+ if (!strcmp (alias, "ALL"))
+ alias = NULL;
+ set_accepting_requests (r->server, alias, 1);
+ request_send_response_string (r, "
resumed accepting requests</div><br>\n");
} else {
/* Invalid command. */
request_send_response_string (r, "
Invalid query string command.</div>\n");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/mod_mono-1.9/src/mod_mono.h new/mod_mono-2.0/src/mod_mono.h
--- old/mod_mono-1.9/src/mod_mono.h 2007-11-09 00:18:37.000000000 +0100
+++ new/mod_mono-2.0/src/mod_mono.h 2008-07-15 19:52:53.000000000 +0200
@@ -62,7 +62,7 @@
#endif
/* KEEP IN SYNC WITH ModMonoRequest!! */
-#define PROTOCOL_VERSION 8
+#define PROTOCOL_VERSION 9
#ifdef APACHE13
/* Functions needed for making Apache 1.3 module as similar
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org