[Ruby] Active Record looses connection to mySQL. ERROR: Whileexecuting gem (ArgumentError). string contains null byte

Pete Higgins PHiggins at melodeo.com
Sat May 12 11:59:03 PDT 2007


On gentoo you can just install the mysql-ruby package, which I think gets pulled in as a dependency when you emerge rails with the mysql use flag on.


lihnucks phiggins # emerge mysql-ruby -vp

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] dev-ruby/mysql-ruby-2.7.3  0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB


-----Original Message-----
From: ruby-bounces at zenspider.com on behalf of Daevid Vincent
Sent: Fri 5/11/2007 10:26 PM
To: 'Seattle Ruby Brigade!'
Subject: Re: [Ruby] Active Record looses connection to mySQL. ERROR: Whileexecuting gem (ArgumentError). string contains null byte
 
Uh oh. I tried to do this exact same patch on my VMWare development Gentoo "box", and I get an error.

vmware ~ # gem install mysql -- --with-mysql-dir=/usr/lib/mysql
Attempting local installation of 'mysql'
Local gem file not found: mysql*.gem
Attempting remote installation of 'mysql'
Updating Gem source index for: http://gems.rubyforge.org
Select which gem to install for your platform (i686-linux)
 1. mysql 2.7.3 (mswin32)
 2. mysql 2.7.1 (mswin32)
 3. mysql 2.7 (ruby)
 4. mysql 2.6 (ruby)
 5. mysql 2.5.1 (ruby)
 6. Cancel installation
> 3
ERROR:  While executing gem ... (ArgumentError)
    string contains null byte 

> -----Original Message-----
> From: ruby-bounces at zenspider.com 
> [mailto:ruby-bounces at zenspider.com] On Behalf Of Daevid Vincent
> Sent: Friday, May 11, 2007 10:00 PM
> To: 'Seattle Ruby Brigade!'
> Subject: Re: [Ruby] Active Record looses connection to mySQL
> 
> Thank you Corey (and Ryan) so far...
> 
> It seemes to have installed just fine. Okay, now what? Do I 
> have to modify any of my code to point to this new driver or 
> remove the
> old mysql driver or anything?
> 
> # gem list
> 
> *** LOCAL GEMS ***
> 
> actionmailer (1.2.5, 1.1.5)
>     Service layer for easy email delivery and testing.
> 
> actionpack (1.12.5, 1.11.2)
>     Web-flow and rendering framework putting the VC in MVC.
> 
> actionwebservice (1.1.6, 1.0.0)
>     Web service support for Action Pack.
> 
> activerecord (1.14.4, 1.13.2)
>     Implements the ActiveRecord pattern for ORM.
> 
> activesupport (1.3.1, 1.2.5)
>     Support and utility classes used by the Rails framework.
> 
> rails (1.1.6, 1.0.0)
>     Web-application framework with template engine, 
> control-flow layer,
>     and ORM.
> 
> rake (0.7.1)
>     Ruby based make-like utility.
> 
> sources (0.0.1)
>     This package provides download sources for remote gem 
> installation 
> 
> # ls /usr/lib/mysql
> libdbug.a         libmysqlclient.la         
> libmysqlclient_r.la         libmystrings.a
> libheap.a         libmysqlclient.so         
> libmysqlclient_r.so         libmysys.a
> libmyisam.a       libmysqlclient.so.15      
> libmysqlclient_r.so.15      libvio.a
> libmyisammrg.a    libmysqlclient.so.15.0.0  libmysqlclient_r.so.15.0.0
> libmysqlclient.a  libmysqlclient_r.a        libmysqld.a
> 
> daevid ~ # gem install mysql -- --with-mysql-dir=/usr/lib/mysql
> Attempting local installation of 'mysql'
> Local gem file not found: mysql*.gem
> Attempting remote installation of 'mysql'
> Updating Gem source index for: http://gems.rubyforge.org
> Select which gem to install for your platform (i686-linux)
>  1. mysql 2.7.3 (mswin32)
>  2. mysql 2.7.1 (mswin32)
>  3. mysql 2.7 (ruby)
>  4. mysql 2.6 (ruby)
>  5. mysql 2.5.1 (ruby)
>  6. Cancel installation
> > 3
> Building native extensions.  This could take a while...
> make: /bin/install: Command not found
> make: *** 
> [/usr/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.so] Error 127
> ruby extconf.rb install mysql -- --with-mysql-dir=/usr/lib/mysql
> checking for mysql_query() in -lmysqlclient... yes
> checking for mysql_ssl_set()... yes
> checking for mysql.h... no
> checking for mysql/mysql.h... yes
> creating Makefile
> 
> make
> i686-pc-linux-gnu-gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux 
> -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_MYSQL_H -I/usr/lib/mysql/include
> -fPIC -O2 -march=i686 -pipe -mfpmath=sse -mmmx -msse  -fPIC  
> -c mysql.c
> i686-pc-linux-gnu-gcc -shared  -L'/usr/lib/mysql/lib' 
> -Wl,-R'/usr/lib/mysql/lib' -L'/usr/lib' -Wl,-R'/usr/lib' -o 
> mysql.so mysql.o
> -Wl,-R -Wl,/usr/lib -L/usr/lib -L. -lruby18 -lmysqlclient  
> -ldl -lcrypt -lm   -lc
> 
> make install
> mkdir -p /usr/lib/ruby/gems/1.8/gems/mysql-2.7/lib
> /bin/install -c -m 0755 mysql.so 
> /usr/lib/ruby/gems/1.8/gems/mysql-2.7/lib
> Successfully installed mysql-2.7
> 
> 
> > -----Original Message-----
> > From: ruby-bounces at zenspider.com 
> > [mailto:ruby-bounces at zenspider.com] On Behalf Of Corey Jewett
> > Sent: Friday, May 11, 2007 9:53 PM
> > To: Seattle Ruby Brigade!
> > Subject: Re: [Ruby] Active Record looses connection to mySQL
> > 
> > sudo gem install mysql -- --with-mysql- 
> > dir=<path_to_dir_containing_libmysqlclient*>
> > 
> > Something like that.
> > 
> > If you just want to know if it's there then just do a gem list.
> > 
> > Corey
> > 
> > 
> > On May 11, 2007, at 9:40 PM, Daevid Vincent wrote:
> > 
> > >> -----Original Message-----
> > >> From: ruby-bounces at zenspider.com
> > >> [mailto:ruby-bounces at zenspider.com] On Behalf Of Ryan Davis
> > >> Sent: Friday, May 11, 2007 8:23 PM
> > >> To: Seattle Ruby Brigade!
> > >> Subject: Re: [Ruby] Active Record looses connection to mySQL
> > >>
> > >>
> > >> On May 11, 2007, at 18:18 , Daevid Vincent wrote:
> > >>
> > >>> It seems that after some amount of time
> > >>> (not really sure the duration, more than an hour, less 
> > than a day),
> > >>> my service just shits the bed because it looses 
> > connection to mySQL.
> > >>> mySQL mind you is perfectly happy and hasn't done 
> anything wrong,
> > >>> and all my PHP pages work fantastic.
> > >>>
> > >>> If I restart my ruby application, it runs perfect... until
> > >>> AR times out again.
> > >>>
> > >>> It's extremely frustrating.
> > >>> Anyone know anything about this?
> > >>> Is it even a known issue that is to be addressed?
> > >>> Is there a work-around/patch?
> > >>
> > >> I'd put a dollar down that you're _using_ the mysql driver
> > >> that comes with rails, not the binary one.
> > >
> > > ...a glimmer of hope!
> > >
> > > How can I tell?
> > > (honestly, Evan wrote all this back-end ruby code, so I 
> don't know  
> > > a whole lot about details, but I'm happy to look up anything or
> > > search for keywords or whatever you need)
> > >
> > > I simply did an "emerge -av ruby rails" (long ago, and keep them  
> > > updated) (this is Gentoo).
> > >
> > > In fact, I think I did it while you were around, helping me to  
> > > learn rails way back at that old coffee shop we used to go to.
> > > Remember when you walked me through a basic scaffold demo?
> > >
> > > But I digress...
> > >
> > > How do I rectify this?
> > >
> > > Thanks Ryan.
> > >
> > > d
> > >
> > > _______________________________________________
> > > Ruby at zenspider.com - Seattle.rb non-commercial list
> > > http://www.zenspider.com/seattle.rb
> > > http://www.zenspider.com/mailman/listinfo/ruby
> > 
> > _______________________________________________
> > Ruby at zenspider.com - Seattle.rb non-commercial list
> > http://www.zenspider.com/seattle.rb
> > http://www.zenspider.com/mailman/listinfo/ruby
> > 
> 
> _______________________________________________
> Ruby at zenspider.com - Seattle.rb non-commercial list
> http://www.zenspider.com/seattle.rb
> http://www.zenspider.com/mailman/listinfo/ruby
> 

_______________________________________________
Ruby at zenspider.com - Seattle.rb non-commercial list
http://www.zenspider.com/seattle.rb
http://www.zenspider.com/mailman/listinfo/ruby



More information about the Ruby mailing list