Patrick Crosby
2007-Jan-29 21:33 UTC
[Backgroundrb-devel] loading C extension in worker causes bus error on OS X only
In all likelihood, this doesn''t have anything to do with backgroundrb, but I''m stuck so I thought someone might be able to help. I have a pretty simple C extension that I built into a gem and have installed on my system. It works fine when required from rails (1.2.1). But when I have a Backgroundrb worker class use the extension (under os x), I get: /usr/local/lib/ruby/gems/1.8/gems/opalfx-0.1.1582/lib/ofx_helper.bundle: [BUG] Bus Error ruby 1.8.4 (2005-12-24) [i686-darwin8.8.1] (That''s the right version of ruby). I''ve tried all kinds of stuff. I installed a trace function, but it''s crashing on the require statement. Trying to isolate the problem, even using irb, it gets a bus error (so definitely not backgroundrb''s fault). I tried it on a linux server (through irb) and it worked fine. Anyone have any ideas? Thanks. patrick
Mason Hale
2007-Jan-29 22:03 UTC
[Backgroundrb-devel] loading C extension in worker causes bus error on OS X only
I ran into this issue before: http://rubyforge.org/pipermail/backgroundrb-devel/2006-December/000594.html This is apparently a bug in the way external libraries are loaded on Mac OS X, in Ruby and other scripting languages. It has to do with the contents of the argv array changing between the launch of the scripting environment and the loading of the external module. It does not appear to be specific to BackgroundRb or even Ruby. A search for "mac os x bus error" in google will find reports of similar issues cropping up in the Perl and Python communities too. I''m working around the issue by using the pure-ruby Postgres driver on Mac OS. If you find a better solution, I''d very much appreciate a follow-up message with a better workaround. It''s useful to note that a similar issue was reported in Rails when using script/console, but a work around was found for that case. best regards, Mason On 1/29/07, Patrick Crosby <patrick at xblabs.com> wrote:> > In all likelihood, this doesn''t have anything to do with backgroundrb, > but I''m stuck so I thought someone might be able to help. > > I have a pretty simple C extension that I built into a gem and have > installed on my system. It works fine when required from rails > (1.2.1). > > But when I have a Backgroundrb worker class use the extension (under > os x), I get: > > /usr/local/lib/ruby/gems/1.8/gems/opalfx-0.1.1582/lib/ofx_helper.bundle: > [BUG] Bus Error > ruby 1.8.4 (2005-12-24) [i686-darwin8.8.1] > > (That''s the right version of ruby). > > I''ve tried all kinds of stuff. I installed a trace function, but it''s > crashing on the require statement. > > Trying to isolate the problem, even using irb, it gets a bus error (so > definitely not backgroundrb''s fault). I tried it on a linux server > (through irb) and it worked fine. > > Anyone have any ideas? > > Thanks. > > patrick > _______________________________________________ > Backgroundrb-devel mailing list > Backgroundrb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/backgroundrb-devel >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070129/faa76476/attachment.html
Patrick Crosby
2007-Jan-29 22:14 UTC
[Backgroundrb-devel] loading C extension in worker causes bus error on OS X only
I read the thread about specifying -r args on the irb command line causing bus errors on os x (for reference, this is the main one: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/142806 ), but why would that affect the backgroundrb server? The server starts up fine, but once it hits code that causes the require of the C extension, it gets the bus error. I get the same problem using rails'' script/console when I call something that requires this extension. (but again, all works fine in a rails app, or on linux). Thanks. patrick On 1/29/07, Mason Hale <masonhale at gmail.com> wrote:> I ran into this issue before: > http://rubyforge.org/pipermail/backgroundrb-devel/2006-December/000594.html > > This is apparently a bug in the way external libraries are loaded on Mac OS > X, in Ruby and other scripting languages. It has to do with the contents of > the argv array changing between the launch of the scripting environment and > the loading of the external module. It does not appear to be specific to > BackgroundRb or even Ruby. A search for "mac os x bus error" in google will > find reports of similar issues cropping up in the Perl and Python > communities too. > > I''m working around the issue by using the pure-ruby Postgres driver on Mac > OS. If you find a better solution, I''d very much appreciate a follow-up > message with a better workaround. It''s useful to note that a similar issue > was reported in Rails when using script/console, but a work around was found > for that case. > > best regards, > Mason > > > > > > On 1/29/07, Patrick Crosby <patrick at xblabs.com> wrote: > > > > In all likelihood, this doesn''t have anything to do with backgroundrb, > > but I''m stuck so I thought someone might be able to help. > > > > I have a pretty simple C extension that I built into a gem and have > > installed on my system. It works fine when required from rails > > (1.2.1). > > > > But when I have a Backgroundrb worker class use the extension (under > > os x), I get: > > > > > /usr/local/lib/ruby/gems/1.8/gems/opalfx-0.1.1582/lib/ofx_helper.bundle: > > [BUG] Bus Error > > ruby 1.8.4 (2005-12-24) [ i686-darwin8.8.1] > > > > (That''s the right version of ruby). > > > > I''ve tried all kinds of stuff. I installed a trace function, but it''s > > crashing on the require statement. > > > > Trying to isolate the problem, even using irb, it gets a bus error (so > > definitely not backgroundrb''s fault). I tried it on a linux server > > (through irb) and it worked fine. > > > > Anyone have any ideas? > > > > Thanks. > > > > patrick > > _______________________________________________ > > Backgroundrb-devel mailing list > > Backgroundrb-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/backgroundrb-devel > > > >-- http://www.xblabs.com
Mason Hale
2007-Jan-29 22:32 UTC
[Backgroundrb-devel] loading C extension in worker causes bus error on OS X only
I haven''t had time to track down and fix this issue wrt backgroundrb. I''m hobbling along with the pure-ruby postgres driver for now. My strong suspicion is that it has to do with nullify-ing the contents of the argv array, say by writing to $0 at some point. Where that might be happening, I don''t know. Mason On 1/29/07, Patrick Crosby <patrick at xblabs.com> wrote:> > I read the thread about specifying -r args on the irb command line > causing bus errors on os x (for reference, this is the main one: > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/142806 ), > but why would that affect the backgroundrb server? The server starts > up fine, but once it hits code that causes the require of the C > extension, it gets the bus error. > > I get the same problem using rails'' script/console when I call > something that requires this extension. > > (but again, all works fine in a rails app, or on linux). > > Thanks. > > patrick > > On 1/29/07, Mason Hale <masonhale at gmail.com> wrote: > > I ran into this issue before: > > > http://rubyforge.org/pipermail/backgroundrb-devel/2006-December/000594.html > > > > This is apparently a bug in the way external libraries are loaded on Mac > OS > > X, in Ruby and other scripting languages. It has to do with the contents > of > > the argv array changing between the launch of the scripting environment > and > > the loading of the external module. It does not appear to be specific to > > BackgroundRb or even Ruby. A search for "mac os x bus error" in google > will > > find reports of similar issues cropping up in the Perl and Python > > communities too. > > > > I''m working around the issue by using the pure-ruby Postgres driver on > Mac > > OS. If you find a better solution, I''d very much appreciate a follow-up > > message with a better workaround. It''s useful to note that a similar > issue > > was reported in Rails when using script/console, but a work around was > found > > for that case. > > > > best regards, > > Mason > > > > > > > > > > > > On 1/29/07, Patrick Crosby <patrick at xblabs.com> wrote: > > > > > > In all likelihood, this doesn''t have anything to do with backgroundrb, > > > but I''m stuck so I thought someone might be able to help. > > > > > > I have a pretty simple C extension that I built into a gem and have > > > installed on my system. It works fine when required from rails > > > (1.2.1). > > > > > > But when I have a Backgroundrb worker class use the extension (under > > > os x), I get: > > > > > > > > /usr/local/lib/ruby/gems/1.8/gems/opalfx-0.1.1582/lib/ofx_helper.bundle: > > > [BUG] Bus Error > > > ruby 1.8.4 (2005-12-24) [ i686-darwin8.8.1] > > > > > > (That''s the right version of ruby). > > > > > > I''ve tried all kinds of stuff. I installed a trace function, but it''s > > > crashing on the require statement. > > > > > > Trying to isolate the problem, even using irb, it gets a bus error (so > > > definitely not backgroundrb''s fault). I tried it on a linux server > > > (through irb) and it worked fine. > > > > > > Anyone have any ideas? > > > > > > Thanks. > > > > > > patrick > > > _______________________________________________ > > > Backgroundrb-devel mailing list > > > Backgroundrb-devel at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/backgroundrb-devel > > > > > > > > > > -- > http://www.xblabs.com >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070129/424e7304/attachment-0001.html
Patrick Crosby
2007-Jan-30 03:57 UTC
[Backgroundrb-devel] loading C extension in worker causes bus error on OS X only
So I got it working...I edited script/backgroundrb and put the require for the C extension in the script right before the last line where it runs the server. Doesn''t make any sense, but it works, so that''s good enough for me for now. patrick On 1/29/07, Mason Hale <masonhale at gmail.com> wrote:> > I haven''t had time to track down and fix this issue wrt backgroundrb. I''m > hobbling along with the pure-ruby postgres driver for now. > > My strong suspicion is that it has to do with nullify-ing the contents of > the argv array, say by writing to $0 at some point. Where that might be > happening, I don''t know. > > > Mason > > On 1/29/07, Patrick Crosby <patrick at xblabs.com> wrote: > > I read the thread about specifying -r args on the irb command line > > causing bus errors on os x (for reference, this is the main one: > > > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/142806 > ), > > but why would that affect the backgroundrb server? The server starts > > up fine, but once it hits code that causes the require of the C > > extension, it gets the bus error. > > > > I get the same problem using rails'' script/console when I call > > something that requires this extension. > > > > (but again, all works fine in a rails app, or on linux). > > > > Thanks. > > > > patrick > > > > On 1/29/07, Mason Hale <masonhale at gmail.com > wrote: > > > I ran into this issue before: > > > > http://rubyforge.org/pipermail/backgroundrb-devel/2006-December/000594.html > > > > > > This is apparently a bug in the way external libraries are loaded on Mac > OS > > > X, in Ruby and other scripting languages. It has to do with the contents > of > > > the argv array changing between the launch of the scripting environment > and > > > the loading of the external module. It does not appear to be specific to > > > BackgroundRb or even Ruby. A search for "mac os x bus error" in google > will > > > find reports of similar issues cropping up in the Perl and Python > > > communities too. > > > > > > I''m working around the issue by using the pure-ruby Postgres driver on > Mac > > > OS. If you find a better solution, I''d very much appreciate a follow-up > > > message with a better workaround. It''s useful to note that a similar > issue > > > was reported in Rails when using script/console, but a work around was > found > > > for that case. > > > > > > best regards, > > > Mason > > > > > > > > > > > > > > > > > > On 1/29/07, Patrick Crosby < patrick at xblabs.com> wrote: > > > > > > > > In all likelihood, this doesn''t have anything to do with backgroundrb, > > > > but I''m stuck so I thought someone might be able to help. > > > > > > > > I have a pretty simple C extension that I built into a gem and have > > > > installed on my system. It works fine when required from rails > > > > (1.2.1). > > > > > > > > But when I have a Backgroundrb worker class use the extension (under > > > > os x), I get: > > > > > > > > > > > > /usr/local/lib/ruby/gems/1.8/gems/opalfx-0.1.1582/lib/ofx_helper.bundle: > > > > [BUG] Bus Error > > > > ruby 1.8.4 (2005-12-24) [ i686-darwin8.8.1] > > > > > > > > (That''s the right version of ruby). > > > > > > > > I''ve tried all kinds of stuff. I installed a trace function, but it''s > > > > crashing on the require statement. > > > > > > > > Trying to isolate the problem, even using irb, it gets a bus error (so > > > > definitely not backgroundrb''s fault). I tried it on a linux server > > > > (through irb) and it worked fine. > > > > > > > > Anyone have any ideas? > > > > > > > > Thanks. > > > > > > > > patrick > > > > _______________________________________________ > > > > Backgroundrb-devel mailing list > > > > Backgroundrb-devel at rubyforge.org > > > > > http://rubyforge.org/mailman/listinfo/backgroundrb-devel > > > > > > > > > > > > > > > > -- > > http://www.xblabs.com > > > >-- http://www.xblabs.com