Skip to content

Instantly share code, notes, and snippets.

@mike-bourgeous
Created August 28, 2014 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mike-bourgeous/07d65f63d6b448de9a38 to your computer and use it in GitHub Desktop.
Save mike-bourgeous/07d65f63d6b448de9a38 to your computer and use it in GitHub Desktop.
Exception in thread 1: comparison of Fixnum with nil failed
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/cursor.rb:510:in `>'
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/cursor.rb:510:in `upto'
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/cursor.rb:510:in `define_columns'
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/cursor.rb:127:in `exec'
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-plsql-0.5.0/lib/plsql/oci_connection.rb:97:in `exec'
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-plsql-0.5.0/lib/plsql/oci_connection.rb:82:in `new_from_query'
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-plsql-0.5.0/lib/plsql/oci_connection.rb:132:in `cursor_from_query'
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-plsql-0.5.0/lib/plsql/connection.rb:102:in `select_first'
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-plsql-0.5.0/lib/plsql/sql_statements.rb:5:in `select_first'
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-plsql-0.5.0/lib/plsql/schema.rb:93:in `schema_name'
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-plsql-0.5.0/lib/plsql/schema.rb:194:in `find_database_object'
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-plsql-0.5.0/lib/plsql/schema.rb:179:in `method_missing'
./oci8-issue62.rb:26:in `block (3 levels) in <main>'
./oci8-issue62.rb:25:in `times'
./oci8-issue62.rb:25:in `block (2 levels) in <main>'
/home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/bindtype.rb:35: [BUG] Segmentation fault at 0x00000000000000
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0019 p:---- s:0095 e:000094 CFUNC :get
c:0018 p:0030 s:0092 e:000091 METHOD /home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/bindtype.rb:35 [FINISH]
c:0017 p:---- s:0088 e:000087 CFUNC :get_data
c:0016 p:0010 s:0085 e:000084 BLOCK /home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/cursor.rb:540 [FINISH]
c:0015 p:---- s:0082 e:000081 CFUNC :collect
c:0014 p:0019 s:0079 e:000078 METHOD /home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/cursor.rb:539
c:0013 p:0044 s:0076 e:000075 METHOD /home/username/.rvm/gems/ruby-2.1.2@gemset/gems/ruby-oci8-2.1.7/lib/oci8/cursor.rb:154
.
.
.
#!/usr/bin/env ruby
# From https://gist.github.com/kubo/cc06fd133577fe2086ba
# Modified to add threads and progress indicators
require 'ruby-plsql'
$putslock = Mutex.new
def sputs(*args)
$putslock.synchronize do
STDOUT.puts *args
end
end
main_thread = Thread.current
threads = []
10.times do |t|
threads << Thread.new do
begin
sputs "Starting thread #{t}"
plsql.connection = OCI8.new('apps', 'apps', 'TEST')
sputs "Connected #{t}"
100.times do |i|
result = plsql.package_name.apply(12345678, 'abcdefgh', 'ijklmnop', 0)
sputs "#{result} - #{t} - #{i}"
end
sputs "Ended thread #{t}"
rescue Exception => e
sputs "Exception in thread #{t}: #{e}\n\t#{e.backtrace.join("\n\t")}"
end
end
end
threads.each do |t|
t.join
end
-- Unmodified from https://gist.github.com/kubo/cc06fd133577fe2086ba
CREATE OR REPLACE PACKAGE package_name IS
PROCEDURE apply (p_id IN NUMBER,
p_val1 IN VARCHAR2,
p_val2 IN VARCHAR2,
p_amount IN NUMBER,
errbuf OUT NOCOPY VARCHAR2,
retcode OUT NOCOPY VARCHAR2);
END;
/
CREATE OR REPLACE PACKAGE BODY package_name IS
PROCEDURE apply (p_id IN NUMBER,
p_val1 IN VARCHAR2,
p_val2 IN VARCHAR2,
p_amount IN NUMBER,
errbuf OUT NOCOPY VARCHAR2,
retcode OUT NOCOPY VARCHAR2) IS
BEGIN
errbuf := NULL;
retcode := NULL;
END;
END;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment