Anything waiting for apr 1.5.1?
Maybe I'll actually do something this time :) -- Born in Roswell... married an alien... http://emptyhammock.com/ http://edjective.org/
Re: apr_os_proc_mutex_get() segfault
On Thu, Mar 27, 2014 at 8:15 AM, Yann Ylavic wrote: > Hi, > > when using the following code : > > pthread_mutex_t *mymutex; > apr_proc_mutex_t *apmutex = NULL; > apr_os_proc_mutex_t osmutex = {0}; > apr_proc_mutex_create(&apmutex, NULL, APR_LOCK_PROC_PTHREAD, p); > apr_os_proc_mutex_get(&osmutex, apmutex); > mymutex = osmutex.pthread_interproc; > > apr_os_proc_mutex_get() derefences the NULL pointer. > > The function is implemented like this : > > APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t > *ospmutex, > apr_proc_mutex_t *pmutex) > { > #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || > APR_HAS_FLOCK_SERIALIZE || APR_HAS_POSIXSEM_SERIALIZE > ospmutex->crossproc = pmutex->interproc->filedes; > #endif > #if APR_HAS_PROC_PTHREAD_SERIALIZE > ospmutex->pthread_interproc = pmutex->pthread_interproc; > #endif > return APR_SUCCESS; > } > > The problem is that on my linux system, all these APR_HAS_*_SERIALIZE > are defined to 1, but when a APR_LOCK_PROC_PTHREAD mutex is created, > apr_proc_mutex_t->pthread_interproc only is initialized, and > apr_proc_mutex_t->interproc is NULL (hence the segfault). > > Maybe the patch above could be applied : > trunk r1587063 1.5.x r1587064 Additionally I left this note as a 2.0 showstopper: http://svn.apache.org/viewvc?view=revision&revision=1587066 Thanks! > Index: locks/unix/proc_mutex.c > === > --- locks/unix/proc_mutex.c(revision 1582271) > +++ locks/unix/proc_mutex.c(working copy) > @@ -1013,7 +1013,12 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(ap > apr_proc_mutex_t *pmutex) > { > #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || > APR_HAS_FLOCK_SERIALIZE || APR_HAS_POSIXSEM_SERIALIZE > -ospmutex->crossproc = pmutex->interproc->filedes; > +if (pmutex->interproc) { > +ospmutex->crossproc = pmutex->interproc->filedes; > +} > +else { > +ospmutex->crossproc = -1; > +} > #endif > #if APR_HAS_PROC_PTHREAD_SERIALIZE > ospmutex->pthread_interproc = pmutex->pthread_interproc; > [END] > > Regards, > Yann. > -- Born in Roswell... married an alien... http://emptyhammock.com/ http://edjective.org/
Re: New apr_sockaddr_info_copy() function
On Thu, Jan 23, 2014 at 7:24 PM, Yann Ylavic wrote: > Hi, > > I'd like to propose the following/attached patch which adds the > apr_sockaddr_info_copy() function to network_io. > Committed to APR trunk as r1587045... If you are able, could you submit a patch to add a testcase for this? Even if the testcase isn't interesting, it would be a big head start in case someone has a need to test a particular aspect of it in the future. Thanks! > > It can be useful when one wants an existing apr_sockaddr_t with a > different lifetime (pool) without a DNS lookup, ie. a redundant/costly call > to apr_sockaddr_info_get(). > > I hope it can be useful. > > Regards, > Yann. > > > Index: include/apr_network_io.h > === > --- include/apr_network_io.h(revision 1560855) > +++ include/apr_network_io.h(working copy) > @@ -428,6 +428,15 @@ APR_DECLARE(apr_status_t) apr_sockaddr_info_get(ap >apr_int32_t flags, >apr_pool_t *p); > > +/** > + * Copy apr_sockaddr_t src to dst on pool p. > + * @param dst The destination apr_sockaddr_t. > + * @param src The source apr_sockaddr_t. > + * @param p The pool for the apr_sockaddr_t and associated storage. > + */ > +APR_DECLARE(apr_status_t) apr_sockaddr_info_copy(apr_sockaddr_t **dst, > + const apr_sockaddr_t > *src, > + apr_pool_t *p); > > /** > * Look up the host name from an apr_sockaddr_t. > Index: network_io/unix/sockaddr.c > === > --- network_io/unix/sockaddr.c(revision 1560855) > +++ network_io/unix/sockaddr.c(working copy) > @@ -660,6 +660,41 @@ APR_DECLARE(apr_status_t) apr_sockaddr_info_get(ap > return find_addresses(sa, hostname, family, port, flags, p); > } > > +APR_DECLARE(apr_status_t) apr_sockaddr_info_copy(apr_sockaddr_t **dst, > + const apr_sockaddr_t > *src, > + apr_pool_t *p) > +{ > +apr_sockaddr_t *d; > +const apr_sockaddr_t *s; > +for (*dst = d = NULL, s = src; s; s = s->next) { > +if (!d) { > +*dst = d = apr_pmemdup(p, s, sizeof *s); > +} > +else { > +d = d->next = apr_pmemdup(p, s, sizeof *s); > +} > +if (s->hostname) { > +if (s == src || s->hostname != src->hostname) { > +d->hostname = apr_pstrdup(p, s->hostname); > +} > +else { > +d->hostname = (*dst)->hostname; > +} > +} > +if (s->servname) { > +if (s == src || s->servname != src->servname) { > +d->servname = apr_pstrdup(p, s->servname); > +} > +else { > +d->servname = (*dst)->servname; > +} > +} > +d->pool = p; > +apr_sockaddr_vars_set(d, s->family, s->port); > +} > +return APR_SUCCESS; > +} > + > APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, >apr_sockaddr_t *sockaddr, >apr_int32_t flags) > [EOS] > -- Born in Roswell... married an alien... http://emptyhammock.com/ http://edjective.org/
Bug report for APR [2014/04/13]
+---+ | Bugzilla Bug ID | | +-+ | | Status: UNC=Unconfirmed NEW=New ASS=Assigned| | | OPN=ReopenedVER=Verified(Skipped Closed/Resolved) | | | +-+ | | | Severity: BLK=Blocker CRI=Critical REG=Regression MAJ=Major | | | | MIN=Minor NOR=NormalENH=Enhancement TRV=Trivial | | | | +-+ | | | | Date Posted | | | | | +--+ | | | | | Description | | | | | | | |16056|Inf|Enh|2003-01-14|Shared memory & mutex ownership not correctly esta| |20382|New|Nor|2003-05-31|Poor performance on W2000 AS | |28453|New|Enh|2004-04-18|apr_uri should parse relative to a base URI | |33188|Inf|Nor|2005-01-21|libtool linking failure on Suse | |33490|Inf|Nor|2005-02-10|APR does not compile with Borland C++ | |38410|New|Nor|2006-01-27|apr/win32 misinterpreted the meaning of WAIT_ABAND| |39289|New|Enh|2006-04-12|test suite additions for trylock functions| |39853|Inf|Nor|2006-06-21|apr_strtoi64 does not build on WinCE due to lack o| |39895|New|Enh|2006-06-23|apr_os_strerror on WinCE needs to xlate unicode->u| |39896|New|Enh|2006-06-23|Output test status to OutputDebugString in additio| |40020|New|Enh|2006-07-11|Add support for apr_uint8_t and apr_int8_t types | |40193|Inf|Nor|2006-08-06|Patches to support different compiler than EMX on | |40622|New|Enh|2006-09-27|enhance apr temp files on NT to be more secure| |40758|Ver|Maj|2006-10-15|WIN64, apr_vformatter(..) cannot handle 64bit poin| |40939|New|Enh|2006-11-09|pool minimal allocation size should be configurabl| |41192|Inf|Trv|2006-12-17|Add the expat libtool file to the LT_LDFLAGS varia| |41254|New|Enh|2006-12-28|apr_queue_t enhancements | |41351|Inf|Enh|2007-01-11|Tivoli LDAP SDK support in aprutil| |41352|Inf|Min|2007-01-11|openldap and per-connection client certificates in| |41916|Inf|Nor|2007-03-21|MinGW cross-compile support for Linux | |42365|New|Enh|2007-05-09|Suppress console for apr_proc_create() created pro| |42682|New|Maj|2007-06-17|Apache child terminates with signal 11 when using | |42728|New|Nor|2007-06-23|mod_ssl thread detaching not releasing handles| |42848|New|Enh|2007-07-10|add IP TOS support to apr_socket_opt_set()| |43035|New|Enh|2007-08-04|Add ability to wrap ssl around pre-existing socket| |43066|New|Nor|2007-08-08|get_password on Windows is kludgy | |43152|Inf|Nor|2007-08-16|apr_socket_opt_get doesn't work with APR_SO_SNDBUF| |43172|Ass|Nor|2007-08-20|apr-util don't want to find mozldap-6.x | |43217|New|Min|2007-08-26|All-ones IPv6 subnet mask not accepted| |43244|New|Enh|2007-08-29|apr_socket_t missing dup, dup2 and setaside | |43302|New|Nor|2007-09-04|apr_bucket_socket doesn't work with non-connected | |43309|New|Enh|2007-09-05|add apr_socket_sendtov support| |43375|New|Nor|2007-09-13|Pool integrity check fails for apr threads| |43499|New|Nor|2007-09-27|apr_global_mutex_create returns error "Access deni| |43507|New|Enh|2007-09-28|configure flag for SHELL_PATH | |43508|New|Enh|2007-09-28|Please be available whether atomics use thread mut| |43793|New|Enh|2007-11-04|builtin atomics on Windows| |44127|New|Enh|2007-12-21|File Extended Attributes Support | |44128|New|Enh|2007-12-21|apr_os_file_put() does not register a cleanup hand| |44129|New|Enh|2007-12-21|apr_os_dir_put() does not allocate an entry buffer| |44186|New|Nor|2008-01-08|[PATCH] Add memcached 1.2.4 features to apr_memcac| |44230|New|Enh|2008-01-14|Add Ark Linux support to config.layout| |44432|New|Enh|2008-02-15|patch - proposal for application function hooks | |44550|Inf|Maj|2008-03-06|Solaris sendfilev() handling - EINTR appears to ha| |45251|New|Nor|2008-06-22|DBD MySQL driver doesn't support multiple resultse| |45291|New|Nor|2008-06-26|apr_thread_t is leaking | |45298|New|Maj|2008-06-27|apr_os_thread_get() differs between windows and un| |45407|Opn|Nor|2008-07-16|auto reconnect in apr_dbd_mysql disturb normal wor| |45455|New|Nor|2008-07-22|rwlock sometimes allows a writer to take the lock | |45494|Opn|Nor|2008-07-28|testsockets fails on Solaris when IPv6 interfaces | |45496|New|Enh|2008-07-29|[patch] adding directory matching [dir/**/conf.d/*| |45615|