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

Re: svn commit: r1757532 - /subversion/trunk/subversion/mod_dav_svn/repos.c

From: Ivan Zhakov <ivan_at_visualsvn.com>
Date: Fri, 26 Aug 2016 13:30:43 +0300

On 24 August 2016 at 17:43, <kotkov_at_apache.org> wrote:
> Author: kotkov
> Date: Wed Aug 24 14:43:21 2016
> New Revision: 1757532
>
> URL: http://svn.apache.org/viewvc?rev=1757532&view=rev
> Log:
> In mod_dav_svn, rewrite the code responsible for answering to GET requests
> with a specified delta base, so that it would reuse a single bucket brigade.
>
> This gets rid of the unbounded memory usage caused by creating a new bucket
> brigade per *every* call of the svn_stream_write(). The bucket brigades
> were allocated in the request pool.
>
> * subversion/mod_dav_svn/repos.c
> (diff_ctx_t): Remove `pool`, add a new bucket brigade (`bb`) field.
> (write_to_filter, close_filter): Reuse the single bucket brigade from the
> stream's context.
> (deliver): Create a bucket brigade, pass it to the output stream for
> svndiff, and destroy it after we've sent the data.
>
> Modified:
> subversion/trunk/subversion/mod_dav_svn/repos.c
>
> Modified: subversion/trunk/subversion/mod_dav_svn/repos.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/repos.c?rev=1757532&r1=1757531&r2=1757532&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/mod_dav_svn/repos.c (original)
> +++ subversion/trunk/subversion/mod_dav_svn/repos.c Wed Aug 24 14:43:21 2016
> @@ -3237,7 +3237,7 @@ set_headers(request_rec *r, const dav_re
>
[...]

> @@ -3266,15 +3264,13 @@ static svn_error_t * __attribute__((war
> close_filter(void *baton)
> {
> diff_ctx_t *dc = baton;
> - apr_bucket_brigade *bb;
> apr_bucket *bkt;
> apr_status_t status;
>
> /* done with the file. write an EOS bucket now. */
> - bb = apr_brigade_create(dc->pool, dc->output->c->bucket_alloc);
> bkt = apr_bucket_eos_create(dc->output->c->bucket_alloc);
> - APR_BRIGADE_INSERT_TAIL(bb, bkt);
> - if ((status = ap_pass_brigade(dc->output, bb)) != APR_SUCCESS)
> + APR_BRIGADE_INSERT_TAIL(dc->bb, bkt);
> + if ((status = ap_pass_brigade(dc->output, dc->bb)) != APR_SUCCESS)
> return svn_error_create(status, NULL, "Could not write EOS to filter");
>
As far I understand apr_brigade_cleanup() should be called after
ap_pass_brigade(). So code should be something like:
[[[
 APR_BRIGADE_INSERT_TAIL(dc->bb, bkt);
 status = ap_pass_brigade(dc->output, dc->bb);
 apr_brigade_cleanup(dc->bb);
 if (status != APR_SUCCESS)
      return svn_error_create(status, NULL, "Could not write EOS to filter");
]]]

-- 
Ivan Zhakov
Received on 2016-08-26 12:31:08 CEST

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