<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:www.nabble.com,2006:forum-110</id>
	<title>Nabble - APR Dev (Apache Portable Runtime)</title>
	<updated>2008-10-07T15:08:49Z</updated>
	<link rel="self" type="application/atom+xml" href="http://www.nabble.com/APR-Dev-(Apache-Portable-Runtime)-f110.xml" />
	<link rel="alternate" type="text/html" href="http://www.nabble.com/APR-Dev-%28Apache-Portable-Runtime%29-f110.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:www.nabble.com,2006:post-19868446</id>
	<title>Re: apr_memcache 1.3.X sending unnecessary QUIT to memcached server</title>
	<published>2008-10-07T15:08:49Z</published>
	<updated>2008-10-07T15:08:49Z</updated>
	<author>
		<name>peter baer</name>
	</author>
	<content type="html">On Fri, Oct 3, 2008 at 3:48 AM, Ruediger Pluem &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19868446&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rpluem@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; I guess the documentation is wrong. This behaviour was changed a while
&lt;br&gt;&amp;gt; ago to the behaviour you describe: If a resource is expired it will not
&lt;br&gt;&amp;gt; be handed out any longer but it will be closed. This is needed / useful
&lt;br&gt;&amp;gt; e.g. for database connections that become faulty after some time because
&lt;br&gt;&amp;gt; the database server closes them after some time of inactivity or a firewall
&lt;br&gt;&amp;gt; in between breaks the connection after some time. It is also very useful
&lt;br&gt;&amp;gt; when pooling persistent http connections and you know the keepalive
&lt;br&gt;&amp;gt; timeout settings of your backend.
&lt;br&gt;&lt;br&gt;With the current revision of apr_util (apr_memcache) we were
&lt;br&gt;encountering a memory leak issue and sub-optimal behavior in the
&lt;br&gt;following scenario:
&lt;br&gt;&lt;br&gt;A massively parallel application (several hundred processing threads),
&lt;br&gt;each needing (during message processing) to make several memcache
&lt;br&gt;queries every second. A patch was applied recently that effectively
&lt;br&gt;handles memory leaks in the apr_memcache module by calling free on the
&lt;br&gt;APR Pool from the Resource List destructor every TTL microseconds.
&lt;br&gt;This put users of the memcache module in some what of a bind, they are
&lt;br&gt;forced to choose between:
&lt;br&gt;- Setting the TTL to a high value and leaking memory under high load
&lt;br&gt;circumstances (the TTL is never hit because each socket is being used
&lt;br&gt;frequently)
&lt;br&gt;&amp;nbsp;As a side note we considered modifying the socket selection algorithm
&lt;br&gt;to incrementally move through the socket list (currently it selects
&lt;br&gt;the first available socket), this would allow us to set a large TTL
&lt;br&gt;(reduce TCP connection overhead) but necessitates a large minimum
&lt;br&gt;number of connections to the memcache server
&lt;br&gt;- Setting the TTL to a low value (hundreds or thousands of
&lt;br&gt;microseconds) and having to reconnect to the memcache server for each
&lt;br&gt;request
&lt;br&gt;&lt;br&gt;What we are trying to accomplish is having a large number (50-100) of
&lt;br&gt;persistent connections to the memcache server(s). &amp;nbsp;This is not
&lt;br&gt;currently possible without leaking large amounts of memory.
&lt;br&gt;&lt;br&gt;The reason the current stable revision of apr_memcache is leaking
&lt;br&gt;memory is due to its use of a Bucket Brigade structure inside the
&lt;br&gt;socket/conn structure, it copies the data off of the socket buffer
&lt;br&gt;into this Bucket Brigade and then copies onto the APR Pool specified
&lt;br&gt;in the apr_memcache_getp function call. &amp;nbsp;The data stays in the Bucket
&lt;br&gt;Brigade until the TTL expires on the socket/conn in which case both
&lt;br&gt;the socket is torn down and the Bucket Brigade is cleared.
&lt;br&gt;Our fix simply removes this extra step and bypasses the Bucket
&lt;br&gt;Brigade, instead copying the data directly to the pool specified in
&lt;br&gt;the apr_memcache_getp function call.
&lt;br&gt;&lt;br&gt;This has worked great for us, no more memory leaks and very few TCP
&lt;br&gt;reconnections (TTL at 120 second, 120,000,000 micro seconds),
&lt;br&gt;hopefully it works well for everyone else in the community :)
&lt;br&gt;&lt;br&gt;Credits for this patch go to:
&lt;br&gt;Tavis Paquette (tavis at galaxytelecom dot net)
&lt;br&gt;Peter Baer (pbaer at galaxytelecom dot net)
&lt;br&gt;&lt;br /&gt;&lt;tt&gt;[apr-util-1.3.4.patch]&lt;/tt&gt;&lt;br /&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;tt&gt;--- apr-util-1.3.4.old/memcache/apr_memcache.c	2008-08-12 18:47:05.000000000 +0000
&lt;br&gt;+++ apr-util-1.3.4/memcache/apr_memcache.c	2008-10-06 20:00:40.000000000 +0000
&lt;br&gt;@@ -797,39 +797,26 @@ apr_memcache_getp(apr_memcache_t *mc,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*baton = NULL;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else {
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;apr_bucket_brigade *bbb;
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;apr_bucket *e;
&lt;br&gt;-
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/* eat the trailing \r\n */
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;rv = apr_brigade_partition(conn-&amp;gt;bb, len+2, &amp;e);
&lt;br&gt;-
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;rv = get_server_line(conn);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (rv != APR_SUCCESS) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ms_bad_conn(ms, conn);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;apr_memcache_disable_server(mc, ms);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return rv;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bbb = apr_brigade_split(conn-&amp;gt;bb, e);
&lt;br&gt;-
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;rv = apr_brigade_pflatten(conn-&amp;gt;bb, baton, &amp;len, p);
&lt;br&gt;-
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (rv != APR_SUCCESS) {
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (len &amp;gt; conn-&amp;gt;blen) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ms_bad_conn(ms, conn);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;apr_memcache_disable_server(mc, ms);
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return rv;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return APR_EGENERAL;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;-
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;rv = apr_brigade_destroy(conn-&amp;gt;bb);
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (rv != APR_SUCCESS) {
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*baton = apr_palloc(p, len+1);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (*baton == NULL) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ms_bad_conn(ms, conn);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;apr_memcache_disable_server(mc, ms);
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return rv;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return APR_ENOMEM;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;-
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;conn-&amp;gt;bb = bbb;
&lt;br&gt;-
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*new_length = len - 2;
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(*baton)[*new_length] = '\0';
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;memcpy(*baton, conn-&amp;gt;buffer, len);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(*baton)[len] = '\0';
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*new_length = len;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;rv = get_server_line(conn);
&lt;br&gt;&lt;/tt&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_memcache-1.3.X-sending-unnecessary-QUIT-to-memcached-server-tp19426314p19868446.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19832445</id>
	<title>Bug report for APR [2008/10/05]</title>
	<published>2008-10-05T23:08:45Z</published>
	<updated>2008-10-05T23:08:45Z</updated>
	<author>
		<name>Bugzilla from bugzilla@apache.org</name>
	</author>
	<content type="html">+---------------------------------------------------------------------------+
&lt;br&gt;| Bugzilla Bug ID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;| &amp;nbsp; &amp;nbsp; +---------------------------------------------------------------------+
&lt;br&gt;| &amp;nbsp; &amp;nbsp; | Status: UNC=Unconfirmed NEW=New &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ASS=Assigned &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;| &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; OPN=Reopened &amp;nbsp; &amp;nbsp;VER=Verified &amp;nbsp; &amp;nbsp;(Skipped Closed/Resolved) &amp;nbsp; |
&lt;br&gt;| &amp;nbsp; &amp;nbsp; | &amp;nbsp; +-----------------------------------------------------------------+
&lt;br&gt;| &amp;nbsp; &amp;nbsp; | &amp;nbsp; | Severity: BLK=Blocker CRI=Critical &amp;nbsp;REG=Regression &amp;nbsp;MAJ=Major &amp;nbsp; |
&lt;br&gt;| &amp;nbsp; &amp;nbsp; | &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MIN=Minor &amp;nbsp; NOR=Normal &amp;nbsp; &amp;nbsp;ENH=Enhancement TRV=Trivial |
&lt;br&gt;| &amp;nbsp; &amp;nbsp; | &amp;nbsp; | &amp;nbsp; +-------------------------------------------------------------+
&lt;br&gt;| &amp;nbsp; &amp;nbsp; | &amp;nbsp; | &amp;nbsp; | Date Posted &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;| &amp;nbsp; &amp;nbsp; | &amp;nbsp; | &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;+--------------------------------------------------+
&lt;br&gt;| &amp;nbsp; &amp;nbsp; | &amp;nbsp; | &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| Description &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;| &amp;nbsp; &amp;nbsp; | &amp;nbsp; | &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|16056|Inf|Enh|2003-01-14|Shared memory &amp; mutex ownership not correctly esta|
&lt;br&gt;|20382|New|Nor|2003-05-31|Poor performance on W2000 AS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|28453|New|Enh|2004-04-18|apr_uri should parse relative to a base URI &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;|33188|Inf|Nor|2005-01-21|libtool linking failure on Suse &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;|33490|Inf|Nor|2005-02-10|APR does not compile with Borland C++ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;|38410|New|Nor|2006-01-27|apr/win32 misinterpreted the meaning of WAIT_ABAND|
&lt;br&gt;|39289|New|Enh|2006-04-12|test suite additions for trylock functions &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|39853|Inf|Nor|2006-06-21|apr_strtoi64 does not build on WinCE due to lack o|
&lt;br&gt;|39895|New|Enh|2006-06-23|apr_os_strerror on WinCE needs to xlate unicode-&amp;gt;u|
&lt;br&gt;|39896|New|Enh|2006-06-23|Output test status to OutputDebugString in additio|
&lt;br&gt;|40020|New|Enh|2006-07-11|Add support for apr_uint8_t and apr_int8_t types &amp;nbsp;|
&lt;br&gt;|40193|Inf|Nor|2006-08-06|Patches to support different compiler than EMX on |
&lt;br&gt;|40622|New|Enh|2006-09-27|enhance apr temp files on NT to be more secure &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|40758|Ver|Maj|2006-10-15|WIN64, apr_vformatter(..) cannot handle 64bit poin|
&lt;br&gt;|40939|New|Enh|2006-11-09|pool minimal allocation size should be configurabl|
&lt;br&gt;|41099|New|Enh|2006-12-03|Manually block apr_queue_pop(), apr_queue_push(), |
&lt;br&gt;|41192|Inf|Trv|2006-12-17|Add the expat libtool file to the LT_LDFLAGS varia|
&lt;br&gt;|41254|New|Enh|2006-12-28|apr_queue_t enhancements &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|41351|Ass|Enh|2007-01-11|Tivoli LDAP SDK support in aprutil &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|41352|Ass|Min|2007-01-11|openldap and per-connection client certificates in|
&lt;br&gt;|41807|New|Enh|2007-03-10|dbd driver registration function &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|41916|Inf|Nor|2007-03-21|MinGW support &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;|42365|New|Enh|2007-05-09|Suppress console for apr_proc_create() created pro|
&lt;br&gt;|42728|New|Nor|2007-06-23|mod_ssl thread detaching not releasing handles &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|42848|New|Enh|2007-07-10|add IP TOS support to apr_socket_opt_set() &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|43000|Ass|Blk|2007-07-30|./testall always freeze on testsockets &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|43035|New|Enh|2007-08-04|Add ability to wrap ssl around pre-existing socket|
&lt;br&gt;|43066|New|Nor|2007-08-08|get_password on Windows is kludgy &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;|43152|Inf|Nor|2007-08-16|apr_socket_opt_get doesn't work with APR_SO_SNDBUF|
&lt;br&gt;|43172|Ass|Nor|2007-08-20|apr-util don't want to find mozldap-6.x &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;|43217|New|Min|2007-08-26|All-ones IPv6 subnet mask not accepted &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|43244|New|Enh|2007-08-29|apr_socket_t missing dup, dup2 and setaside &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;|43302|New|Nor|2007-09-04|apr_bucket_socket doesn't work with non-connected |
&lt;br&gt;|43309|New|Enh|2007-09-05|add apr_socket_sendtov support &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|43375|Ass|Nor|2007-09-13|Pool integrity check fails for apr threads &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|43499|New|Nor|2007-09-27|apr_global_mutex_create returns error &amp;quot;Access deni|
&lt;br&gt;|43507|New|Enh|2007-09-28|configure flag for SHELL_PATH &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;|43508|New|Enh|2007-09-28|Please be available whether atomics use thread mut|
&lt;br&gt;|43793|New|Enh|2007-11-04|builtin atomics on Windows &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|44127|New|Enh|2007-12-21|File Extended Attributes Support &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|44128|New|Enh|2007-12-21|apr_os_file_put() does not register a cleanup hand|
&lt;br&gt;|44129|New|Enh|2007-12-21|apr_os_dir_put() does not allocate an entry buffer|
&lt;br&gt;|44186|New|Nor|2008-01-08|[PATCH] Add memcached 1.2.4 features to apr_memcac|
&lt;br&gt;|44230|New|Enh|2008-01-14|Add Ark Linux support to config.layout &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|44432|New|Enh|2008-02-15|patch - proposal for application function hooks &amp;nbsp; |
&lt;br&gt;|44550|Inf|Maj|2008-03-06|Solaris sendfilev() handling - EINTR appears to ha|
&lt;br&gt;|44684|Inf|Nor|2008-03-26|32 libexpat used instead of 64 bit &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|44761|Inf|Nor|2008-04-06|apr_uri_parse doesn't set path to &amp;quot;/&amp;quot; for 'http://|
&lt;br&gt;|45232|Ass|Nor|2008-06-18|Empty APU_MODULES makes sh syntax error &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;|45256|New|Maj|2008-06-23|lack of object check for null value cause expectio|
&lt;br&gt;|45276|Opn|Nor|2008-06-25|Little issue with srclib/apr-util/Makefile &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|45291|New|Nor|2008-06-26|apr_thread_t is leaking &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;|45298|New|Nor|2008-06-27|apr_os_thread_get() differs between windows and un|
&lt;br&gt;|45321|New|Min|2008-07-01|Handling IPV6_V6ONLY on NT 5.x &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|
&lt;br&gt;|45389|New|Nor|2008-07-13|testrand fails 5 tests (55%) - &amp;quot;line 62: randomnes|
&lt;br&gt;|45455|New|Nor|2008-07-22|rwlock sometimes allows a writer to take the lock |
&lt;br&gt;|45496|New|Enh|2008-07-29|[patch] adding directory matching [dir/**/conf.d/*|
&lt;br&gt;|45615|Inf|Nor|2008-08-11|&amp;quot;Large Files not supported&amp;quot; with 64-bit build &amp;nbsp; &amp;nbsp; |
&lt;br&gt;|45650|New|Min|2008-08-19|Application reports &amp;quot;The entry point freeaddrinfo |
&lt;br&gt;|45679|New|Nor|2008-08-23|SHA1 passwords starting with {SHA} don't work and |
&lt;br&gt;|45700|New|Nor|2008-08-27|incorrect sort order of apr_strnatcmp with non-ASC|
&lt;br&gt;|45800|New|Nor|2008-09-13|nonsensical code in srclib/apr/locks/beos/thread_c|
&lt;br&gt;|45857|New|Trv|2008-09-21|Possible mistake in doc for APR_DECLARE_DATA docum|
&lt;br&gt;|45930|New|Nor|2008-10-01|httpd.worker MPM fails to reset signal mask before|
&lt;br&gt;+-----+---+---+----------+--------------------------------------------------+
&lt;br&gt;| Total &amp;nbsp; 64 bugs &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |
&lt;br&gt;+---------------------------------------------------------------------------+
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Bug-report-for-APR--2008-10-05--tp19832445p19832445.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19830538</id>
	<title>Re: Corrected: global_mutex on Solaris 10, does it actually work?</title>
	<published>2008-10-05T17:33:28Z</published>
	<updated>2008-10-05T17:33:28Z</updated>
	<author>
		<name>William A. Rowe, Jr.</name>
	</author>
	<content type="html">Jim Jagielski wrote:
&lt;br&gt;&amp;gt; All this gets back to a pet enhancement of mine: the way to set, at
&lt;br&gt;&amp;gt; runtime, the mutex-type used for APR_LOCK_DEFAULT... Sometimes the
&lt;br&gt;&amp;gt; compile-type selection is non-optimal, and it would be great
&lt;br&gt;&amp;gt; to be able to adjust this for each specific impl, regardless
&lt;br&gt;&amp;gt; of how built.
&lt;br&gt;&lt;br&gt;Leads straight into the obvious question, where do we store 'apr
&lt;br&gt;performance and behavior characteristics'?
&lt;br&gt;&lt;br&gt;It came up 6 or 7 years ago or so, and because the need wasn't that
&lt;br&gt;pressing, it wasn't resolved.
&lt;br&gt;&lt;br&gt;On win32, one would think the registry makes good sense. &amp;nbsp;On unix,
&lt;br&gt;an /ect/apr.conf file makes good sense. &amp;nbsp;Other suggestions, ideas
&lt;br&gt;and exceptional cases?
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/global_mutex-on-Solaris-10%2C-does-it-actually-work--tp19803579p19830538.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19824888</id>
	<title>Re: Corrected: global_mutex on Solaris 10, does it actually work?</title>
	<published>2008-10-05T07:03:21Z</published>
	<updated>2008-10-05T07:03:21Z</updated>
	<author>
		<name>Jim Jagielski</name>
	</author>
	<content type="html">All this gets back to a pet enhancement of mine: the way to set, at
&lt;br&gt;runtime, the mutex-type used for APR_LOCK_DEFAULT... Sometimes the
&lt;br&gt;compile-type selection is non-optimal, and it would be great
&lt;br&gt;to be able to adjust this for each specific impl, regardless
&lt;br&gt;of how built.
&lt;br&gt;&lt;br&gt;comments?
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/global_mutex-on-Solaris-10%2C-does-it-actually-work--tp19803579p19824888.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19830530</id>
	<title>Static build of iconv CCS / CES under windows platfrom - Link problem</title>
	<published>2008-10-05T03:28:43Z</published>
	<updated>2008-10-05T03:28:43Z</updated>
	<author>
		<name>Assaf Nativ</name>
	</author>
	<content type="html">&lt;html xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot; xmlns:o=&quot;urn:schemas-microsoft-com:office:office&quot; xmlns:w=&quot;urn:schemas-microsoft-com:office:word&quot; xmlns:m=&quot;http://schemas.microsoft.com/office/2004/12/omml&quot; xmlns=&quot;http://www.w3.org/TR/REC-html40&quot;&gt;

&lt;head&gt;
&lt;meta http-equiv=Content-Type content=&quot;text/html; charset=us-ascii&quot;&gt;
&lt;meta name=Generator content=&quot;Microsoft Word 12 (filtered medium)&quot;&gt;

&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapedefaults v:ext=&quot;edit&quot; spidmax=&quot;1026&quot; /&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapelayout v:ext=&quot;edit&quot;&gt;
  &lt;o:idmap v:ext=&quot;edit&quot; data=&quot;1&quot; /&gt;
 &lt;/o:shapelayout&gt;&lt;/xml&gt;&lt;![endif]--&gt;
&lt;/head&gt;

&lt;body lang=EN-US link=blue vlink=purple&gt;

&lt;div class=Section1&gt;

&lt;p class=MsoNormal&gt;To whom it may concern.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;I think there is a problem with the build of apr-iconv
ccs/ces on windows when linked with static libs.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;On the modules.mk.win file, &amp;nbsp;There is a line for every
build which sentence for the linker which libs to use (ex. Line: 21)&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;But under every debug static build of any platform (Lines:
50, 92, 134 and 176), the line says&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&amp;#8220;APR_LIB = &amp;#8230; &amp;#8220;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;Instead of&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&amp;#8220;API_LIBS = &amp;#8230;&amp;#8221;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;Correcting it, fix the static build.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;To reproduce &amp;nbsp;the problem, one should use the following
build command:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;NMAKE /nologo /f Makefile.win BUILD_MODE=&amp;quot;Win32 Debug&amp;quot;
BIND_MODE=static&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;Affected version: libiconv 1.12&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;Please, do tell me if I got it all wrong.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;Thanks,&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;Assaf.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;/body&gt;

&lt;/html&gt;
</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Static-build-of-iconv-CCS---CES-under-windows-platfrom---Link-problem-tp19830530p19830530.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19819029</id>
	<title>Re: Maybe global_mutex breakage isn't a problem</title>
	<published>2008-10-04T16:18:48Z</published>
	<updated>2008-10-04T16:18:48Z</updated>
	<author>
		<name>Justin Erenkrantz</name>
	</author>
	<content type="html">On Sat, Oct 4, 2008 at 12:52 PM, Tim Bray &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19819029&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tim.Bray@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Um, maybe I'm an idiot. &amp;nbsp;There is after apr_file_lock(), which seems made to
&lt;br&gt;&amp;gt; order. &amp;nbsp;Just because I was thinking &amp;quot;mutex&amp;quot; didn't mean I actually needed
&lt;br&gt;&amp;gt; one.
&lt;br&gt;&lt;br&gt;Yup, plus apr_file_lock() has the benefit of anything else on the OS
&lt;br&gt;doing file locking will also fail - with a 'global' mutex, in order
&lt;br&gt;for it to work, it requires a process/thread-level relationship.
&lt;br&gt;(APR, by default, will use SysV semaphores with IPC_PRIVATE, so they
&lt;br&gt;aren't shared across two independent processes.) &amp;nbsp;-- justin
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/global_mutex-on-Solaris-10%2C-does-it-actually-work--tp19803579p19819029.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19816499</id>
	<title>Maybe global_mutex breakage isn't a problem</title>
	<published>2008-10-04T12:52:56Z</published>
	<updated>2008-10-04T12:52:56Z</updated>
	<author>
		<name>Tim Bray</name>
	</author>
	<content type="html">On Oct 3, 2008, at 1:55 PM, Tim Bray wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Good question. &amp;nbsp;Let me present the problem at a high level. &amp;nbsp;There's &amp;nbsp;
&lt;br&gt;&amp;gt; a file that is regularly refreshed, and I only want one request &amp;nbsp;
&lt;br&gt;&amp;gt; handler rebuilding it at a time, because otherwise there are lots of &amp;nbsp;
&lt;br&gt;&amp;gt; horrible race conditions. &amp;nbsp; I don't know whether I'm in worker or &amp;nbsp;
&lt;br&gt;&amp;gt; prefork mode. &amp;nbsp;So I simply want to serialize update of this file, &amp;nbsp;
&lt;br&gt;&amp;gt; and I thought apr_global_mutex_* was a good way to do this. &amp;nbsp;Is &amp;nbsp;
&lt;br&gt;&amp;gt; there a better way? &amp;nbsp;-Tim
&lt;br&gt;&lt;br&gt;Um, maybe I'm an idiot. &amp;nbsp;There is after apr_file_lock(), which seems &amp;nbsp;
&lt;br&gt;made to order. &amp;nbsp;Just because I was thinking &amp;quot;mutex&amp;quot; didn't mean I &amp;nbsp;
&lt;br&gt;actually needed one.
&lt;br&gt;&lt;br&gt;&amp;nbsp; -Tim
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/global_mutex-on-Solaris-10%2C-does-it-actually-work--tp19803579p19816499.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19810181</id>
	<title>Re: apr_file_* weirdness on Mac OS X</title>
	<published>2008-10-04T01:46:13Z</published>
	<updated>2008-10-04T01:46:13Z</updated>
	<author>
		<name>Bojan Smojver</name>
	</author>
	<content type="html">On Fri, 2008-10-03 at 08:50 -0700, Tim Bray wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Um, I know that. &amp;nbsp;But apr_file_mktemp doesn't let you control where &amp;nbsp;
&lt;br&gt;&amp;gt; the temp file goes, right?
&lt;br&gt;&lt;br&gt;If you give it full pathname in the template, doesn't that allow you to
&lt;br&gt;put it where you want it?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Bojan
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_file_*-weirdness-on-Mac-OS-X-tp19792880p19810181.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19809490</id>
	<title>Re: Corrected: global_mutex on Solaris 10, does it actually work?</title>
	<published>2008-10-03T23:28:09Z</published>
	<updated>2008-10-03T23:28:09Z</updated>
	<author>
		<name>Tim Bray</name>
	</author>
	<content type="html">On Oct 3, 2008, at 1:03 PM, William A. Rowe, Jr. wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; If we compare this to apr_shm_create / apr_shm_attach, it's pretty &amp;nbsp;
&lt;br&gt;&amp;gt; clear we
&lt;br&gt;&amp;gt; are just missing the mechanics to solve this. &amp;nbsp;apr_proc| 
&lt;br&gt;&amp;gt; global_mutex_attach
&lt;br&gt;&amp;gt; is missing, and this should just be mopped up for apr 1.4.0, and &amp;nbsp;
&lt;br&gt;&amp;gt; absolutely
&lt;br&gt;&amp;gt; before 2.0.0.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The other solutions that come to mind are all very, very crufty &amp;nbsp;
&lt;br&gt;&amp;gt; hacks against
&lt;br&gt;&amp;gt; specific solutions, e.g. an apr_os_proc_mutex_put sort of solution. &amp;nbsp; 
&lt;br&gt;&amp;gt; It really
&lt;br&gt;&amp;gt; is the API that needs repair.
&lt;/div&gt;&lt;br&gt;Assuming Bill's right and this is actually a missing API, let me add &amp;nbsp;
&lt;br&gt;some urgency with a use case.
&lt;br&gt;&lt;br&gt;What I'm doing is implementing PUT, for the AtomPub protocol, against &amp;nbsp;
&lt;br&gt;a file-backed store. &amp;nbsp;Since it's file-backed, it fits very nicely in &amp;nbsp;
&lt;br&gt;with httpd's default code paths.
&lt;br&gt;&lt;br&gt;For PUT, I want to be able to support conditional update with ETags &amp;nbsp;
&lt;br&gt;and If-Match headers; done correctly, this can guarantee against lost &amp;nbsp;
&lt;br&gt;updates. &amp;nbsp;But this totally obviously needs a critical section. After &amp;nbsp;
&lt;br&gt;you've done map_to_storage to find the file your r-&amp;gt;uri maps to, you &amp;nbsp;
&lt;br&gt;*really* need to grab a global_mutex against that file while you &amp;nbsp;
&lt;br&gt;compute the ETag and compare it to the If-Match value, and either &amp;nbsp;
&lt;br&gt;reject or accept-and-implement the PUT.
&lt;br&gt;&lt;br&gt;Summary: you can't implement PUT correctly inside httpd unless you can &amp;nbsp;
&lt;br&gt;create and attach to arbitrary mutexes at runtime.
&lt;br&gt;&lt;br&gt;I've actually figured out a way to kludge around this, but it's kinda &amp;nbsp;
&lt;br&gt;gross.
&lt;br&gt;&lt;br&gt;&amp;nbsp; -Tim
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/global_mutex-on-Solaris-10%2C-does-it-actually-work--tp19803579p19809490.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19806134</id>
	<title>Re: Corrected: global_mutex on Solaris 10, does it actually work?</title>
	<published>2008-10-03T14:47:17Z</published>
	<updated>2008-10-03T14:47:17Z</updated>
	<author>
		<name>Ruediger Pluem</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;On 10/03/2008 10:55 PM, Tim Bray wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Oct 3, 2008, at 1:16 PM, Ruediger Pluem wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; This maybe because the default locking mechanism on OS X is different
&lt;br&gt;&amp;gt;&amp;gt; from the
&lt;br&gt;&amp;gt;&amp;gt; one on Solaris. AFAICR Solaris has fcntl as default mechanism.
&lt;br&gt;&amp;gt;&amp;gt; The question is: Why do you create this file beforehand? If a file
&lt;br&gt;&amp;gt;&amp;gt; needs to be
&lt;br&gt;&amp;gt;&amp;gt; created apr_global_mutex_create will do this for you.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Good question. &amp;nbsp;Let me present the problem at a high level. &amp;nbsp;There's a
&lt;br&gt;&amp;gt; file that is regularly refreshed, and I only want one request handler
&lt;br&gt;&amp;gt; rebuilding it at a time, because otherwise there are lots of horrible
&lt;br&gt;&amp;gt; race conditions. &amp;nbsp; I don't know whether I'm in worker or prefork mode. 
&lt;br&gt;&amp;gt; So I simply want to serialize update of this file, and I thought
&lt;br&gt;&amp;gt; apr_global_mutex_* was a good way to do this. &amp;nbsp;Is there a better way? &amp;nbsp;-Tim
&lt;/div&gt;&lt;br&gt;It seems that you have found the correct way. It is just that the file
&lt;br&gt;you want to refresh from one request handler and the file that is eventually
&lt;br&gt;used for locking are two different things. Using the default method it is not
&lt;br&gt;even clear if the filename is used depending on the platform you use. So consider
&lt;br&gt;the filename as some sort of abstract name for your lock that needs to be
&lt;br&gt;known to use the same lock in a different process. But I am no expert on this
&lt;br&gt;and as Bill mentioned in the other mail the APR API might lack the needed operations,
&lt;br&gt;if there is no parent / child relationship between them.
&lt;br&gt;As you seem to work inside httpd I think you should use the post_config hook to create
&lt;br&gt;the global mutex and the child_init hook to reattach to this lock in each
&lt;br&gt;child via
&lt;br&gt;&lt;br&gt;apr_global_mutex_child_init
&lt;br&gt;&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;&lt;br&gt;Rüdiger
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/global_mutex-on-Solaris-10%2C-does-it-actually-work--tp19803579p19806134.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19805467</id>
	<title>Re: Corrected: global_mutex on Solaris 10, does it actually work?</title>
	<published>2008-10-03T13:55:47Z</published>
	<updated>2008-10-03T13:55:47Z</updated>
	<author>
		<name>Tim Bray</name>
	</author>
	<content type="html">On Oct 3, 2008, at 1:16 PM, Ruediger Pluem wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; This maybe because the default locking mechanism on OS X is &amp;nbsp;
&lt;br&gt;&amp;gt; different from the
&lt;br&gt;&amp;gt; one on Solaris. AFAICR Solaris has fcntl as default mechanism.
&lt;br&gt;&amp;gt; The question is: Why do you create this file beforehand? If a file &amp;nbsp;
&lt;br&gt;&amp;gt; needs to be
&lt;br&gt;&amp;gt; created apr_global_mutex_create will do this for you.
&lt;br&gt;&lt;br&gt;Good question. &amp;nbsp;Let me present the problem at a high level. &amp;nbsp;There's a &amp;nbsp;
&lt;br&gt;file that is regularly refreshed, and I only want one request handler &amp;nbsp;
&lt;br&gt;rebuilding it at a time, because otherwise there are lots of horrible &amp;nbsp;
&lt;br&gt;race conditions. &amp;nbsp; I don't know whether I'm in worker or prefork &amp;nbsp;
&lt;br&gt;mode. &amp;nbsp;So I simply want to serialize update of this file, and I &amp;nbsp;
&lt;br&gt;thought apr_global_mutex_* was a good way to do this. &amp;nbsp;Is there a &amp;nbsp;
&lt;br&gt;better way? &amp;nbsp;-Tim
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/global_mutex-on-Solaris-10%2C-does-it-actually-work--tp19803579p19805467.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19804849</id>
	<title>Re: Corrected: global_mutex on Solaris 10, does it actually work?</title>
	<published>2008-10-03T13:16:41Z</published>
	<updated>2008-10-03T13:16:41Z</updated>
	<author>
		<name>Ruediger Pluem</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;On 10/03/2008 09:39 PM, Tim Bray wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Correcting two errors in my original post, why don't I just copy &amp; paste?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; So, there's this file I want to update, suppose its name is in the
&lt;br&gt;&amp;gt; variable &amp;quot;filename&amp;quot;, so I go
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;status = apr_global_mutex_create(&amp;mutex, filename, &amp;nbsp;APR_LOCK_DEFAULT,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pool);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; And on Solaris 10, this fails with EEXIST, i.e. strerror says &amp;quot;File
&lt;br&gt;&amp;gt; exists&amp;quot;. &amp;nbsp;(This doesn't happen on OS X). &amp;nbsp;Well, yeah, it exists, I
&lt;/div&gt;&lt;br&gt;This maybe because the default locking mechanism on OS X is different from the
&lt;br&gt;one on Solaris. AFAICR Solaris has fcntl as default mechanism.
&lt;br&gt;The question is: Why do you create this file beforehand? If a file needs to be
&lt;br&gt;created apr_global_mutex_create will do this for you.
&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;&lt;br&gt;Rüdiger
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/global_mutex-on-Solaris-10%2C-does-it-actually-work--tp19803579p19804849.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19804765</id>
	<title>Re: apr_file_* weirdness on Mac OS X</title>
	<published>2008-10-03T13:10:52Z</published>
	<updated>2008-10-03T13:10:52Z</updated>
	<author>
		<name>Ruediger Pluem</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;On 10/03/2008 05:50 PM, Tim Bray wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Um, I know that. &amp;nbsp;But apr_file_mktemp doesn't let you control where the
&lt;br&gt;&amp;gt; temp file goes, right? &amp;nbsp;And now that I think of it, the file can be
&lt;br&gt;&lt;br&gt;No, of course you can control where the file goes. Just fill the templ
&lt;br&gt;parameter appropriately:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://apr.apache.org/docs/apr/1.3/group__apr__file__io.html#gc34981f9ff41f85e4377a6dde185fe52&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://apr.apache.org/docs/apr/1.3/group__apr__file__io.html#gc34981f9ff41f85e4377a6dde185fe52&lt;/a&gt;&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;&lt;br&gt;Rüdiger
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_file_*-weirdness-on-Mac-OS-X-tp19792880p19804765.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19804653</id>
	<title>Re: Corrected: global_mutex on Solaris 10, does it actually work?</title>
	<published>2008-10-03T13:03:18Z</published>
	<updated>2008-10-03T13:03:18Z</updated>
	<author>
		<name>William A. Rowe, Jr.</name>
	</author>
	<content type="html">Tim Bray wrote:
&lt;br&gt;&amp;gt; Correcting two errors in my original post, why don't I just copy &amp; paste?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; So, there's this file I want to update, suppose its name is in the
&lt;br&gt;&amp;gt; variable &amp;quot;filename&amp;quot;, so I go
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;status = apr_global_mutex_create(&amp;mutex, filename, &amp;nbsp;APR_LOCK_DEFAULT,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pool);
&lt;br&gt;&lt;br&gt;Create says exactly that.
&lt;br&gt;&lt;br&gt;I was thinking apr_global_mutex_child_init but that clearly isn't it, because
&lt;br&gt;it expects an initialized lock.
&lt;br&gt;&lt;br&gt;If we compare this to apr_shm_create / apr_shm_attach, it's pretty clear we
&lt;br&gt;are just missing the mechanics to solve this. &amp;nbsp;apr_proc|global_mutex_attach
&lt;br&gt;is missing, and this should just be mopped up for apr 1.4.0, and absolutely
&lt;br&gt;before 2.0.0.
&lt;br&gt;&lt;br&gt;The other solutions that come to mind are all very, very crufty hacks against
&lt;br&gt;specific solutions, e.g. an apr_os_proc_mutex_put sort of solution. &amp;nbsp;It really
&lt;br&gt;is the API that needs repair.
&lt;br&gt;&lt;br&gt;Bill
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/global_mutex-on-Solaris-10%2C-does-it-actually-work--tp19803579p19804653.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19804280</id>
	<title>Corrected: global_mutex on Solaris 10, does it actually work?</title>
	<published>2008-10-03T12:39:07Z</published>
	<updated>2008-10-03T12:39:07Z</updated>
	<author>
		<name>Tim Bray</name>
	</author>
	<content type="html">Correcting two errors in my original post, why don't I just copy &amp; &amp;nbsp;
&lt;br&gt;paste?
&lt;br&gt;&lt;br&gt;So, there's this file I want to update, suppose its name is in the
&lt;br&gt;variable &amp;quot;filename&amp;quot;, so I go
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; status = apr_global_mutex_create(&amp;mutex, filename, &amp;nbsp; 
&lt;br&gt;APR_LOCK_DEFAULT,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pool);
&lt;br&gt;&lt;br&gt;And on Solaris 10, this fails with EEXIST, i.e. strerror says &amp;quot;File
&lt;br&gt;exists&amp;quot;. &amp;nbsp;(This doesn't happen on OS X). &amp;nbsp;Well, yeah, it exists, I
&lt;br&gt;want to update it, that's what the mutex is for, sigh. &amp;nbsp;So I created
&lt;br&gt;another filename called
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; mutex_file = apr_pstrcat(pool, filename, &amp;quot;.mutex&amp;quot;, NULL);
&lt;br&gt;&lt;br&gt;and locked that, which worked until the first time another process
&lt;br&gt;wanted to wait on the mutex, and it couldn't create the mutex to wait
&lt;br&gt;on it because the file existed. &amp;nbsp;So, I'm confused... how can I get an
&lt;br&gt;apr_global_mutex_t to wait on in this scenario?
&lt;br&gt;&lt;br&gt;Pardon the stupidity. -T
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/global_mutex-on-Solaris-10%2C-does-it-actually-work--tp19803579p19804280.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19803579</id>
	<title>global_mutex on Solaris 10, does it actually work?</title>
	<published>2008-10-03T11:50:25Z</published>
	<updated>2008-10-03T11:50:25Z</updated>
	<author>
		<name>Tim Bray</name>
	</author>
	<content type="html">So, there's this file I want to update, suppose its name is in the &amp;nbsp;
&lt;br&gt;variable &amp;quot;filename&amp;quot;, so I go
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;status = apr_global_mutex_create(&amp;mutex, mutex_file, &amp;nbsp;
&lt;br&gt;APR_LOCK_DEFAULT,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pool);
&lt;br&gt;&lt;br&gt;And on Solaris 10, this fails with EEXIST, i.e. strerror says &amp;quot;File &amp;nbsp;
&lt;br&gt;exists&amp;quot;. &amp;nbsp;(This doesn't happen on OS X). &amp;nbsp;Well, yeah, it exists, I &amp;nbsp;
&lt;br&gt;want to update it, that's what the mutex is for, sigh. &amp;nbsp;So I created &amp;nbsp;
&lt;br&gt;another filename called
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;mutex_file = apr_pstrcat(pool, filename, &amp;quot;.mutex&amp;quot;);
&lt;br&gt;&lt;br&gt;and locked that, which worked until the first time another process &amp;nbsp;
&lt;br&gt;wanted to wait on the mutex, and it couldn't create the mutex to wait &amp;nbsp;
&lt;br&gt;on it because the file existed. &amp;nbsp;So, I'm confused... how can I get an &amp;nbsp;
&lt;br&gt;apr_global_mutex_t to wait on in this scenario?
&lt;br&gt;&lt;br&gt;Pardon the stupidity. -T
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/global_mutex-on-Solaris-10%2C-does-it-actually-work--tp19803579p19803579.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19800572</id>
	<title>Re: apr_file_* weirdness on Mac OS X</title>
	<published>2008-10-03T08:50:50Z</published>
	<updated>2008-10-03T08:50:50Z</updated>
	<author>
		<name>Tim Bray</name>
	</author>
	<content type="html">On Oct 3, 2008, at 8:41 AM, Erik Huelsmann wrote:
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&amp;gt; Well, this isn't actually a temp file. &amp;nbsp; Once it's written and &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; closed, I
&lt;br&gt;&amp;gt;&amp;gt; want to move it into its final location as quickly as possible, so &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; I thought
&lt;br&gt;&amp;gt;&amp;gt; it would be good to have it in the same directory where it's going &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; to end up
&lt;br&gt;&amp;gt;&amp;gt; and avoid doing a copy. &amp;nbsp; But if this kind of thing is going to &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; happen, you
&lt;br&gt;&amp;gt;&amp;gt; probably have a point. &amp;nbsp;-Tim
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; You don't need it in the same directory, you need it on the same
&lt;br&gt;&amp;gt; volume to avoid the copy.
&lt;/div&gt;&lt;br&gt;Um, I know that. &amp;nbsp;But apr_file_mktemp doesn't let you control where &amp;nbsp;
&lt;br&gt;the temp file goes, right? &amp;nbsp;And now that I think of it, the file can &amp;nbsp;
&lt;br&gt;be fairly large. &amp;nbsp;Grmph. &amp;nbsp;If it is OS X, this seems like an &amp;nbsp;
&lt;br&gt;*egregious* violation of unix filesystem semantics. &amp;nbsp;-T
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_file_*-weirdness-on-Mac-OS-X-tp19792880p19800572.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19800383</id>
	<title>Re: apr_file_* weirdness on Mac OS X</title>
	<published>2008-10-03T08:41:10Z</published>
	<updated>2008-10-03T08:41:10Z</updated>
	<author>
		<name>Erik Huelsmann-2</name>
	</author>
	<content type="html">On Fri, Oct 3, 2008 at 5:15 PM, Tim Bray &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19800383&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tim.Bray@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Oct 3, 2008, at 6:22 AM, Bojan Smojver wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Fri, 2008-10-03 at 01:13 -0700, Tim Bray wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; i.e. a randomized name in the same directory.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Have you tried using apr_file_mktemp()?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Well, this isn't actually a temp file. &amp;nbsp; Once it's written and closed, I
&lt;br&gt;&amp;gt; want to move it into its final location as quickly as possible, so I thought
&lt;br&gt;&amp;gt; it would be good to have it in the same directory where it's going to end up
&lt;br&gt;&amp;gt; and avoid doing a copy. &amp;nbsp; But if this kind of thing is going to happen, you
&lt;br&gt;&amp;gt; probably have a point. &amp;nbsp;-Tim
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;You don't need it in the same directory, you need it on the same
&lt;br&gt;volume to avoid the copy.
&lt;br&gt;&lt;br&gt;Bye,
&lt;br&gt;&lt;br&gt;Erik.
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_file_*-weirdness-on-Mac-OS-X-tp19792880p19800383.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19799852</id>
	<title>Re: apr_file_* weirdness on Mac OS X</title>
	<published>2008-10-03T08:15:28Z</published>
	<updated>2008-10-03T08:15:28Z</updated>
	<author>
		<name>Tim Bray</name>
	</author>
	<content type="html">On Oct 3, 2008, at 6:22 AM, Bojan Smojver wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; On Fri, 2008-10-03 at 01:13 -0700, Tim Bray wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; i.e. a randomized name in the same directory.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Have you tried using apr_file_mktemp()?
&lt;br&gt;&lt;br&gt;Well, this isn't actually a temp file. &amp;nbsp; Once it's written and closed, &amp;nbsp;
&lt;br&gt;I want to move it into its final location as quickly as possible, so I &amp;nbsp;
&lt;br&gt;thought it would be good to have it in the same directory where it's &amp;nbsp;
&lt;br&gt;going to end up and avoid doing a copy. &amp;nbsp; But if this kind of thing is &amp;nbsp;
&lt;br&gt;going to happen, you probably have a point. &amp;nbsp;-Tim
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_file_*-weirdness-on-Mac-OS-X-tp19792880p19799852.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19798809</id>
	<title>Re: apr_file_* weirdness on Mac OS X</title>
	<published>2008-10-03T07:24:17Z</published>
	<updated>2008-10-03T07:24:17Z</updated>
	<author>
		<name>Gordon Henriksen-5</name>
	</author>
	<content type="html">On 2008-10-03, at 02:40, Tim Bray wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; I'm developing a module which accepts a large number of POST &amp;nbsp;
&lt;br&gt;&amp;gt; requests, receives the request bodies, and persists them into &amp;nbsp;
&lt;br&gt;&amp;gt; ordinary files in the filesystem. &amp;nbsp;On OS X, there are occasions &amp;nbsp;
&lt;br&gt;&amp;gt; where the file is (rarely) transiently not there. &amp;nbsp;The idiom looks &amp;nbsp;
&lt;br&gt;&amp;gt; like this
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Same code running in -X single-threaded mode, no problem. &amp;nbsp;Same code &amp;nbsp;
&lt;br&gt;&amp;gt; on Solaris, no problem. &amp;nbsp;(Well, yes, there are other weird Solaris &amp;nbsp;
&lt;br&gt;&amp;gt; problems with mutexes, but we'll get to those).
&lt;br&gt;&lt;br&gt;&lt;br&gt;Sounds like a race. I'd suggest you replace this:
&lt;br&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;status = apr_file_open(&amp;fp, tempname, APR_FOPEN_WRITE | &amp;nbsp;
&lt;br&gt;&amp;gt; APR_FOPEN_CREATE,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PERMS, pool);
&lt;br&gt;&lt;br&gt;with
&lt;br&gt;&lt;br&gt;apr_status_t status;
&lt;br&gt;do {
&lt;br&gt;&amp;nbsp; &amp;nbsp;... generate random filename ...
&lt;br&gt;&amp;nbsp; &amp;nbsp;status = apr_file_open(..., APR_FOPEN_WRITE|APR_FOPEN_CREATE| 
&lt;br&gt;APR_FOPEN_EXCL, ...);
&lt;br&gt;} while (APR_IS_EEXIST(status));
&lt;br&gt;&lt;br&gt;in order to hedge against another thread operating on the same &amp;nbsp;
&lt;br&gt;filename concurrently. apr_file_mktemp will handle this detail &amp;nbsp;
&lt;br&gt;transparently for you.
&lt;br&gt;&lt;br&gt;— Gordon
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_file_*-weirdness-on-Mac-OS-X-tp19792880p19798809.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19797659</id>
	<title>Re: apr_file_* weirdness on Mac OS X</title>
	<published>2008-10-03T06:22:30Z</published>
	<updated>2008-10-03T06:22:30Z</updated>
	<author>
		<name>Bojan Smojver</name>
	</author>
	<content type="html">On Fri, 2008-10-03 at 01:13 -0700, Tim Bray wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; i.e. a randomized name in the same directory.
&lt;br&gt;&lt;br&gt;Have you tried using apr_file_mktemp()?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Bojan
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_file_*-weirdness-on-Mac-OS-X-tp19792880p19797659.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19795500</id>
	<title>Re: apr_memcache 1.3.X sending unnecessary QUIT to memcached server</title>
	<published>2008-10-03T03:48:17Z</published>
	<updated>2008-10-03T03:48:17Z</updated>
	<author>
		<name>Ruediger Pluem</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;On 10/03/2008 06:08 AM, peter baer wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Also, if you look at the apr_reslist_create() documentation, it states
&lt;br&gt;&amp;gt; that the ttl &amp;quot;if non-zero, sets the maximum amount of time a resource
&lt;br&gt;&amp;gt; may be available while exceeding the soft limit. &amp;quot;. Why then is the
&lt;br&gt;&amp;gt; destructor being called for all resources that expire, even those
&lt;br&gt;&amp;gt; below the &amp;quot;min&amp;quot;?
&lt;br&gt;&lt;br&gt;I guess the documentation is wrong. This behaviour was changed a while
&lt;br&gt;ago to the behaviour you describe: If a resource is expired it will not
&lt;br&gt;be handed out any longer but it will be closed. This is needed / useful
&lt;br&gt;e.g. for database connections that become faulty after some time because
&lt;br&gt;the database server closes them after some time of inactivity or a firewall
&lt;br&gt;in between breaks the connection after some time. It is also very useful
&lt;br&gt;when pooling persistent http connections and you know the keepalive
&lt;br&gt;timeout settings of your backend.
&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;&lt;br&gt;Rüdiger
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_memcache-1.3.X-sending-unnecessary-QUIT-to-memcached-server-tp19426314p19795500.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19793683</id>
	<title>Re: apr_file_* weirdness on Mac OS X</title>
	<published>2008-10-03T01:13:28Z</published>
	<updated>2008-10-03T01:13:28Z</updated>
	<author>
		<name>Tim Bray</name>
	</author>
	<content type="html">&lt;br&gt;On Oct 2, 2008, at 11:58 PM, Bojan Smojver wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; On Thu, 2008-10-02 at 23:40 -0700, Tim Bray wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; status = apr_file_open(&amp;fp, tempname, APR_FOPEN_WRITE |
&lt;br&gt;&amp;gt;&amp;gt; APR_FOPEN_CREATE, PERMS, pool);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Where does the tempname come from?
&lt;br&gt;&lt;br&gt;static char * dir_of(apr_pool_t * pool, char * path) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;char * s;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;s = apr_pstrdup(pool, path);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*(rindex(s, '/')) = 0;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;return s;
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;/* make a temp filename for 'filename' */
&lt;br&gt;static char * temp_filename(apr_pool_t * pool, char * filename) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;char * tempname = dir_of(pool, filename);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;return apr_psprintf(pool, &amp;quot;%s/%s%ld-%ld&amp;quot;, tempname,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TEMP_PREFIX, arandom(), arandom());
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;i.e. a randomized name in the same directory.
&lt;br&gt;Here's an example: &amp;nbsp;filename is /wf1/data/m-a/a/pub/e/entries/ 
&lt;br&gt;collection.atom and tempname is /wf1/data/m-a/a/pub/e/entries/T. 
&lt;br&gt;493459176-1261197826
&lt;br&gt;&lt;br&gt;-Tim
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_file_*-weirdness-on-Mac-OS-X-tp19792880p19793683.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19793024</id>
	<title>Re: apr_file_* weirdness on Mac OS X</title>
	<published>2008-10-02T23:58:28Z</published>
	<updated>2008-10-02T23:58:28Z</updated>
	<author>
		<name>Bojan Smojver</name>
	</author>
	<content type="html">On Thu, 2008-10-02 at 23:40 -0700, Tim Bray wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;status = apr_file_open(&amp;fp, tempname, APR_FOPEN_WRITE | &amp;nbsp;
&lt;br&gt;&amp;gt; APR_FOPEN_CREATE, PERMS, pool);
&lt;br&gt;&lt;br&gt;Where does the tempname come from?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Bojan
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_file_*-weirdness-on-Mac-OS-X-tp19792880p19793024.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19792880</id>
	<title>apr_file_* weirdness on Mac OS X</title>
	<published>2008-10-02T23:40:28Z</published>
	<updated>2008-10-02T23:40:28Z</updated>
	<author>
		<name>Tim Bray</name>
	</author>
	<content type="html">I'm developing a module which accepts a large number of POST requests, &amp;nbsp;
&lt;br&gt;receives the request bodies, and persists them into ordinary files in &amp;nbsp;
&lt;br&gt;the filesystem. &amp;nbsp;On OS X, there are occasions where the file is &amp;nbsp;
&lt;br&gt;(rarely) transiently not there. &amp;nbsp;The idiom looks like this
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;status = apr_file_open(&amp;fp, tempname, APR_FOPEN_WRITE | &amp;nbsp;
&lt;br&gt;APR_FOPEN_CREATE,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PERMS, pool);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;/* ... do lots of writing ... */
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;apr_file_flush(fp);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;apr_file_close(fp);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;status = apr_file_rename(tempname, filename, pool); /* filename &amp;nbsp;
&lt;br&gt;is in the same directory as tempname */
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;BOOM! strerror() says &amp;quot;no such file or directory&amp;quot;
&lt;br&gt;&lt;br&gt;Then if I go and look, what do you know, the tempfile actually is &amp;nbsp;
&lt;br&gt;there. &amp;nbsp;If I process 500 requests in a big hurry, 100 each from 5 &amp;nbsp;
&lt;br&gt;concurrent clients, this will happen maybe half a dozen times, in an &amp;nbsp;
&lt;br&gt;unpredictable order. &amp;nbsp;There are ways to work around this, but still, &amp;nbsp;
&lt;br&gt;it's kinda disturbing. &amp;nbsp;It's either, in decreasing order of &amp;nbsp;
&lt;br&gt;probability (a) me doing something stupid, (b) OS X filesystem &amp;nbsp;
&lt;br&gt;weirdness, (c) an APR bug. &amp;nbsp;apr_file_write_full() doesn't seem to make &amp;nbsp;
&lt;br&gt;a difference.
&lt;br&gt;&lt;br&gt;Same code running in -X single-threaded mode, no problem. &amp;nbsp;Same code &amp;nbsp;
&lt;br&gt;on Solaris, no problem. &amp;nbsp;(Well, yes, there are other weird Solaris &amp;nbsp;
&lt;br&gt;problems with mutexes, but we'll get to those).
&lt;br&gt;&lt;br&gt;&amp;nbsp; -T
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_file_*-weirdness-on-Mac-OS-X-tp19792880p19792880.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19792078</id>
	<title>Re: random functions tutorial?</title>
	<published>2008-10-02T21:50:57Z</published>
	<updated>2008-10-02T21:50:57Z</updated>
	<author>
		<name>Tim Bray</name>
	</author>
	<content type="html">&lt;br&gt;On Oct 2, 2008, at 8:11 PM, Paul Querna wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Tim Bray wrote:
&lt;br&gt;&amp;gt;&amp;gt; I stupidly used random() and srandom() in my module to generate &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;random&amp;quot; filenames at high volume and, well, sigh. &amp;nbsp;Anyhow, the &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; page at &lt;a href=&quot;http://apr.apache.org/docs/apr/1.3/group__apr__random.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://apr.apache.org/docs/apr/1.3/group__apr__random.html&lt;/a&gt;&amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; lacks tutorial value. &amp;nbsp;Anyone written up the *right* way to use &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; these? &amp;nbsp;-T
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Ignore all of them except apr_generate_random_bytes.
&lt;br&gt;&lt;br&gt;Exactly what I needed to know. &amp;nbsp;Thank you. &amp;nbsp; -Tim
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/random-functions-tutorial--tp19789999p19792078.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19791971</id>
	<title>Re: apr_memcache 1.3.X sending unnecessary QUIT to memcached server</title>
	<published>2008-10-02T21:34:20Z</published>
	<updated>2008-10-02T21:34:20Z</updated>
	<author>
		<name>Bojan Smojver</name>
	</author>
	<content type="html">On Thu, 2008-10-02 at 21:08 -0700, peter baer wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Also, if you look at the apr_reslist_create() documentation, it states
&lt;br&gt;&amp;gt; that the ttl &amp;quot;if non-zero, sets the maximum amount of time a resource
&lt;br&gt;&amp;gt; may be available while exceeding the soft limit. &amp;quot;. Why then is the
&lt;br&gt;&amp;gt; destructor being called for all resources that expire, even those
&lt;br&gt;&amp;gt; below the &amp;quot;min&amp;quot;?
&lt;br&gt;&lt;br&gt;&amp;gt;From memory, wasn't it being called on 32 of them, which were above min
&lt;br&gt;(i.e. total was 64 if I recall correctly)?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Bojan
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_memcache-1.3.X-sending-unnecessary-QUIT-to-memcached-server-tp19426314p19791971.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19791801</id>
	<title>Re: apr_memcache 1.3.X sending unnecessary QUIT to memcached server</title>
	<published>2008-10-02T21:08:50Z</published>
	<updated>2008-10-02T21:08:50Z</updated>
	<author>
		<name>peter baer</name>
	</author>
	<content type="html">Hi Bojan,
&lt;br&gt;&lt;br&gt;First, I'd like to say thank you for the quick response. The ttl is in
&lt;br&gt;fact in microseconds. The documentation seems to be incorrect:
&lt;br&gt;apr_memcache_server_create() ttl - time to live in seconds of a client
&lt;br&gt;connection.
&lt;br&gt;&lt;br&gt;Also, if you look at the apr_reslist_create() documentation, it states
&lt;br&gt;that the ttl &amp;quot;if non-zero, sets the maximum amount of time a resource
&lt;br&gt;may be available while exceeding the soft limit. &amp;quot;. Why then is the
&lt;br&gt;destructor being called for all resources that expire, even those
&lt;br&gt;below the &amp;quot;min&amp;quot;?
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;Peter Baer
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr_memcache-1.3.X-sending-unnecessary-QUIT-to-memcached-server-tp19426314p19791801.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19791420</id>
	<title>Re: random functions tutorial?</title>
	<published>2008-10-02T20:11:59Z</published>
	<updated>2008-10-02T20:11:59Z</updated>
	<author>
		<name>Paul Querna</name>
	</author>
	<content type="html">Tim Bray wrote:
&lt;br&gt;&amp;gt; I stupidly used random() and srandom() in my module to generate &amp;quot;random&amp;quot; 
&lt;br&gt;&amp;gt; filenames at high volume and, well, sigh. &amp;nbsp;Anyhow, the page at 
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://apr.apache.org/docs/apr/1.3/group__apr__random.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://apr.apache.org/docs/apr/1.3/group__apr__random.html&lt;/a&gt;&amp;nbsp;lacks 
&lt;br&gt;&amp;gt; tutorial value. &amp;nbsp;Anyone written up the *right* way to use these? &amp;nbsp;-T
&lt;br&gt;&lt;br&gt;Ignore all of them except apr_generate_random_bytes.
&lt;br&gt;&lt;br&gt;For making temp files, also consider apr_file_mktemp, with or without 
&lt;br&gt;the APR_DELONCLOSE.
&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/random-functions-tutorial--tp19789999p19791420.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19789999</id>
	<title>random functions tutorial?</title>
	<published>2008-10-02T17:06:12Z</published>
	<updated>2008-10-02T17:06:12Z</updated>
	<author>
		<name>Tim Bray</name>
	</author>
	<content type="html">I stupidly used random() and srandom() in my module to generate &amp;nbsp;
&lt;br&gt;&amp;quot;random&amp;quot; filenames at high volume and, well, sigh. &amp;nbsp;Anyhow, the page &amp;nbsp;
&lt;br&gt;at &lt;a href=&quot;http://apr.apache.org/docs/apr/1.3/group__apr__random.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://apr.apache.org/docs/apr/1.3/group__apr__random.html&lt;/a&gt;&amp;nbsp;lacks &amp;nbsp;
&lt;br&gt;tutorial value. &amp;nbsp;Anyone written up the *right* way to use these? &amp;nbsp;-T
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/random-functions-tutorial--tp19789999p19789999.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19780352</id>
	<title>Re: apr pools &amp; memory leaks</title>
	<published>2008-10-02T07:25:34Z</published>
	<updated>2008-10-02T07:25:34Z</updated>
	<author>
		<name>mturk</name>
	</author>
	<content type="html">Ben Collins-Sussman wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Thu, Oct 2, 2008 at 2:44 AM, Mladen Turk &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19780352&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;mturk@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; Ben Collins-Sussman wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Our solution:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Over at Google, we simply hacked APR to *never* hold on to blocks for
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; recycling. &amp;nbsp;Essentially, this makes apr_pool_destroy() always free()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; the block, and makes apr_pool_create() always call malloc() malloc.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Poof, all the memory leak went away instantly.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Why not creating allocator for each of those subpools.
&lt;br&gt;&amp;gt;&amp;gt; On pool_destroy it'll destroy allocator and call free()
&lt;br&gt;&amp;gt;&amp;gt; consuming the global pool only for allocating subpools
&lt;br&gt;&amp;gt;&amp;gt; which are constant in size, thus no fragmentation can
&lt;br&gt;&amp;gt;&amp;gt; occur.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The subversion libraries wrap all apr_pool_create and apr_pool_destroy
&lt;br&gt;&amp;gt; calls in svn_pool_create and svn_pool_destroy functions. &amp;nbsp;I suppose we
&lt;br&gt;&amp;gt; could make every svn_pool_create call use a new allocator, but I think
&lt;br&gt;&amp;gt; a better solution is within APR itself -- perhaps a simple
&lt;br&gt;&amp;gt; compile-time option which triggers this behavior in apr_pool_create.
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;Within APR 1.3+ there is apr_pool_create_unmanaged that creates
&lt;br&gt;allocator as well as part of the call.
&lt;br&gt;However it needs to be explicitly destroyed, cause it doesn't
&lt;br&gt;touch the global pool nor registers to any parent.
&lt;br&gt;If you need that you can register a standard callback that will
&lt;br&gt;destroy that pool explicitly on global or any parent destroy.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;-- 
&lt;br&gt;^(TM)
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr-pools---memory-leaks-tp19766375p19780352.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19779611</id>
	<title>Re: apr pools &amp; memory leaks</title>
	<published>2008-10-02T06:47:01Z</published>
	<updated>2008-10-02T06:47:01Z</updated>
	<author>
		<name>Ben Collins-Sussman-3</name>
	</author>
	<content type="html">On Thu, Oct 2, 2008 at 2:44 AM, Mladen Turk &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779611&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;mturk@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Ben Collins-Sussman wrote:
&lt;br&gt;&amp;gt;&amp;gt; Our solution:
&lt;br&gt;&amp;gt;&amp;gt; Over at Google, we simply hacked APR to *never* hold on to blocks for
&lt;br&gt;&amp;gt;&amp;gt; recycling. &amp;nbsp;Essentially, this makes apr_pool_destroy() always free()
&lt;br&gt;&amp;gt;&amp;gt; the block, and makes apr_pool_create() always call malloc() malloc.
&lt;br&gt;&amp;gt;&amp;gt; Poof, all the memory leak went away instantly.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Why not creating allocator for each of those subpools.
&lt;br&gt;&amp;gt; On pool_destroy it'll destroy allocator and call free()
&lt;br&gt;&amp;gt; consuming the global pool only for allocating subpools
&lt;br&gt;&amp;gt; which are constant in size, thus no fragmentation can
&lt;br&gt;&amp;gt; occur.
&lt;/div&gt;&lt;br&gt;The subversion libraries wrap all apr_pool_create and apr_pool_destroy
&lt;br&gt;calls in svn_pool_create and svn_pool_destroy functions. &amp;nbsp;I suppose we
&lt;br&gt;could make every svn_pool_create call use a new allocator, but I think
&lt;br&gt;a better solution is within APR itself -- perhaps a simple
&lt;br&gt;compile-time option which triggers this behavior in apr_pool_create.
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr-pools---memory-leaks-tp19766375p19779611.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19774739</id>
	<title>Re: apr pools &amp; memory leaks</title>
	<published>2008-10-02T00:44:33Z</published>
	<updated>2008-10-02T00:44:33Z</updated>
	<author>
		<name>mturk</name>
	</author>
	<content type="html">Ben Collins-Sussman wrote:
&lt;br&gt;&amp;nbsp;&amp;gt; Our solution:
&lt;br&gt;&amp;nbsp;&amp;gt; Over at Google, we simply hacked APR to *never* hold on to blocks for
&lt;br&gt;&amp;nbsp;&amp;gt; recycling. &amp;nbsp;Essentially, this makes apr_pool_destroy() always free()
&lt;br&gt;&amp;nbsp;&amp;gt; the block, and makes apr_pool_create() always call malloc() malloc.
&lt;br&gt;&amp;nbsp;&amp;gt; Poof, all the memory leak went away instantly.
&lt;br&gt;&amp;nbsp;&amp;gt;
&lt;br&gt;&lt;br&gt;Why not creating allocator for each of those subpools.
&lt;br&gt;On pool_destroy it'll destroy allocator and call free()
&lt;br&gt;consuming the global pool only for allocating subpools
&lt;br&gt;which are constant in size, thus no fragmentation can
&lt;br&gt;occur.
&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;-- 
&lt;br&gt;^(TM)
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr-pools---memory-leaks-tp19766375p19774739.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19774515</id>
	<title>Re: apr pools &amp; memory leaks</title>
	<published>2008-10-02T00:22:04Z</published>
	<updated>2008-10-02T00:22:04Z</updated>
	<author>
		<name>Justin Erenkrantz</name>
	</author>
	<content type="html">On Wed, Oct 1, 2008 at 11:11 AM, Ben Collins-Sussman
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19774515&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sussman@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; In the long term, I think we need to question the utility of having
&lt;br&gt;&amp;gt; APR do memory recycling at all. &amp;nbsp;Back in the early 90's, malloc() was
&lt;br&gt;&amp;gt; insanely slow and worth avoiding. &amp;nbsp;In 2008, now that we're running
&lt;br&gt;&amp;gt; apache with nothing but malloc/free, we're unable measure any
&lt;br&gt;&amp;gt; performance hit. &amp;nbsp;The whole pool interface is really nice, but I
&lt;br&gt;&amp;gt; wonder if pool recycling may just be unnecessary on modern hardware
&lt;br&gt;&amp;gt; and OSes.
&lt;br&gt;&lt;br&gt;If you are using a specialized malloc implementation (like Google's
&lt;br&gt;TCmalloc), then it will almost certainly be doing recycling underneath
&lt;br&gt;for you in some fashion. &amp;nbsp;These packages are largely optional, and I'm
&lt;br&gt;not aware of any OS that has these functionalities enabled by
&lt;br&gt;*default*. &amp;nbsp;(Solaris and Mac OS X have them available, but need to be
&lt;br&gt;turned on by environment variables or other linker tricks, IIRC.)
&lt;br&gt;However, yes, there are more smarter malloc implementations than there
&lt;br&gt;were 10 years ago...but I don't think it's prevalent enough where APR
&lt;br&gt;should just assume that malloc()/free() is inherently cheap unless it
&lt;br&gt;were to bundle one of those libraries directly. &amp;nbsp;(Google's TCmalloc is
&lt;br&gt;C++, but there are others that are likely reasonably portable too.)
&lt;br&gt;&lt;br&gt;BTW, implicit in the reason why there is not a noticeable performance
&lt;br&gt;hit with malloc/free off for you is that you probably *are* using
&lt;br&gt;TCmalloc or some special Google library that handles the memory
&lt;br&gt;recycling already. &amp;nbsp;=) &amp;nbsp;-- justin
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr-pools---memory-leaks-tp19766375p19774515.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19766863</id>
	<title>Re: apr pools &amp; memory leaks</title>
	<published>2008-10-01T11:53:05Z</published>
	<updated>2008-10-01T11:53:05Z</updated>
	<author>
		<name>William A. Rowe, Jr.</name>
	</author>
	<content type="html">Ben Collins-Sussman wrote:
&lt;br&gt;&amp;gt; On Wed, Oct 1, 2008 at 1:31 PM, Mark Phippard &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19766863&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;markphip@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; 3) Any reason more Windows users would see this than Linux? &amp;nbsp;Maybe
&lt;br&gt;&amp;gt;&amp;gt; more Windows SVN users use Apache 2.2 than on Linux?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; As Erik said, on Windows only the threaded mode is available, thus
&lt;br&gt;&amp;gt; explaining why they're seeing this problem more than anyone else.
&lt;br&gt;&lt;br&gt;Also, most distributions shipped prefork as the default mpm back in 2.0
&lt;br&gt;and now ship worker as the default with 2.2. &amp;nbsp;winnt mpm looks much more
&lt;br&gt;like worker, of course.
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/apr-pools---memory-leaks-tp19766375p19766863.html" />
</entry>

</feed>
