0

I have an application that essentially does this:

queue = SizedQueue.new(2)
Thread.new do
  conn = OCI8.new(DSN)
  cursor = conn.exec([a query])
  cursor.fetch { |rec| queue << rec }
  queue << :queue_ended
  cursor.close
  conn.logoff
end.tap { |t| t.abort_on_exception = true }

until a = queue.pop == :queue_ended
   do_things(a)
end

The issue comes when do_things raises an error. The thread seems not to abort. The reason I believe it's the oci8 is because we had this code running with a different set of functions/libraries and everything was fine. The other reason i think it is OCI8 because the connection remains open, surely if the thread had aborted the connection would close?

I occasionally have an issue raising a KeyBoardInterrupt in irb with long to generate queries as well.

Apologies if this isn't much to go on, I don't have much to go on - I can't recreate the issue without using thread and as we all know it's fairly difficult to debug.

N.B I am running with ruby OCI8 (most recent version (2.1.5) on rb 1.9.3).

Thanks for your help in advance

mehdi lotfi
  • 11,194
  • 18
  • 82
  • 128
damau
  • 334
  • 4
  • 9

1 Answers1

0

Turn out this isn't an issue, or at least doesn't occur in Ruby 2.0.0; I don't know why though.

Ben
  • 51,770
  • 36
  • 127
  • 149
damau
  • 334
  • 4
  • 9