svn-3487

Version:

1.7.0

Bug Link:

http://subversion.tigris.org/issues/show_bug.cgi?id=3487

Patch Link:

source code patch: http://svn.apache.org/viewvc?diff_format=h&view=revision&revision=880226

reproduction: http://subversion.tigris.org/nonav/issues/showattachment.cgi/1039/issue-3487.sh

Symptom:

Can not update many externals at once.

 *background: ‘externals definition’ is a mapping of a local directory to the URL using the property ‘svn:externals’. It enables files to be fetched from multiple repositories using one ‘virtual’ name instead of the working repository.

An update that pulls many externals over ra_svn module might eventually fail with:

svn: warning: Error handling externals definition for 'foo':

svn: warning: Network connection closed unexpectedly

It should actually succeeed.

How it is diagnosed:

tried to reproduce but we can not see the symptom.

Root Cause:

Brief:

Ib->pool has a short lifetime, so RA connection can be closed when there’s many ‘externals’.


Detail:

The log message is printed below:

SVN_ERR(svn_ra_svn__stream_read(conn->stream, data, len));

  if (*len == 0)

        return svn_error_create(SVN_ERR_RA_SVN_CONNECTION_CLOSED, NULL, NULL);

Here, conn->stream is a socket. ‘svn_ra_svn__stream_read’ eventually will call ‘apr_socket_recv’, which eventually call ‘read’ system call. It is checking the ‘read’ returned a zero length buffer, they will print error message!
/* Put the ra_cache into ib->iter_pool

   instead of ib->pool. The latter has a long lifetime, and using it

   causes the RA connection for each external remaining open until

   process exit, which is fatal for working copies with a huge number

   of externals.

*/

--- subversion/trunk/subversion/libsvn_client/externals.c  2009/10/21 15:16:29              880225

+++ subversion/trunk/subversion/libsvn_client/externals.c              2009/10/21 15:56:05          880226

@@ -776,13 +776,14 @@ handle_external_item_change(const void *

                                                new_item->url, NULL,

                                                &(new_item->peg_revision),

                                                &(new_item->revision), ib->ctx,

-                                               ib->pool));

+                                                   ib->iter_pool));

 

-          SVN_ERR(svn_ra_get_uuid2(ra_session, &ra_cache.repos_uuid, ib->pool));

+          SVN_ERR(svn_ra_get_uuid2(ra_session, &ra_cache.repos_uuid,

+                                   ib->iter_pool));

       SVN_ERR(svn_ra_get_repos_root2(ra_session, &ra_cache.repos_root_url,

-                                     ib->pool));

+                                         ib->iter_pool));

           SVN_ERR(svn_ra_check_path(ra_session, "", ra_cache.ra_revnum, &kind,

-                                    ib->pool));

+                                ib->iter_pool));

 

           if (svn_node_none == kind)

             return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,

Failure symptom category

refuse valid input, early termination

Is there any log message?

Yes

Can we anticipate error?

Yes. Function return value checked! ‘read’ system call!

How can we automatically insert the log message?

read system call.