From: Daniel Berger Date: 2003-04-09T04:42:21+09:00 Subject: Re: Problem with timeout for DBI on Solaris Brian Candler wrote: > > > For Oracle, you can try using the ruby-oci8 library from RAA which supports > non-blocking queries (although I don't know if it supports non-blocking > connect). It comes with its own DBD which you have to install manually into > /usr/local/lib/ruby/site_ruby/1.6/DBD/OCI8/OCI8.rb > > Then modify it as follows: > > require 'dbi' > require 'DBD/OCI8/OCI8' > > module DBI > module DBD > module OCI8 > class Driver > def connect( dbname, user, auth, attr ) > handle = ::OCI8.new(user, auth, dbname, attr['Privilege']) > handle.non_blocking = true if attr['NonBlocking'] #<<<< add this line > return Database.new(handle, attr) > rescue OCIError => err > raise DBI::DatabaseError.new(err.message, err.code) > end > end > end > end > end I installed the oci8 package and made the changes you suggested, but no luck. In fact, it appears to hang in the ::OCI.new call. A simple "puts" statement after that call shows me that it is never invoked on my system. Stepping through the debugger, I can see that it's hanging on the do_ocicall() method in the oci8.rb file. It steps in the first time, yields back out, tries to step back in, and that's where it hangs. snippet of debugger session: /usr/local/lib/ruby/site_ruby/1.6/dbi/dbi.rb:550: db = @handle.connect(db_args, user, auth, new_params) (rdb:1) s /usr/local/lib/ruby/site_ruby/1.6/DBD/OCI8/OCI8.rb:25: handle = ::OCI8.new(user, auth, dbname, attr['Privilege']) (rdb:1) s /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:64: if @@env.nil? (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:65: if OCIEnv.respond_to?("create") (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:66: @@env = OCIEnv.create() (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:73: case privilege (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:74: when nil (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:75: privilege = OCI_DEFAULT (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:84: @svc = @@env.alloc(OCISvcCtx) (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:85: @srv = @@env.alloc(OCIServer) (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:86: @auth = @@env.alloc(OCISession) (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:87: @ctx = [0, Mutex.new, nil] (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:89: @auth.attrSet(OCI_ATTR_USERNAME, uid) (rdb:1) @ctx [0, #, nil] (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:90: @auth.attrSet(OCI_ATTR_PASSWORD, pswd) (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:91: do_ocicall(@ctx) { @srv.attach(conn) } (rdb:1) @srv # (rdb:1) s /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:40: sleep_time = 0.01 (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:41: ctx[CTX_MUTEX].lock (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:42: ctx[CTX_THREAD] = Thread.current (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:58: end (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:44: yield (rdb:1) n /usr/local/lib/ruby/site_ruby/1.6/oci8.rb:91: do_ocicall(@ctx) { @srv.attach(conn) } (rdb:1) s That's where it hangs - trying to step into the do_ocicall() the second time. Any ideas? Some sort of Mutex issue perhaps? Regards, Dan -- a = [74, 117, 115, 116, 32, 65, 110, 111, 116, 104, 101, 114, 32, 82] a.push(117,98, 121, 32, 72, 97, 99, 107, 101, 114) puts a.pack("C*")