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

Re: Stack Trace for Ruby Segfaults

From: Kouhei Sutou <kou_at_cozmixng.org>
Date: 2005-06-22 18:28:20 CEST

Hi,

In <20050622012928.GA7144@jaa.iki.fi>
  "Re: Stack Trace for Ruby Segfaults" on Tue, 21 Jun 2005 19:29:28 -0600,
  Jani Averbach <jaa@jaa.iki.fi> wrote:

> Mine is segfaulting here:
> 0x00002aaaaac08204 in rb_hash_foreach () from /usr/lib/libruby18.so.1.8
> #0 0x00002aaaaac08204 in rb_hash_foreach () from /usr/lib/libruby18.so.1.8
> #1 0x00002aaaab6f53a9 in r2c_hash (hash=18446744072338819352, func=0x2aaaab6f5300 <r2c_hash_i>,
> ctx=0x7ffffffb3330, pool=0xcc8dd8)
> at /home/jaa/svn/svn/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c:342
> #2 0x00002aaaab5d5e88 in _wrap_svn_prop_diffs ()
> from /home/jaa/tmpfs/build/obj-svn-trunk/subversion/bindings/swig/ruby/.ext/svn/ext/core.so

Does the attached patch solve the problem?

I think freeing keys of apr_hash_t by ruby's GC causes the
problem. (the attached patch solves the case.)

If the attached patch doesn't solve the problem, I'll have
to put some statements for debug print. I still can't
reproduce the problem on my environment.

--
kou

Index: subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c
===================================================================
--- subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c (revision 15144)
+++ subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c (working copy)
@@ -318,7 +318,10 @@
 {
   if (key != Qundef) {
     void *val = data->func(value, data->ctx, data->pool);
- apr_hash_set(data->apr_hash, StringValuePtr(key), APR_HASH_KEY_STRING, val);
+ apr_hash_set(data->apr_hash,
+ apr_pstrdup(data->pool, StringValuePtr(key)),
+ APR_HASH_KEY_STRING,
+ val);
   }
   return ST_CONTINUE;
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jun 22 18:39:14 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.