[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] performance branch crashes if APR has no thread support

From: Stefan Sperling <stsp_at_elego.de>
Date: Sun, 7 Nov 2010 18:54:57 +0100

The performance branch is crashing all over the place if APR has
not been compiled with support for threads.

This is because the file handle cache is never created.
The default cache configuration unconditionally assumes that APR has
thread support. This causes svn_cache__membuffer_cache_create() in
libsvn_subr/cache-membuffer.c to always return an error:

#if APR_HAS_THREADS
[...]
#else
      if (thread_safe)
        return svn_error_wrap_apr(APR_ENOTIMPL, _("APR doesn't support threads"));
#endif

The crash then happens later when fsfs tries to use the cache:

#0 0x00000002051b9244 in find_first (cache=0x0,
    name=0x20b1970d8 "/tmp/svn-sandbox/repos/db/revs/0/0")
    at subversion/libsvn_subr/svn_file_handle_cache.c:362
362 APR_HASH_KEY_STRING);
(gdb) list
357 find_first(svn_file_handle_cache_t *cache, const char *name)
358 {
359 cache_entry_t *result =
360 (cache_entry_t *)apr_hash_get(cache->first_by_name,
361 name,
362 APR_HASH_KEY_STRING);
363
364 /* the index must contain only used entries, i.e. those that actually
365 * contain an open APR file handle. */
366 assert(!result || result->file);
(gdb) p cache
$1 = (svn_file_handle_cache_t *) 0x0
(gdb) bt
#0 0x00000002051b9244 in find_first (cache=0x0,
    name=0x20b1970d8 "/tmp/svn-sandbox/repos/db/revs/0/0")
    at subversion/libsvn_subr/svn_file_handle_cache.c:362
#1 0x00000002051b9a2a in svn_file_handle_cache__open (f=0x7f7ffffd62b8,
    cache=0x0, fname=0x20b1970d8 "/tmp/svn-sandbox/repos/db/revs/0/0",
    flag=129, perm=4095, offset=-1, cookie=0, pool=0x20b197028)
    at subversion/libsvn_subr/svn_file_handle_cache.c:662
#2 0x0000000202a09a58 in open_pack_or_rev_file (file=0x7f7ffffd62b8,
    fs=0x208144030, rev=0, offset=-1, cookie=0, pool=0x20b197028)
    at subversion/libsvn_fs_fs/fs_fs.c:1954
#3 0x0000000202a0c71c in svn_fs_fs__rev_get_root (root_id_p=0x7f7ffffd6318,
    fs=0x208144030, rev=0, pool=0x20b197028)
    at subversion/libsvn_fs_fs/fs_fs.c:2983
[...]

The diff below fixes this.

[[[
* subversion/libsvn_fs_util/caching.c
  (cache_settings): If APR has no thread support, don't assume
    multi-threaded operation.
]]]

Index: subversion/libsvn_fs_util/caching.c
===================================================================
--- subversion/libsvn_fs_util/caching.c (revision 1032308)
+++ subversion/libsvn_fs_util/caching.c (working copy)
@@ -37,7 +37,11 @@ static svn_fs_cache_config_t cache_settings =
     16, /* up to 16 files kept open */
     FALSE, /* don't cache fulltexts */
     FALSE, /* don't cache text deltas */
+#if APR_HAS_THREADS
     FALSE /* assume multi-threaded operation */
+#else
+ TRUE /* assume single-threaded operation */
+#endif
   };
 
 /* Get the current FSFS cache configuration. */
Received on 2010-11-07 18:55:37 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.