https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Using-TinyTds
Also, it is incorrect to say that timeouts are something that would/should not happen in production. The code is there in the adapter for it and every low level connection supports the notion. It is very valid to expect hoptoads or exception notifications if your queries are taking longer than your specified timeouts. Lemme know what you find out.
- Ken
Also check your application event log on the db server for any errors
that might have been logged by sqlserver.
If you don't see you query running in the activity monitor, but it looks
like it is still running in your rails code then it is a good bet the
problem is network related (try and ping your db server from the rails
side while the query is running) or else there is a problem somewhere in
the stack on the rails side.
--
Scott Jacobsen
303-800-2711
- Ken
to do more work and test that its connection can recover from very poor network conditions.
> --
> You received this message because you are subscribed to the Google Groups "Rails SQLServer Adapter" group.
> To post to this group, send email to rails-sqlse...@googlegroups.com.
> To unsubscribe from this group, send email to rails-sqlserver-a...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rails-sqlserver-adapter?hl=en.
>
- Ken
- Ken
- Ken
On Feb 25, 2011, at 5:07 AM, Frediano Ziglio wrote:
> 2011/2/24 Doug <duck...@yahoo.com>:
>> Hi,
>>
>> Have been using freetds 0.64 on 64-bit red hat linux for a long time to connect to MS SQL Server 2000 and MS SQL Server 2005 and it worked fine.
>>
>> Recently tried to use it on MS SQL 2008 and SQL 2008 R2 server running Window Server 2008 R2 Enterprise (64 bit). The SQL servers do not have encryption turned on. In both cases, it was able to connect and could do simple short queries. However when tried to run a long running query (a simple update), the query would start and after a while, it would return an error stating "read from server failed" and the connection is dropped. Tried that with freetds version 0.82 and compiled with TDS version 8.0 and ran into the same issue.
>>
>> Any help is greatly appreciated! Thanks.
>> Doug
>
> It's a known problem related to a mis-detected timeout reported as a
> read error. Use post 0.82 patches (http://freetds.sourceforge.net/) or
> patched version.
>
> bye
> freddy77
> _______________________________________________
> FreeTDS mailing list
> Fre...@lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
- Ken
Remember too, if you update FreeTDS, TinyTDS should be reinstalled too so that it builds against the latest FreeTDS.
- Ken
Have you verified that it is nothing with the data coming from the query. For instance, try doing something like this SQL to make it wait and test the connection lives for a certain duration long. Below is 2 seconds, change to what you need.
WaitFor Delay '00:00:02'
--
My recommendation was to test a long query in a controlled manner. So let's say your problematic query always yields and exception at 30 seconds, even tho you have a timeout of 60 seconds. My first question when debugging this is to isolate the issue. The logical first step would be to test a long running query equal or greater to what was happening before. So in rails console.
ActiveRecord::Base.connection.execute "WaitFor Delay '00:00:40'"
That would take 40 seconds to run. Does it work? Do you get the same error at 30 seconds? Etc etc? See what I am saying? This would first isolate the problem. From here, all sorts of possible debugging options are on the table.
- Ken
--
I guess you could do something in the tsql shell and find out too. For instance.
$ tsql -S <yourtdservername> - U <youruser> -P <yourpass>
Then when connected, give it that wait SQL then GO and see what happens. That would show if it is FreeTDS or TinyTDS. If it is FreeTDS, I would search their mail archives and/or open a bug reports. Lemme know.
- Ken
- Ken
But if what you are saying is true, then this looks to be an issue with TinyTDS, what I am not sure. Can you make totally sure that ever time you run this in tsql it does work and that consistently it fails in TinyTDS? And tell me again what version DB, ruby, etc you have?
- Ken
Can you set timeout: 0 in your database.yml? I'm not sure where to go from here. I can make my TinyTDS in AR to 2000 wait for a LONG time and have no issues. So not sure where to look. Maybe connect to another DB instance and test. I am not sure, open to suggestions.
- Ken
It sounds to me that you are getting a server-side timeout,
rather than a TDS one. Perhaps SQL Server has an unusually
low timeout set? My experience using ADO leads me to believe
that a connection can request a longer server-side timeout (in
addition to enforcing its own client-side one), but I don't know
how this is done. The default will be settable in the SQL Server
admin interface however.
Have I missed something, and you are actually aware of both
possible timeout sources?
Clifford Heath.
- Ken
No. We are talking about a server config for different client connections. DBLIB is different than ODBC client connections. We were raising the point that in some odd case, the server could timeout DBLIB based clients from some server level setting on your end. Worth looking into since I can not reproduce here.
- Ken
- Ken
On Apr 3, 2011, at 2:33 PM, Ken Collins wrote:
>
> Can anyone affected by timeout issues with TinyTDS test the latest versions of both TinyTDS and the adapter and let me know if that helped?
>
> - Ken
>
On Apr 3, 2011, at 2:33 PM, Ken Collins wrote:
>
> Can anyone affected by timeout issues with TinyTDS test the latest versions of both TinyTDS and the adapter and let me know if that helped?
>
> - Ken
>
https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/master/lib/active_record/connection_adapters/sqlserver_adapter.rb#L27
https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/2-3-stable/lib/active_record/connection_adapters/sqlserver_adapter.rb#L18
Since the #active? method is key to helping with connection issues, I would make sure that your stack/bundle is loading things right before proceeding. Can you investigate further and let me know how that warning is firing on your end?
- Ken
Marlon,
The TinyTDS version warning was my fault. I forgot that 1.9 returns symbols when using #instance_methods.
About your timeout issues. This just has to be something in your particular setup? I can confirm on my end that lost connections are being handled correctly by the connection pool and that indeed TinyTDS works very well over long distance connections (like to Azure) from here too.
What is "spork"?
- Ken
- Ken
I know that TinyTDS as of yet has no thread safety code. I do not know if spork hooks into that short-coming or not.
The trace is very helpful tho and this is exactly the info to help debug that I need. I doubt that one commit transaction should have taken more than a few milliseconds. The question is why it did. Looking at the error, one of 2 things happened. It did take more than 10 seconds (perhaps due to a deadlock in another process) and your normal timeout kicked in and gave you that error. Or it took 10 seconds to timeout on a lost connection.
- Ken
I think I'm going to consider this a configuration/MS issue since I am unable to get it to happen with a sql trace running. Stop the trace and it reappears intermittently. Downloading latest SP's for SqlServer 2008 and I'll run more tests later.
> To unsubscribe from this group, send email to rails-sqlserver-adapter+unsub...@googlegroups.com.