Uploaded image for project: 'Subversion'
  1. Subversion
  2. SVN-4264

svn_fs_delete_fs error leak and SEGV with BDB

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • ---
    • ---
    • libsvn_fs_base
    • None

    Description

      fs-test 37 is a recently added test for svn_fs_delete_fs.  While the test itself
      PASSES it leaves the test program in a broken state that causes a SEGV when
      built with SVN_DEBUG:
      
      $ ./fs-test 37 --fs-type bdb
      PASS:  lt-fs-test 37: test svn_fs_delete_fs
      Aborted.
      
      The problem is that opening the BDB filesystem installs a pool cleanup handler,
      cleanup_fs_apr, that gets called after the filesystem has been removed. The pool
      cleanup generates a Subversion error because it attempts a BDB operation on a
      database that no longer exists:
      
      Breakpoint 1, bdb_error_gatherer (dbenv=0x626350, 
          baton=0x626270 "svn (bdb): ", 
          msg=0x7fffffffdb70 "PANIC: fatal region error detected; run recovery")
          at ../src/subversion/libsvn_fs_base/bdb/env.c:229
      229	  new_err = svn_error_createf(APR_SUCCESS, NULL, "bdb: %s", msg);
      (gdb) bt
      #0  bdb_error_gatherer (dbenv=0x626350, baton=0x626270 "svn (bdb): ", 
          msg=0x7fffffffdb70 "PANIC: fatal region error detected; run recovery")
          at ../src/subversion/libsvn_fs_base/bdb/env.c:229
      #1  0x00007ffff4e6be68 in __db_errcall ()
         from /usr/lib/x86_64-linux-gnu/libdb-5.1.so
      #2  0x00007ffff4e6c13e in __db_errx ()
         from /usr/lib/x86_64-linux-gnu/libdb-5.1.so
      #3  0x00007ffff4e6c202 in __env_panic_msg ()
         from /usr/lib/x86_64-linux-gnu/libdb-5.1.so
      #4  0x00007ffff4e6db18 in __db_close_pp ()
         from /usr/lib/x86_64-linux-gnu/libdb-5.1.so
      #5  0x00007ffff647b324 in cleanup_fs_db (fs=0x625540, db_ptr=0x6255a8, 
          name=0x7ffff6496835 "nodes") at ../src/subversion/libsvn_fs_base/fs.c:127
      #6  0x00007ffff647b3f5 in cleanup_fs (fs=0x625540)
          at ../src/subversion/libsvn_fs_base/fs.c:166
      #7  0x00007ffff647b83c in cleanup_fs_apr (data=0x625540)
          at ../src/subversion/libsvn_fs_base/fs.c:289
      #8  0x00007ffff70e8c86 in run_cleanups (cref=<optimized out>)
          at memory/unix/apr_pools.c:2352
      #9  pool_clear_debug (pool=pool@entry=0x622f30, 
          file_line=0x7ffff7bdb4b0 "../src/subversion/tests/svn_test_main.c:530")
          at memory/unix/apr_pools.c:1553
      #10 0x00007ffff70e9390 in apr_pool_clear_debug (pool=0x622f30, 
          file_line=<optimized out>) at memory/unix/apr_pools.c:1613
      #11 0x00007ffff7bda6b1 in main (argc=4, argv=0x7fffffffe918)
          at ../src/subversion/tests/svn_test_main.c:530
      #12 0x00007ffff6b4aead in __libc_start_main (main=<optimized out>, 
          argc=<optimized out>, ubp_av=<optimized out>, init=<optimized out>, 
          fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe908)
          at libc-start.c:228
      #13 0x0000000000402719 in _start ()
      (gdb) 
      
      This error is never handled/cleared so when built with SVN_DEBUG the program aborts.
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            philipm Philip Martin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: