You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Blair Zajac <bl...@orcaware.com> on 2007/02/16 19:32:52 UTC

Ruby bindings core dump

I've been getting consistent core dumps in a simple Ruby script using 
Ruby 1.8.5-pl2 and Subversion 1.4.3 on a Centos 4.1 box.  It creates a 
Berkeley DB svn repository and then using a wc, just creates top level 
directories in it and commits into it.  At some point, it'll core:

/usr/local/lib/ruby/site_ruby/1.8/svn/util.rb:60:in 
`svn_client_commit3': subversion/libsvn_client/commit.c:865 Commit 
failed (details follow): (Svn::Error::RA_LOCAL_REPOS_OPEN_FAILED)
Unable to open an ra_local session to URL
Unable to open repository 'file:///tmp/repos'
Berkeley DB error for filesystem '/tmp/repos/db' while opening 'copies' 
table:
Cannot allocate memory
bdb: Lock table is out of available locker entries      from 
/usr/local/lib/ruby/site_ruby/1.8/svn/util.rb:60:in `call'
         from /usr/local/lib/ruby/site_ruby/1.8/svn/util.rb:60:in `commit3'
         from /usr/local/lib/ruby/site_ruby/1.8/svn/client.rb:94:in `commit'
         from ./i.rb:34:in `make_dir'
         from ./i.rb:42
         from ./i.rb:39:in `each'
         from ./i.rb:39
Adding /tmp/wc/abc82...Abort (core dumped)


#0  0x001027a2 in ?? () from /lib/ld-linux.so.2
#1  0x001427d5 in raise () from /lib/tls/libc.so.6
#2  0x00144149 in abort () from /lib/tls/libc.so.6
#3  0x007a36aa in default_warning_func (baton=0x0, err=0x9dd0880)
     at subversion/libsvn_fs/fs-loader.c:307
#4  0x00336f75 in cleanup_fs_apr (data=0x9dcf7d8)
     at subversion/libsvn_fs_base/fs.c:298
#5  0x003c4fc5 in run_cleanups (cref=0x9dae8a8) at apr_pools.c:1959
#6  0x003c5ade in apr_pool_destroy (pool=0x9dae898) at apr_pools.c:731
#7  0x00ca1e24 in apr_pool_wrapper_destroy (self=0x9dae868)
     at ./subversion/bindings/swig/ruby/core.c:1199
#8  0x00caf7f1 in free_apr_pool_wrapper_t (arg1=0x9dae868)
     at ./subversion/bindings/swig/ruby/core.c:11802
#9  0x00ea8a75 in rb_gc_call_finalizer_at_exit () at gc.c:1884
#10 0x00e876f5 in ruby_finalize_1 () at eval.c:1542
#11 0x00e9cf38 in ruby_cleanup (ex=1) at eval.c:1577
#12 0x00e9d01d in ruby_stop (ex=0) at eval.c:1608
#13 0x00e9d07f in ruby_run () at eval.c:1629
#14 0x08048644 in main ()


Below is the script.  Is there something that the Ruby bindings are not 
cleaning up?

Regards,
Blair

-- 
Blair Zajac, Ph.D.
<bl...@orcaware.com>
Subversion training, consulting and support
http://www.orcaware.com/svn/


#!/usr/local/bin/ruby

require 'fileutils'
require 'svn/client'

$root_repos = "#{Dir.getwd}/repos"
$root_wc = "#{Dir.getwd}/wc"

FileUtils.remove_dir($root_repos, true)
FileUtils.remove_dir($root_wc, true)
system("svnadmin create --fs-type bdb #{$root_repos}")

$ctx = Svn::Client::Context.new
$ctx.add_simple_provider

$ctx.add_username_prompt_provider(0) do |cred, realm, username, may_save|
   cred.username = 'blairzajac'
   cred.may_save = false
end

$ctx.checkout("file://#{$root_repos}", $root_wc)

global_log_message = ""

def make_dir(show_name)
   show_dir = "#{$root_wc}/#{show_name}"
   unless File.directory?(show_dir)
     print "Adding #{show_dir}..."
     $ctx.mkdir(show_dir)
     global_log_message = "Adding show '#{show_name}'."
     $ctx.set_log_msg_func do |items|
       [true, "Adding show '#{show_name}'."]
     end
     $ctx.commit([$root_wc])
     puts ''
   end
end

(0..1000).each do |i|
   d = "abc#{i}"
   puts d
   make_dir(d)
end

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Ruby bindings core dump

Posted by Kouhei Sutou <ko...@cozmixng.org>.
Hi,

In <45...@orcaware.com>
  "Re: Ruby bindings core dump" on Sat, 17 Feb 2007 13:18:02 -0800,
  Blair Zajac <bl...@orcaware.com> wrote:

> > The reason why it makes core is that
> > fs-loader.c:default_warning_func() calls abort(). The reason
> > why fs-loader.c:default_warning() is called is that the Ruby
> > bindings 1.4.x doesn't clever for memory management. The
> > ruby bindings trunk improved that.
> 
> Can we merge some of these changes into the 1.4.x branch, or are there 
> too many changes?

The changes are r23251 and r23256. But I've not tried that
the changes can be merged into 1.4.x branch yet... Sorry.


> > We may think about svn_fs's warning_func API on the Ruby
> > bindings. Supporting this feature may cause a problem
> > because warning_func may be called after Ruby is cleanuped
> > (this case).
> 
> Can we have Ruby clean up apr and svn when it cleans itself up?

Now, the Ruby bindings' clean up process is the following:

  a Ruby script exits -> run Ruby's GC -> pools are GC'ed
  (warning_func may be called and warning_func may call
  callback written by Ruby. This is a problem because Ruby
  is already in cleanup process) -> atexit(3) ->
  apr_terminate() (warning_func may be called too)


Thanks,
--
kou

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Ruby bindings core dump

Posted by Blair Zajac <bl...@orcaware.com>.
Kouhei Sutou wrote:
> Hi,
> 
> In <45...@orcaware.com>
>   "Ruby bindings core dump" on Fri, 16 Feb 2007 11:32:52 -0800,
>   Blair Zajac <bl...@orcaware.com> wrote:
> 
>> I've been getting consistent core dumps in a simple Ruby script using 
>> Ruby 1.8.5-pl2 and Subversion 1.4.3 on a Centos 4.1 box.  It creates a 
>> Berkeley DB svn repository and then using a wc, just creates top level 
>> directories in it and commits into it.  At some point, it'll core:
> 
> The reason why it makes core is that
> fs-loader.c:default_warning_func() calls abort(). The reason
> why fs-loader.c:default_warning() is called is that the Ruby
> bindings 1.4.x doesn't clever for memory management. The
> ruby bindings trunk improved that.

Thanks Kou,

Can we merge some of these changes into the 1.4.x branch, or are there 
too many changes?

> The following change is a workaround for this problem.
> 
>> (0..1000).each do |i|
>>    d = "abc#{i}"
>>    puts d
>>    make_dir(d)
>      GC.start
>> end
> 
> 
> We may think about svn_fs's warning_func API on the Ruby
> bindings. Supporting this feature may cause a problem
> because warning_func may be called after Ruby is cleanuped
> (this case).

Can we have Ruby clean up apr and svn when it cleans itself up?

Regards,
Blair

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Ruby bindings core dump

Posted by Kouhei Sutou <ko...@cozmixng.org>.
Hi,

In <45...@orcaware.com>
  "Ruby bindings core dump" on Fri, 16 Feb 2007 11:32:52 -0800,
  Blair Zajac <bl...@orcaware.com> wrote:

> I've been getting consistent core dumps in a simple Ruby script using 
> Ruby 1.8.5-pl2 and Subversion 1.4.3 on a Centos 4.1 box.  It creates a 
> Berkeley DB svn repository and then using a wc, just creates top level 
> directories in it and commits into it.  At some point, it'll core:

The reason why it makes core is that
fs-loader.c:default_warning_func() calls abort(). The reason
why fs-loader.c:default_warning() is called is that the Ruby
bindings 1.4.x doesn't clever for memory management. The
ruby bindings trunk improved that.

The following change is a workaround for this problem.

> (0..1000).each do |i|
>    d = "abc#{i}"
>    puts d
>    make_dir(d)
     GC.start
> end


We may think about svn_fs's warning_func API on the Ruby
bindings. Supporting this feature may cause a problem
because warning_func may be called after Ruby is cleanuped
(this case).

Thanks,
--
kou

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org