From: Peter Fitzgibbons Date: 2011-07-29T00:19:37+09:00 Subject: Fwd: AR + TinyTDS timeout fails to trigger on network failure --20cf3005ddcaf23c7804a922b079 Content-Type: text/plain; charset=ISO-8859-1 Hello Ruby and Rails developers. Cross-posted to : Ruby-Talk, Rails-Talk, Jruby-Users Could you all look into this Gist https://gist.github.com/1111340 and maybe point out what I could be doing wrong in my network-failure test ? The setup : Mac OSX SnowLeopard VirtualBox VM Guest of Windows 7 w/ SqlServer 2008R2 Express (default server instance) The scenario : osx (host) ruby script connects to guest sql instance and executes query successfully guest then receives power-failure (VM guest is "paused") osx (host) re-executes query on existing connection Expected : Timeout in 5 sec on query Got : TinyTDS DBPROCESS is dead or not enabled at 312 sec (varies on 300sec +/- 20sec ) This block is repeatable (yes, blocks anyway) with the offending code wrapped in Timeout.timeout and SystemTimer.timeout. It also blocks in JRuby using Timeout.timeout. The gist contains TinyTDS config with :timeout => 5000. I have also tried :timeout => 5 with above result. I would greatly appreciate any advice you could give me on what may be going wrong here. Thanks, Peter Fitzgibbons ---------- Forwarded message ---------- From: Ken Collins Date: Thu, Jul 28, 2011 at 6:40 AM Subject: Re: [RailsSQLServer] AR + TinyTDS timeout fails to trigger on network failure To: rails-sqlserver-adapter@googlegroups.com Funny, it looks like you are basically rewriting this test? https://github.com/rails-sqlserver/tiny_tds/blob/master/test/client_test.rb#L106 I tried running this the other day and could not get it to work. FreeTDS' DBLIB is a beast to get working right with lost connections and recover the DBPROCESS in such a way that it is still usable. One thing it does (that I hate) is that it tries doing some internal work to reconnect for you and the timeout setting appears to have a stepped curve. The end result is that you get double/triple the actual timeout if it works at all. I can not remember if I just gave up after a few days of banging my head on the desk and decided to let the adapter cope with outright dead connections by dropping the ivar and re-establishing via standard ActiveRecord conventions. Someone else putting their head into this would be appreciated, as I do not have the capacity any time soon. Patches patches! - Ken --20cf3005ddcaf23c7804a922b079--