I am working on a feed parsing application using the latest version of
Feedzirra and I am consistently getting segmentation faults on two of
the feeds I am trying to parse.
First here is my environment info:
RUBY VERSION: 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
Rails 2.3.2
pauldix-feedzirra (0.0.12)
pauldix-sax-machine (0.0.12)
mdalessio-dryopteris (0.1.1)
In an effort to locate the cause of the segfaults I simplified my
parsing code down to this class method which is called from a rake
task:
class Feed < ActiveRecord::Base
def self.parse(id)
ar_feed = Feed.find id
Rails.logger.info "Starting feed #{ar_feed.title} #
{ar_feed.feed_config.url}"
fz_feed = Feedzirra::Feed.fetch_and_parse
( ar_feed.feed_config.url )
Rails.logger.info "Parsed feed #{ar_feed.title} #
{ar_feed.feed_config.url}"
fz_feed.sanitize_entries!
end
end
When I execute this code I get this from the console:
Starting feed Countdown
http://rss.msnbc.msn.com/id/18424715/device/rss/rss.xml
Parsed feed Countdown
http://rss.msnbc.msn.com/id/18424715/device/rss/rss.xml
/usr/bin/rake:19: [BUG] Segmentation fault
ruby 1.8.6 (2008-03-03) [universal-darwin9.0]
Abort trap
And from the other feed I get:
Starting feed Red Tape Chronicles
http://redtape.msnbc.com/index.rdf
Parsed feed Red Tape Chronicles
http://redtape.msnbc.com/index.rdf
[path_to_my_app]/vendor/gems/mdalessio-dryopteris-0.1.1/lib/dryopteris/
sanitize.rb:45: [BUG] Segmentation fault
ruby 1.8.6 (2008-03-03) [universal-darwin9.0]
Abort trap
If I comment out the call to 'fz_feed.sanitize_entries!' the feeds
parse fine with no segfaults. Also just out of curiosity, I saved on
of the feeds to disk and fired up the console and executed:
>> file = File.new "[path_to_app]/tmp/redtape_feed.xml"
>> 1000.times { |i| Dryopteris.sanitize( file.read ) }
=> 1000
So, it seems that sanitizing in the context of parsing the feed with
Feedzirra causes the segfault but sanitizing the same content from the
console is fine...
I would appreciate any insight or assistance in resolving this issue.
Thanks,
-Jesse
On Mar 26, 9:53 pm, Julien Genestoux <
julien.genest...@gmail.com>
wrote:
> Hum,
>
> I have investigated and didn't really found anything that seem to work...
> I am also very "limited" in my C knowledge... but I'll try to work on that
> as well if anyone has "clues" or "tips" on where to start?
>
> It might not be Zlib::GzipReader though but rather curb? (if curb returns
> some "wong" data that would explain why the GzipReader fails.. I am
> suggesting this since Zlib seems to be part of Ruby, and I expect Ruby to be
> pretty well tested, while Curb seems to be a pretty recent lib so maybe not
> as reliable as Zlib...
>
> What do you guys think?
>
> Julien
>
> --
> Julien Genestoux, Notifixio.ushttp://
twitter.com/julien51http://www.ouvre-boite.comhttp://blog.notifixio.us
> On Wed, Mar 25, 2009 at 12:06 PM, Bobby Wilson <
bobbywils...@gmail.com>wrote:
>
> > Hey Guys,
> > I just wanted to pop in and say that I too experience the seg fault from
> > time to time and have an interest in helping resolve the bug. I don't know C
> > libraries very well but will be happy to help in any way possible.
>