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

Pool usage problems in {base,fs}_node_origin_rev

From: Vlad Georgescu <vgeorgescu_at_gmail.com>
Date: Tue, 19 Aug 2008 01:08:57 +0300

When running the tests I get all sorts of failures, mostly in the merge tests.
The cause is incorrect pool usage.

In libsvn_fs_base/tree.c, base_node_origin_rev(), line 4753:

      /* Walk the predecessor links back to origin. */
      SVN_ERR(base_node_id(&pred_id, curroot, lastpath->data, pool));
      while (1)
        {
          struct txn_pred_id_args pid_args;
          svn_pool_clear(subpool);
          pid_args.id = pred_id;
          pid_args.pool = subpool;
          SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_pred_id,
                                         &pid_args, subpool));
          if (! pid_args.pred_id)
            break;
          pred_id = pid_args.pred_id;
        }

Notice that in all iterations except the first, pred_id will be used after being
freed.

The equivalent code in libsvn_fs_fs/tree.c, fs_node_origin_rev(), line 3071:

    /* Walk the predecessor links back to origin. */
    SVN_ERR(fs_node_id(&pred_id, curroot, lastpath->data, predidpool));
    while (pred_id)
      {
        svn_pool_clear(subpool);
        SVN_ERR(svn_fs_fs__dag_get_node(&node, fs, pred_id, subpool));
        svn_pool_clear(predidpool);
        SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node,
                                                  predidpool));
      }

This looks correct, except that svn_fs_fs__dag_get_predecessor_id() sometimes
returns a cached value obtained directly from node, thus causing the same sort
of problem.

-- 
Vlad
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-08-19 00:09:17 CEST

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.