I’m new to this mailing list, so do not hesitate to tell me if
everything’s ok with my post.
I’m using DBI to connect to a MySQL database. I tried to reduce my
code as much as possible, knowing that:
- constants are valid (not ‘****’) and lead to valid databases, valid
tables and the select returns a valid result
- removing the finish() does not solve the problem
- limiting the result size (eg: ‘LIMIT 0, 30’) does not solve the
- NB_THREADS is set to 50 to make it crash quickly (but, starting
from 2, any value makes it crash)
- as you can see below, I’m using Ruby 1.8.7 on Ubuntu 9.10 64 bits
- the file and line number in which the segmentation fault is
reported is variable (sometimes, it happens my own files)
The error output is as follow:
/usr/lib/ruby/1.8/dbd/mysql/statement.rb:36: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]
Question: is it a real bug or am I doing something wrong ?
If I’m wrong, where ?
If I’m not, is there a workaround to thread the execution of code
using DBI without a segfault ?
Thanks for any hint about my problem
#! /usr/bin/env ruby
PRODUCTS_DB = ‘*****’
PRODUCTS_DB_HOST = ‘’
PRODUCTS_DB_USER = '’
PRODUCTS_DB_PASS = ‘****’
NB_THREADS = 50
threads = Array.new(NB_THREADS)
NB_THREADS.times() do |i|
threads[i] = Thread.new() do
dbh = getDbh()
while true hdl = dbh.execute('SELECT * FROM ****** LIMIT 0, 30') do |dummy| dummy end hdl.finish() puts 'There' end