Bug #1227
closed[BUG] object allocation during garbage collection phase
Description
=begin
I'm trying to profile sections of a large application (taskjuggler) with ruby-prof. As soon as I hit the RubyProf.stop call, I get the attached error message. Since ruby-prof is using C code as well, this may be a ruby-prof issue, but could also be a generic ruby bug. ruby 1.9 and ruby-prof both from svn today. Enclosing the RubyProf.stop call with GC.en-/disabled calls is a workaround, but no long-term solution.
To reproduce:
get ruby 1.9 and ruby-prof from svn. get taskjuggler3 from git (commit eee3a2c6f0d559086f95bc2b02e54bdae337fd95) has the offending code.
git clone http://www.taskjuggler.org/git-repos/taskjuggler3.git
cd taskjuggler3
git checkout eee3a2c6f0d559086f95bc2b02e54bdae337fd9
cd lib; ruby taskjuggler3.rb ../examples/acso.tjp
=end
Files
Updated by cfis (Charlie Savage) over 15 years ago
=begin
Hey Chris,
Just saw this. I haven't had a chance to update ruby-prof to 1.9.1 yet. Have you tried yet? Unfortunately, I'm not sure I'll get to it anytime soon, so any help appreciated.
=end
Updated by orem (Chris Schlaeger) over 15 years ago
=begin
Yes, I was using Ruby 1.9.1 (or rather a post 1.9.1 SVN snapshot).
Chris
On Mon, Mar 9, 2009 at 8:00 AM, Charlie Savage redmine@ruby-lang.org wrote:
Issue #1227 has been updated by Charlie Savage.
Hey Chris,
Just saw this. I haven't had a chance to update ruby-prof to 1.9.1 yet. Have you tried yet? Unfortunately, I'm not sure I'll get to it anytime soon, so any help appreciated.¶
http://redmine.ruby-lang.org/issues/show/1227
=end
Updated by nobu (Nobuyoshi Nakada) over 15 years ago
=begin
Hi,
At Sun, 1 Mar 2009 02:00:04 +0900,
Chris Schlaeger wrote in [ruby-core:22597]:
To reproduce:
get ruby 1.9 and ruby-prof from svn.
Where's ruby-prof svn?
--
Nobu Nakada
=end
Updated by nobu (Nobuyoshi Nakada) over 15 years ago
=begin
Hi,
At Mon, 9 Mar 2009 19:24:33 +0900,
daz wrote in [ruby-core:22781]:
Maybe this, from:
http://rubyforge.org/scm/?group_id=1814svn checkout http://ruby-prof.rubyforge.org/svn/
or
svn checkout svn://rubyforge.org/var/svn/ruby-prof
Thank you.
It was a bug of ruby-prof. It tries to allocate an object
during mark phase.
Index: ext/ruby_prof.c
--- ext/ruby_prof.c (revision 362)
+++ ext/ruby_prof.c (working copy)
@@ -311,8 +311,8 @@ static void
prof_call_info_mark(prof_call_info_t *call_info)
{
- rb_gc_mark(prof_method_wrap(call_info->target));
- rb_gc_mark(call_info->target->object);
rb_gc_mark(call_info->children);
if (call_info->parent)
- rb_gc_mark(prof_call_info_wrap(call_info->parent));
- rb_gc_mark(call_info->parent->object);
}
--
Nobu Nakada
=end
Updated by nobu (Nobuyoshi Nakada) over 15 years ago
- Status changed from Open to Third Party's Issue
=begin
=end
Updated by nobu (Nobuyoshi Nakada) over 15 years ago
=begin
Hi,
At Wed, 18 Mar 2009 11:14:05 +0900,
Nobuyoshi Nakada wrote in [ruby-core:22925]:
It was a bug of ruby-prof. It tries to allocate an object
during mark phase.
This patch might not be enough. You would need to mark objects
refered by call_info->target and call_info->parent even if they
are not created.
Index: ext/ruby_prof.c
--- ext/ruby_prof.c (revision 362)
+++ ext/ruby_prof.c (working copy)
@@ -308,11 +308,26 @@ prof_call_info_create(prof_method_t* met
}
+static void prof_method_mark(prof_method_t *method);
+
static void
prof_call_info_mark(prof_call_info_t *call_info)
{
- rb_gc_mark(prof_method_wrap(call_info->target));
- {
- VALUE target = call_info->target->object;
- if (NIL_P(target))
-
prof_method_mark(call_info->target);
- else
-
rb_gc_mark(target);
- }
rb_gc_mark(call_info->children);
- if (call_info->parent)
- rb_gc_mark(prof_call_info_wrap(call_info->parent));
- if (call_info->parent) {
- VALUE parent = call_info->parent->object;
- if (NIL_P(parent)) {
-
prof_call_info_mark(call_info->parent);
- }
- else {
-
rb_gc_mark(parent);
- }
- }
}
--
Nobu Nakada
=end
Updated by rogerdpack (Roger Pack) about 15 years ago
=begin
could you try this version and see if it fixes the problem?
http://github.com/rdp/ruby-prof
=end