Project

General

Profile

Bug #3250

[BUG] Segmentation fault

Added by DBA (Diogo Almeida) about 10 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby 1.9.2dev (2010-05-04 trunk 27615) [x86_64-darwin10.3.0]
Backport:
[ruby-core:30023]

Description

=begin
Hello,

I was attempting to extract some metadata of a couple of videos using MediaInfo CLI and MediaInfo gem (http://github.com/greatseth/mediainfo). However, when attempting to access the duration of a video I get the following possible bug notification:

/Users/dba/.rvm/gems/ruby-head/gems/mediainfo-0.7.1/lib/mediainfo/attr_readers.rb:36: [BUG] Segmentation fault
ruby 1.9.2dev (2010-05-04 trunk 27615) [x86_64-darwin10.3.0]

-- control frame ----------
c:0014 p:0067 s:0047 b:0046 l:000430 d:000045 LAMBDA /Users/dba/.rvm/gems/ruby-head/gems/mediainfo-0.7.1/lib/mediainfo/attr_readers.rb:36
c:0013 p:---- s:0043 b:0043 l:000042 d:000042 FINISH
c:0012 p:0075 s:0041 b:0041 l:000c28 d:000c28 METHOD /Users/dba/.rvm/gems/ruby-head/gems/mediainfo-0.7.1/lib/mediainfo.rb:143
c:0011 p:---- s:0034 b:0034 l:000033 d:000033 FINISH
c:0010 p:0255 s:0032 b:0031 l:000d90 d:000d90 METHOD /Users/dba/work/mobbit/insight.v3/programming/content_upload_daemon/lib/insight_v3/video.rb:56
c:0009 p:0011 s:0025 b:0025 l:000024 d:000024 METHOD /Users/dba/work/mobbit/insight.v3/programming/content_upload_daemon/lib/insight_v3/video.rb:21
c:0008 p:0042 s:0021 b:0021 l:000020 d:000020 METHOD /Users/dba/work/mobbit/insight.v3/programming/content_upload_daemon/lib/insight_v3/upload_processor/file_processor.rb:11
c:0007 p:0088 s:0017 b:0017 l:000016 d:000016 METHOD /Users/dba/work/mobbit/insight.v3/programming/content_upload_daemon/lib/insight_v3/upload_processor/daemon.rb:24
c:0006 p:0027 s:0013 b:0013 l:001498 d:000012 BLOCK ./bin/content_upload_daemon:22
c:0005 p:---- s:0011 b:0011 l:000010 d:000010 FINISH
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :loop
c:0003 p:0206 s:0006 b:0006 l:001498 d:000a48 EVAL ./bin/content_upload_daemon:21
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001498 d:001498 TOP


-- Ruby level backtrace information ----------------------------------------
./bin/content_upload_daemon:21:in <main>'
./bin/content_upload_daemon:21:in
loop'
./bin/content_upload_daemon:22:in block in <main>'
/Users/dba/work/mobbit/insight.v3/programming/content_upload_daemon/lib/insight_v3/upload_processor/daemon.rb:24:in
start'
/Users/dba/work/mobbit/insight.v3/programming/content_upload_daemon/lib/insight_v3/upload_processor/file_processor.rb:11:in process_product_file'
/Users/dba/work/mobbit/insight.v3/programming/content_upload_daemon/lib/insight_v3/video.rb:21:in
create_sample!'
/Users/dba/work/mobbit/insight.v3/programming/content_upload_daemon/lib/insight_v3/video.rb:56:in inspect_video'
/Users/dba/.rvm/gems/ruby-head/gems/mediainfo-0.7.1/lib/mediainfo.rb:143:in
method_missing'
/Users/dba/.rvm/gems/ruby-head/gems/mediainfo-0.7.1/lib/mediainfo/attr_readers.rb:36:in `block in mediainfo_attr_reader'

-- C level backtrace information -------------------------------------------

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap

Here's the invoking code:
begin
debugger

         info = Mediainfo.new destination_file_path

         return false unless info && info.video? && info.video.count == 1

         self.duration = info.video.duration
         self.fps = info.video.fps

         true
       rescue
         logger.fatal "Unable to access Video Info through MediaInfo CLI!\n$!"
         return false
       end

=end


Related issues

Has duplicate Ruby master - Bug #3254: [BUG] Segmentation faultClosed05/07/2010Actions
#1

Updated by mame (Yusuke Endoh) about 10 years ago

  • Status changed from Open to Third Party's Issue

=begin
Hi,

Could you ask the author of MediaInfo first?
I temporarily set this ticket status to Third Party's issue.

The invoking code is not self-contained and cannot be executed.
To investigate this issue, a self-contained code and a target video
would be very helpful.

In addition, what are you using XML parser?
MediaInfo seems to be configurable to use REXML, Hpricot or Nokogiri.
If you use REXML then ruby core might have a bug because it is all
pure ruby. But if you use Hpricot or Nokogiri, they might have a bug.

--
Yusuke Endoh mame@tsg.ne.jp
=end

#2

Updated by DBA (Diogo Almeida) about 10 years ago

=begin
Hello Yusuke Endoh,

I've created a github public repository, which is accessible at http://github.com/DBA/mediainfo_ruby_bug. In this repo you'll be able to find a couple of self-contained tests that reproduce the reported bug, along with a target video.

The bug occurs while using REXML as a parser, though it also occurs with nokogiri. It might be something with the way the gem is coded, but it could also be something at the Ruby level itself. Might be worth double checking by someone with more ruby-fu than I :)

Last reproduced the issue with the following stack:

ruby 1.9.2dev (2010-05-05 trunk 27631) [x86_64-darwin10.3.0]
Using mediainfo (0.7.1) from bundler gems
Using nokogiri (1.4.1) from bundler gems
Using shoulda (2.10.3) from bundler gems

This issue has already been reported to MediaInfo http://github.com/greatseth/mediainfo/issues#issue/5

Please let me know if I can be of further assistance for the resolution / identification of this issue. Would be glad to help.

Best regards,
DBA
=end

#3

Updated by mame (Yusuke Endoh) about 10 years ago

  • Status changed from Third Party's Issue to Assigned
  • Assignee set to mame (Yusuke Endoh)

=begin
Hi,

2010/5/7 Diogo Almeida redmine@ruby-lang.org:

I've created a github public repository, which is accessible at http://github.com/DBA/mediainfo_ruby_bug. In this repo you'll be able to find a couple of self-contained tests that reproduce the reported bug, along with a target video.

Thank you so much! I could reproduce the issue with mediainfo and
shoulda gem installed.
I guess this is a bug of ruby core. I'll investigate.

--
Yusuke Endoh mame@tsg.ne.jp
=end

#4

Updated by mame (Yusuke Endoh) about 10 years ago

  • Status changed from Assigned to Feedback
  • Target version set to 1.9.2

=begin
Hi,

The issue is fixed on my environment by the following patch.
Could you try it?

diff --git a/proc.c b/proc.c
index 9539f71..332c149 100644
--- a/proc.c
+++ b/proc.c
@@ -105,6 +105,7 @@ proc_dup(VALUE self)

  dst->block = src->block;
  dst->block.proc = procval;
  • dst->blockprocval = src->blockprocval; dst->envval = src->envval; dst->safe_level = src->safe_level; dst->is_lambda = src->is_lambda;

--
Yusuke Endoh mame@tsg.ne.jp
=end

#5

Updated by mame (Yusuke Endoh) about 10 years ago

=begin
A smaller test case (for the record):

class C
def self.set(name)
define_method(name) { yield }
end
set(:foo) { p :boo }
end
GC.stress = true
C.new.foo

--
Yusuke Endoh mame@tsg.ne.jp
=end

#6

Updated by DBA (Diogo Almeida) about 10 years ago

=begin
Hello again Yusuke,

Your patch makes my tests pass. Your test also passes.

Nice work!
Best regards,
DBA

=end

#7

Updated by mame (Yusuke Endoh) about 10 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r27703.
Diogo, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF