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

[PATCH] fix non interruptable hang in svn client when connecting

From: Yun Zheng Hu <yunzheng.hu_at_gmail.com>
Date: 2005-08-25 00:40:07 CEST

[[[
When you connect to a non existing repository, but the host exists,
the apr_socket_connect will loop forever somehow, and is NOT
interruptable.
On OS X this will result in a inresponsive system, which is very bad.

How to reproduce:
 svn co svn://svn.edgewall.com

There is no svn server running on that port, so try a CTRL-C to
cancel, but its not possible.. it will loop forever. process is not
killable on OS X either.

I found out that somebody else was having this problem too, but could
not find a bug report and neither the fix. The user that was having
this same bug can be read on:

http://svn.haxx.se/users/archive-2005-07/1027.shtml

The following patch will set a timeout of 10 seconds on apr_socket_connect.
So if it cant connect it will timeout safely, 10 seconds should be
more than enough I think.
The patch will also include the port number in the error message, it
might be useful or not..
]]]

The patch is very simple, open up:
subversion/libsvn_ra_svn/client.c

search for: "apr_socket_connect", and change the code to:

  status = apr_setsocketopt(*sock, APR_SO_TIMEOUT, 10 * APR_USEC_PER_SEC);
  if (status)
    return svn_error_wrap_apr(status, _("Can't set timeout"));

  status = apr_socket_connect(*sock, sa);
  if (status)
    return svn_error_wrap_apr(status, _("Can't connect to host '%s' on
port %u"),
                              hostname, port);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Aug 25 01:25:25 2005

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.