On Friday, December 4, 2015 at 7:23:41 AM UTC-8, Tom Van Schoor wrote:
>
> Hi guys,
>
> We recently moved away from ODBC because we were having issues with 
> unicode support and it turned out that TinyTds worked out of the box.
>
> *@db ||= Sequel.connect(adapter: 'tinytds', host: ENV['DATABASE_HOST'], 
> database: 'SomeDB', user: ENV['SOME_USER'], password: ENV['SOME_PWD'])*
>
> Worked for over a month without any issues yet today it started acting up:
> *General failure exception=#<Sequel::DatabaseError: TinyTds::Error: 
> Adaptive Server connection timed out>*
>
> Our DB admin assures me nothing changed on DB level and our source code 
> has not changed either.
> I can connect to the DB fine using ODBC, telnet and SQL Server Management 
> Studio.
>
> Frankly I am out of ideas on how to debug this so any advise would be 
> welcome.
>

It sounds like the connection dropped, which is usually network related. 
 Restarting the program should be enough to fix that.  There is a bug here, 
in that the exception is not recognized as a disconnect and it doesn't 
remove it from the connection pool.  Can you try this diff and see if it 
helps?

Thanks,
Jeremy

diff --git a/lib/sequel/adapters/tinytds.rb b/lib/sequel/adapters/tinytds.rb
index 6b7251a..71f3f34 100644
--- a/lib/sequel/adapters/tinytds.rb
+++ b/lib/sequel/adapters/tinytds.rb
@@ -129,7 +129,7 @@ module Sequel
         end
       end

-      TINYTDS_DISCONNECT_ERRORS = /\A(Attempt to initiate a new Adaptive 
Server operation with results pending|The request failed to run because the 
batch is aborted, this can be caused by abort signal sent from client)/
+      TINYTDS_DISCONNECT_ERRORS = /\A(Attempt to initiate a new Adaptive 
Server operation with results pending|The request failed to run because the 
batch is aborted, this can be caused by abort signal sent from 
client|Adaptive Server connection timed out)/
       # Return true if the :conn argument is present and not active.
       def disconnect_error?(e, opts)
         super || (opts[:conn] && !opts[:conn].active?) || 
((e.is_a?(::TinyTds::Error) && TINYTDS_DISCONNECT_ERRORS.match(e.message)))

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to