Bug #4251

Segmentation fault when using ruby-prof and Ruby 1.9.2

Added by Evan Chaney over 4 years ago. Updated almost 4 years ago.

[ruby-core:34244]
Status:Third Party's Issue
Priority:Normal
Assignee:-
ruby -v:ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0] Backport:

Description

=begin
ISSUE

Segmentation faults occur when profiling Rails 3 controller actions that add new objects to the database using Ruby 1.9.2 and ruby-prof.

EXPECTED BEHAVIOR

  • ruby-prof profile of controller action produced without issue.

ACTUAL BEHAVIOR

  • Ruby terminates with a segmentation fault during execution of controller action.

TROUBLESHOOTING/REDUCTION

  • Created new, empty Rails 3.0.3 project. Added one resource with no attributes, methods. Added profiling of 1000 creates of the resource in ItemsController#index action.
  • Ran "rails server" using Ruby 1.9.2 p0. Loaded http://localhost:3000/items in browser. Server crashed with segmentation fault.
  • Ran "rails server" using Ruby 1.8.7 p302. Loaded same URI. Action executed without issue.
  • Repeated this test under different OS using same project files and Ruby 1.9.2 p0. Issue persisted.

SYSTEM CONFIGURATION

  • Ruby 1.9.2 p0
  • Rails 3.0.3
  • ruby-prof 0.9.2
  • Mac OS X 10.6.6 =end

segfaulter.zip - Test case referred to in troubleshooting description (118 KB) Evan Chaney, 01/08/2011 12:33 PM

segfaulter_backtrace.txt Magnifier - Backtrace from segmentation fault (21.4 KB) Evan Chaney, 01/08/2011 12:33 PM

History

#1 Updated by Aaron Patterson over 4 years ago

=begin
On Sat, Jan 08, 2011 at 12:34:39PM +0900, Evan Chaney wrote:

Bug #4251: Segmentation fault when using ruby-prof and Ruby 1.9.2
http://redmine.ruby-lang.org/issues/show/4251

Author: Evan Chaney
Status: Open, Priority: Normal
ruby -v: ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

ISSUE

Segmentation faults occur when profiling Rails 3 controller actions that add new objects to the database using Ruby 1.9.2 and ruby-prof.

EXPECTED BEHAVIOR

  • ruby-prof profile of controller action produced without issue.

ACTUAL BEHAVIOR

  • Ruby terminates with a segmentation fault during execution of controller action.

TROUBLESHOOTING/REDUCTION

  • Created new, empty Rails 3.0.3 project. Added one resource with no attributes, methods. Added profiling of 1000 creates of the resource in ItemsController#index action.
  • Ran "rails server" using Ruby 1.9.2 p0. Loaded http://localhost:3000/items in browser. Server crashed with segmentation fault.
  • Ran "rails server" using Ruby 1.8.7 p302. Loaded same URI. Action executed without issue.
  • Repeated this test under different OS using same project files and Ruby 1.9.2 p0. Issue persisted.

SYSTEM CONFIGURATION

  • Ruby 1.9.2 p0
  • Rails 3.0.3
  • ruby-prof 0.9.2
  • Mac OS X 10.6.6

Have you tried the latest version of 1.9.2?

ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p136.tar.gz

--
Aaron Patterson
http://tenderlovemaking.com/

Attachment: (unnamed)
=end

#2 Updated by Evan Chaney over 4 years ago

=begin
Issue persists on ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0].
=end

#3 Updated by Loren Segal over 4 years ago

=begin
On 1/11/2011 6:16 PM, Evan Chaney wrote:

Issue persists on ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0].

This is an issue with ruby-prof, not Rails or Ruby itself. I've had
segfaults with ruby-prof running against YARD a few weeks back, so this
is likely just a third-party issue.

FWIW, Ruby 1.9.x has a Profiler class that is admittedly slow, but might
be able to stand in for the time being.

=end

#4 Updated by Charles Nutter over 4 years ago

=begin
It's certainly not a perfect 1.9 implementation, but profiling on JRuby's 1.9 mode using --profile or --profile.graph (or the jruby-prof gem) may also be a fine stand-in for now. The profiling boundaries are similar to ruby-prof, and may reveal the same bottlenecks as running under Ruby 1.9.

Of course, there are other challenges to "just run it" on JRuby...
=end

#5 Updated by Roger Pack about 4 years ago

=begin
gdb backtrace shows this:

...
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
[Switching to process 70350]
exec_event_hooks inlined at /Users/evan/.rvm/src/ruby-1.9.2-p136/thread.c:3778
3778 if (flag & hook->flag) {
(gdb) whe
#0 exec_event_hooks inlined at /Users/evan/.rvm/src/ruby-1.9.2-p136/thread.c:3778
...

if anybody has any clues that might help me out.

ref: http://dl.dropbox.com/u/371596/segfaulter_gdb_backtrace.txt
=end

#6 Updated by Yui NARUSE almost 4 years ago

  • Status changed from Open to Third Party's Issue

It seems ruby-prof's issue.

Also available in: Atom PDF