ODBC::Error: INTERN (0) [RubyODBC]Cannot allocate SQLHENV

Bug #447523 reported by Alex
36
This bug affects 5 people
Affects Status Importance Assigned to Milestone
libodbc-ruby (Ubuntu)
Confirmed
Undecided
Deepak Tripathi
Nominated for Karmic by Alex
Nominated for Lucid by agent 8131

Bug Description

After updating to 0.997 every call to ODBC results in the error message:
ODBC::Error: INTERN (0) [RubyODBC]Cannot allocate SQLHENV

Steps to reproduce:
$ irb
irb(main):001:0> require 'odbc'
=> true
irb(main):002:0> ODBC.drivers
ODBC::Error: INTERN (0) [RubyODBC]Cannot allocate SQLHENV
 from (irb):2:in `drivers'
 from (irb):2

With version 0.995 from intrepid it works.

ProblemType: Bug
Architecture: i386
Date: Fri Oct 9 21:51:15 2009
DistroRelease: Ubuntu 9.10
Package: libodbc-ruby1.8 0.9997-2
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, no user)
 LANG=de_DE.UTF-8
ProcVersionSignature: Ubuntu 2.6.31-12.41-generic
SourcePackage: libodbc-ruby
Uname: Linux 2.6.31-12-generic i686
XsessionErrors:
 (gnome-settings-daemon:1478): GLib-CRITICAL **: g_propagate_error: assertion `src != NULL' failed
 (gnome-settings-daemon:1478): GLib-CRITICAL **: g_propagate_error: assertion `src != NULL' failed
 (nautilus:1535): Eel-CRITICAL **: eel_preferences_get_boolean: assertion `preferences_is_initialized ()' failed
 (polkit-gnome-authentication-agent-1:1586): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed

Revision history for this message
Alex (akruth) wrote :
Revision history for this message
Carsten Gehling (carsten-sarum) wrote :

Confirmed

I have tried this with both an upgrade from 9.04 to 9.10 and with a clean install of 9.10.

Alex (akruth)
Changed in libodbc-ruby (Ubuntu):
status: New → Confirmed
Revision history for this message
Carsten Gehling (carsten-sarum) wrote :

Just as Alex, I have "solved" the issue by removing 0.9997-2 and installing instead 0.9995-1.

As an interesting note: I installed Debian 5.0 a few weeks ago. I got the same failure there. However Debian 5.0 intalls 0.9995 which resulted in the failure. There I solved the issue by installing 0.9997 instead :-)

- Carsten

Revision history for this message
Adam Durity (adam-durity) wrote :

I have also confirmed this issue on Ubuntu Server 9.10. I also "solved" the issue by rolling back to 0.9995-1.

Revision history for this message
goran (goran-pizent) wrote :

On Ubuntu 9.10 (x64) I could not "solve" this with rolling back on 0.9995. I really want to upgrade servers on Ubuntu 9.10.

Revision history for this message
Carsten Gehling (carsten-sarum) wrote :

@goran: What exactly do you mean? Did you try to install 0.9995-1 and it just didn't work on the x64 platform, or is it, that you do not wish to install 0.9995-1?

Revision history for this message
goran (goran-pizent) wrote :

@carsten:

I installed Ubuntu Karmic Server (9.10) x64 version and updated the server (apt-get update && apt-get upgrade)
Then on the fresh copy I executed following:

sudo apt-get --yes install build-essential ruby libdbd-odbc-ruby rubygems ruby1.8-dev
sudo apt-get --yes install unixodbc unixodbc-dev tdsodbc irb

/etc/odbc.ini
[production]
Driver = FreeTDS
Description = ODBC via FreeTDS
Trace = no
Servername = sql2005
Database = mydatabase

/etc/odbcinst.ini
[FreeTDS]
Description = v0.62 with protocol v4.2
Driver = /usr/lib/odbc/libtdsodbc.so
FileUsage = 1

/etc/freetds/freeted.ini
[sql2005]
        host = my.sql.host
        port = 1433
        tds version = 8.0
        client charset = UTF-8

When I use "isql production username password" everything is OK.
But when I use irb like described in previous post command ODBC.drivers returns SQLHENV error.

So far so good.

Then I removed libdbd-odbc-ruby and downloaded version 0.9995 and essentially done following:

wget http://www.ch-werner.de/rubyodbc/ruby-odbc-0.9995.tar.gz
tar xzvf ruby-odbc-0.9995.tar.gz
cd ruby-odbc-0.9995
ruby extconf.rb --enable-dlopen
make
sudo make install

(I have done that even with latest version 0.9999 and 0.9997 as someone suggested)
But I always get the same error "Cannot allocate SQLHENV".
Even when I run it's own test: ruby test.rb DSN [uid] [pwd]

Maybe if you help me to how to install this 0.9995-1 and where can I get it?
I have nothing against 0.9995 but it just didn't work on my server with steps that I have described to you.

Thnx,
goran

Revision history for this message
goran (goran-pizent) wrote :

@carsten:

Well to follow my last post:

I downloaded 0.9995-1 from http://mirrors.kernel.org/ubuntu/pool/universe/libo/libodbc-ruby/libodbc-ruby1.8_0.9995-1_amd64.deb

Install it on my server and it "magically" works.

:o)

Thanks,
goran

Revision history for this message
Carsten Gehling (carsten-sarum) wrote :

Great! I was just about to point you to my recent blogpost on the subject:

http://gehling.dk/2010/02/the-woes-of-libruby-odbc-and-debian-ubuntu/

although I only deal with the 32-bit versions. But you've found the appropiate .deb package yourself - nice job. I will update my post with your link.

- Carsten

Revision history for this message
agent 8131 (agent-8131) wrote :

I ran into this problem today. It's definitely a regression but I'm not sure if the culprit is Ubuntu, the upstream library, or another library. I too was able to fix the problem by installing 0.9995-1. However, in investigating the issue I also tried installing the latest ruby-odbc gem through rubygems. With versions 0.9999 and 0.9998 I got the same problem. I even tried compiling with both the unixodbc-dev and the libiodbc2-dev packages providing the necessary files for compilation. The only thing that worked was 0.9995-1 from the archives. I'm not sure if it has ever been done but the best way to fix this regression might be to use the older version.

Revision history for this message
goran (goran-pizent) wrote :

@agent8131

Another thing to think about is following:

If you install Ruby Enterprise (http://www.rubyenterpriseedition.com/) and then install ruby-odbc though gem (sudo gem install ruby-odbc) then everyhing works just fine. No regression... and ruby-odbc is on the latest version 0.9999 or so...
At the end I am using Ruby Enterprise because it's faster and I think it has smaller footprint.
Best thing to do for production servers.

Regards,
Goran

Revision history for this message
Deepak Tripathi (gnumonk) wrote :

Team ,

It's being fixed in version 0.99991-1, and i have package it for Debian , will get synced to ubuntu soon . updated new version is 0.99991-1 ( Debian).

Thanks
Deepak

Changed in libodbc-ruby (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Carsten Gehling (carsten-sarum) wrote :

@Deepak: If you have a link for the fixed package, I will happily test it on my systems (Debian & Ubuntu)

Thanks
Carsten

Revision history for this message
Russ Tndall (bobbysmith007) wrote :

@Carsten: http://packages.debian.org/squeeze/libodbc-ruby1.8

@Deepak: Thanks for the fix; it worked great.

Revision history for this message
Deepak Tripathi (gnumonk) wrote :

@Russ, Thanks

Changed in libodbc-ruby (Ubuntu):
assignee: nobody → Deepak Tripathi (apenguinlinux)
Revision history for this message
Carsten Gehling (carsten-sarum) wrote :

@deepak: When I download the new libodbc-ruby1.8 and try to install it on Debian 5 with

sudo dpkg -i libodbc-ruby1.8_0.99991-1_i386.deb

I get a dependency error:

(Reading database ... 42650 files and directories currently installed.)
Preparing to replace libodbc-ruby1.8 0.99991-1 (using libodbc-ruby1.8_0.99991-1_i386.deb) ...
Unpacking replacement libodbc-ruby1.8 ...
dpkg: dependency problems prevent configuration of libodbc-ruby1.8:
 libodbc-ruby1.8 depends on libruby1.8 (>= 1.8.7.249); however:
  Version of libruby1.8 on system is 1.8.7.72-3lenny1.
dpkg: error processing libodbc-ruby1.8 (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 libodbc-ruby1.8

is it safe to add "squeeze" as a apt-source and upgrade/pin libruby1.8 from there on an otherwise stable Debian 5/lenny?

/Carsten

Revision history for this message
Carsten Gehling (carsten-sarum) wrote :

Extra note to the above:

On Ubuntu 10.04 it installs fine without any dependency problems. :-)

/Carsten

Revision history for this message
agent 8131 (agent-8131) wrote :

I've verified that this problem exists in Ubuntu 10.10. Here is my replication, installing the ubuntu version, followed by the debian squeeze version:

$ sudo apt-get install libodbc-ruby1.8=0.99991-2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  libodbc-ruby1.8-doc libdbi-ruby1.8
The following packages will be upgraded:
  libodbc-ruby1.8
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/112kB of archives.
After this operation, 8,192B disk space will be freed.
(Reading database ... 327275 files and directories currently installed.)
Preparing to replace libodbc-ruby1.8 0.99991-2 (using .../libodbc-ruby1.8_0.99991-2_amd64.deb) ...
Unpacking replacement libodbc-ruby1.8 ...
Setting up libodbc-ruby1.8 (0.99991-2) ...

$ irb
irb(main):001:0> require 'odbc'
=> true
irb(main):002:0> ODBC.drivers
ODBC::Error: INTERN (0) [RubyODBC]Cannot allocate SQLHENV
 from (irb):2:in `drivers'
 from (irb):2
 from /usr/lib/ruby/1.8/date.rb:1668

$ sudo dpkg -i libodbc-ruby1.8_0.99991-2_amd64.deb
(Reading database ... 327275 files and directories currently installed.)
Preparing to replace libodbc-ruby1.8 0.99991-2 (using libodbc-ruby1.8_0.99991-2_amd64.deb) ...
Unpacking replacement libodbc-ruby1.8 ...
Setting up libodbc-ruby1.8 (0.99991-2) ...

$ irb
irb(main):001:0> require 'odbc'
=> true
irb(main):002:0> ODBC.drivers
=> []

Changed in libodbc-ruby (Ubuntu):
status: Fix Committed → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.