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

Re: missing close of rev file in fsfs - get_dir_contents?

From: Johan Corveleyn <jcorvel_at_gmail.com>
Date: Thu, 25 Feb 2010 01:32:23 +0100

On Wed, Feb 24, 2010 at 7:10 PM, Philip Martin
<philip.martin_at_wandisco.com> wrote:
> Johan Corveleyn <jcorvel_at_gmail.com> writes:
>
>> Looking at the source code I see:
>> - get_dir_contents calls read_representation
>> - read_representation calls rep_read_get_baton, which creates a
>> rep_read_baton and opens the rev file inside build_rep_list ->
>> create_rep_state -> create_rep_state_body
>> - read_representation wraps it in a stream, and sets the close
>> function to rep_read_contents_close
>> - get_dir_contents reads stuff and closes the stream
>>
>> Now, the close callback of the stream is rep_read_contents_close, which is:
>> [[[
>> static svn_error_t *
>> rep_read_contents_close(void *baton)
>> {
>>   struct rep_read_baton *rb = baton;
>>
>>   svn_pool_destroy(rb->pool);
>>   svn_pool_destroy(rb->filehandle_pool);
>>
>>   return SVN_NO_ERROR;
>> }
>> ]]]
>>
>> Apparently, this does not close the file. After this callback is run,
>> neither svn_io_file_close nor apr_file_close are being executed.
>
> You have the wrong function name.  Look at apr_file_open in
>
> http://svn.apache.org/repos/asf/apr/apr/trunk/file_io/unix/open.c
>
> to see the pool cleanup handler, it's on the pool passed in (unless
> the flag APR_FILE_NOCLEANUP is used), so that should be result_pool in
> svn_stream_open_readonly which ends up being rb->pool.  You should be
> able to set a breakpoint on the function apr_unix_file_cleanup (or
> file_cleanup on Windows) to catch the close.

Oh I see. Thanks for the explanation, Philip.

Johan
Received on 2010-02-25 01:33:02 CET

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