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

rails + svn commit segfault

From: Matt White <matt_at_anewway.org>
Date: 2006-12-17 03:34:49 CET

Oops, accidentally posted this to dev@subversion.tigris.org, when I guess it
should really be posted here.

---
 
I am having a problem with a subversion crash that is driving me insane.  I
am developing a Rails interface to a Subversion repository
(http://spoxel.com <http://spoxel.com/> .. check it out) using the Ruby
bindings, and have started getting segfaults in subversion when trying to
commit to the repository.  For reference:
 
Debian Sarge
Rails 1.1.6
Ruby 1.8.4
SWIG: 1.3.24
Subversion 1.4.2
Apache 2.2.3
Mongrel 0.3.13.4
OpenSSL 0.9.7e
 
I have been working day and night on this problem and have had a hard time
narrowing down what exactly is happening and what is causing it.  The
problem is that it doesn't happen consistently, only that it happens more
often in certain situations.  The actual error I see is:
 
/usr/local/lib/ruby/site_ruby/1.8/svn/util.rb:60: [BUG] Segmentation fault
ruby 1.8.4 (2005-12-24) [i686-linux]
 
It seems to happen when trying to execute an "editor.add_file" or
"editor.add_directory", before the transaction is committed.  The following
factors seem to make the segfault happen more often:
 - large, complex commits
 - committing into a repository that has lots of revisions (at least a
couple hundred)
 - executing from a complex rails application (it happens less often in a
simple rails app and virtually never in a standalone ruby app, unless I
commit at least 1000 files)
 
I have had this site running for months and this problem started for no good
reason a few weeks ago; it wasn't too bad at first, but now it's crippling
our app (it seems like the crashes are happening more often now).  My best
guess through all this is that it is a memory problem, maybe something to do
with the Ruby garbage collector and/or the APR memory pools, but I've never
been able to pinpoint anything.  I have tried reconfiguring my system a lot
and have also been able to reproduce the problem on all the following
configurations:
 
Ruby 1.8.2, Ruby 1.8.5, Debian Etch, SVN 1.3.2, SVN 1.4.0, SVN trunk,
Lighttpd (completely removed apache/mongrel)
I have compiled SVN to use both the version of APR that comes with SVN and
the APR that comes with Apache 2.2.3; I recompiled SVN after each change in
configuration.
 
Here are my questions:
 
1)       Is there any documentation/examples/best practices on how to use
SVN with Ruby?  I haven't found any.  All my code was based on the unit test
code for the Ruby bindings.  It's possible that I've just coded everything
wrong.
 
2)       Has anyone else seen this problem?  I've noticed that there seems
to be a memory leak when I do the commits; don't know if it's related.  I've
seen this ticket: http://subversion.tigris.org/issues/show_bug.cgi?id=1964.
 
3)       How can I debug/work around this?  I've run out of options that I
can think of.
 
For reference, the commits I'm doing look similar to the following:
 
repo = Svn::Repos.open($repo_path)
rev = repo.youngest_rev.to_i
editor = repo.commit_editor('file://' + $repo_path, '/')
root_baton = editor.open_root(rev)
dir_baton = editor.add_directory($dir_path, root_baton, nil, -1)
file_baton = editor.add_file($filename, root_baton, nil, -1)
s = editor.apply_textdelta(file_baton, nil)
s.send($data)
.
editor.close_directory(dir_baton)
editor.close_edit
 
Thanks for any help.
 
Matt
matt@anewway.org
 
 
 
Received on Mon Dec 18 15:31:05 2006

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