Hello
The same is the case for MySQL unfortunately. Only SQLite and Postgres has this implemented as there is no native way to do this in MySQL or in Oracle (AFAIK).
For MySQL we have thought along the same lines, as noted here, https://bitbucket.org/tildeslash/libzdb/src/6f5d7c05ccf627cddf466ecea548fa85...
We have hold off implementing a threaded solution, because we would much prefer a native solution like the one for SQLite or Postgres. But of course, one solution might be better than no solution.
The suggested solution, using a timeout-thread per connection (not per statement) is probably the best way until the database server provides this natively. JDBC MySQL uses this approach and I suspect others do this as well. Without having looked into the problem in detail, my initial goal would be that only one single thread should handle _every_ statement made through the connection, also prepared statements. I’m not sure, but I also think the thread should be terminated when a connection is returned to the pool and started when connection is obtained from the pool. If you want the give this a stab you are welcome to it.
BTW, is DBMail still being developed? I haven’t heard from Paul in a long time.
On 31 Aug 2015, at 15:36, Pavlo Lavrenenko santa@portaone.com wrote:
Hello.
I've noticed query timeout for Oracle connections is a stub, seems like OCI API does not provide a way to limit query execution out-of-box. Yet I am trying to workaround the blocked (server-side) connections issue with DBMail and setQueryTimeout() seems to be a good tool for that.
So far I came up with a thread-based solution:
- a dedicated thread is created for every db connection;
- thread acts like a watchdog: for every started query it counts down from TIMEOUT value to zero;
- if query execution is finished the counter is reset and thread idles;
- if counter reaches 0 the thread calls OCIBreak().
I'd like to know your vision on the solution and reasons why query timeouts are not implemented for Oracle backend before I start the development and publish the patch. TIA.
-- Best regards, Pavlo Lavrenenko, PortaOne, Inc., Software Developer Tel: +1-866-SIP VOIP (+1 866 747 8647) ext. 7624
PortaOne - VoIP Solutions Company Visit our Website: http://www.portaone.com -- To unsubscribe: http://www.tildeslash.com/mailman/listinfo/libzdb-general