X
Xavier Noëlle
Hello,
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 problem
- 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
require 'rubygems'
require 'dbi'
PRODUCTS_DB = '*****'
PRODUCTS_DB_HOST = '*****'
PRODUCTS_DB_USER = '*****'
PRODUCTS_DB_PASS = '****'
def getDbh()
return DBI.connect("DBI:Mysql:#{PRODUCTS_DB}:"+
"#{PRODUCTS_DB_HOST}", PRODUCTS_DB_USER,
PRODUCTS_DB_PASS)
end
NB_THREADS = 50
threads = Array.new(NB_THREADS)
NB_THREADS.times() do |i|
puts i
threads = Thread.new() do
dbh = getDbh()
while true
hdl = dbh.execute('SELECT * FROM ****** LIMIT 0, 30') do |dummy|
dummy[0]
end
hdl.finish()
puts 'There'
end
end
end
threads.each() do |t|
t.join()
end
=================
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 problem
- 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
require 'rubygems'
require 'dbi'
PRODUCTS_DB = '*****'
PRODUCTS_DB_HOST = '*****'
PRODUCTS_DB_USER = '*****'
PRODUCTS_DB_PASS = '****'
def getDbh()
return DBI.connect("DBI:Mysql:#{PRODUCTS_DB}:"+
"#{PRODUCTS_DB_HOST}", PRODUCTS_DB_USER,
PRODUCTS_DB_PASS)
end
NB_THREADS = 50
threads = Array.new(NB_THREADS)
NB_THREADS.times() do |i|
puts i
threads = Thread.new() do
dbh = getDbh()
while true
hdl = dbh.execute('SELECT * FROM ****** LIMIT 0, 30') do |dummy|
dummy[0]
end
hdl.finish()
puts 'There'
end
end
end
threads.each() do |t|
t.join()
end
=================