I have been having a strange issue with the mysql-ruby package and
can’t seem to find any posts anywhere on the net that have been
helpful. The package makes and installs perfectly, and in-fact it even
connects to the MySQL database and can perform queries. However, any
attempt to close() the connection to the MySQL database produces a
segmentation fault. This has wreaked havoc on my application and I’ve
wasted close to 3 days trying to figure out where this segmentation
fault is coming from.
Here are the specifics of my installation:
- Fedora Core 4
- MySQL 5.0.19 (with mysql-devel installed)
- Ruby 1.8
- Rails 1.1.0
- Apache 2.2 /w mod_fcgid (although this is irrelevant as the problem
happens via the web and when running ruby scripts on the command line)
My first attempt to install mysql-ruby was to simply use “gem install
mysql”. This appeared to work, until any of my scripts tried to close()
the database connection.
My second try was to download the mysql-ruby-2.7 package and build it
myself. I ran extconf.rb with the appropriate options without
incident, got myself a make file, and made it - again without incident.
However, when I ran the test.rb, I hit my favourite segmentation fault:
Loaded suite ./test
…/test.rb:34: [BUG] Segmentation fault
ruby 1.8.4 (2005-12-24) [i686-linux]
Looking at the code of test.rb I can see that on line 34, the script
tries to close() the connection… same problem.
Since then, I’ve tried to use previous versions of mysql-ruby with
similar results and I’ve reached the point where I don’t know what else
to try. If anyone has experienced anything similar, or has an idea
about what may be causing this, please enlighten me.