Comments (13)
Not much to go on here.
- What is your current timeout setting?
- Have you identify what SQL is timing out? Would be seen in the logs before said error you posted?
- Do you feel that that the timeout is working incorrectly? IE, can you set it to say 0 and get the same problems?
- Is your DB local or remote, can a possible network issue cause the timeouts?
- etc, etc...
Many questions. Can you do a roundup and post back?
from tiny_tds.
We certainly may have performance issues, as this is a legacy DB that needs optimization. That will be done, but I am hoping there's a way to recover from this, i.e. disconnect and reconnect without having to restart the ruby process.
-
Previously 4000, now trying with 4. Same results. I'm still a little unsure if this is ms or s. Can you clarify?
-
SQL is nothing intensive. Looking at the logs I see occasionally TinyTds::Error: Unknown marker and TinyTds::Error (Read from SQL server failed.) before I see the other error, but then the latter happens continuously.
-
I have not tried this. If set to zero, what behavior would you expect? More, or less errors?
-
Remote, but I have seen same issue when running locally
Thanks for your help and quickly responding to the issue!
from tiny_tds.
In general, a timeout error for a sql batch is something TinyTDS can handle just nicely and ActiveRecord builds on top of that and works just fine too. Some things you have to look out for are timeout errors on getting something across or back on the connection. Those are real tricky, we had updates in TinyTDS 0.4.3 IIRC and with the latest adapters to cope with lost/dead/timeout "connections" by using TinyTds::Client#active? method. So you should tell me too what versions you are using and I may suggest an upgrade. Other points.
If you specify a timeout in database.yml, the adapter will convert it to seconds. AR convention is 5000 == 5 seconds. So setting it to 4 would be really low, 0 I think. Details here:
https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/master/lib/active_record/connection_adapters/sqlserver_adapter.rb#L374
https://github.com/rails-sqlserver/tiny_tds/blob/master/lib/tiny_tds/client.rb#L57
So basically, a 0 may just get passed on down to mean unlimited timeouts. Which is something you may want.
from tiny_tds.
I've been on TinyTDS 0.4.4. So sounds like I already would have those enhancements.
Any debug suggestions? I couldn't say whether it's your gem, freetds, the db server, network, or what.
Restarting the app server wakes things up, I'm wondering if there's another way to reset the connection.
from tiny_tds.
Having the same - first, for example, 5 request, are ok, then - i have same error 'TinyTds::Error: Attempt to initiate a new Adaptive Server operation with results pending: dbcc useroptions'
And another idea - in sqlserver profiler i see than batch request is completed. But tinytds - thinks, that server did not send anything :(
I am using
tinytds 0.4.5
MSSQL server 2008
from tiny_tds.
but if i use some long loop with the same query
100.times do Task.all.each do |task| puts task.description; task.evalues.each do |val| puts val.extparamvalue end end end
All is done like it sholud - no 'pending' message appears.
from tiny_tds.
And some interesting thing first i get argument out of range and then results pending.
But, a have set coerce_sqlserver_time :datetimevalue and cannot now understand what is a problem
timeouts a set to 15000
from tiny_tds.
ActiveRecord::Base.default_timezone = :local
resolves the problem for me
from tiny_tds.
This page on FreeTDS talks about the "Unknown Marker" errors. http://www.freetds.org/faq.html#unknownmarker
It just so happens that I updated the project's README covering the topic about the TDS version. See the section "FreeTDS Compatibility & Configuration".
from tiny_tds.
@kalabiyau Running your AR default timezone to :local is not a good solution, especially if your world wide web application shows times to users from the database and those times in the DB are UTC, which they should be. See the rails guides on this topic.
from tiny_tds.
This is an article on SQL Server about keep alive. It states the following:
http://blogs.msdn.com/b/sql_protocols/archive/2006/03/09/546852.aspx
It causes good connection to break during transient network failures.
So configuring the keep-alive values too small is not recommended
I can conclude the most network errors are related to low server keep alives under poor conditions.
from tiny_tds.
ActiveRecord::Base.default_timezone = :local
It doesn't work to me :-(
(ActiveRecord::StatementInvalid: TinyTds::Error: Attempt to initiate a new Adaptive Server operation with results pending)
from tiny_tds.
The "Adaptive Server operation with results pending" message usually indicates an improper usage of TinyTDS and not closing the result set by iterating over it.
from tiny_tds.
Related Issues (20)
- Install fails when FreeTDS installed via Homebrew HOT 5
- FreeTDS & TinyTDS HOT 9
- Guidance on how to use with password-less login with Azure Service Principal or Managed Identity HOT 1
- Ruby 3.2 warning: undefining the allocator of T_DATA class TinyTds::Result HOT 1
- results.each(:symbolize_keys => true) not working HOT 1
- Oracle Enterprise Linux installtion instruction HOT 1
- Unable to connect when upgrade to Rials 6 HOT 3
- Segmentation fault after closing connection and asking for `dead?` HOT 3
- tiny_tds don't compile on ruby 3.1.3 on W10 HOT 2
- Compatibility with OpenSSL v3 HOT 2
- When connection fails, a hanging anonymous inode is left open in the system
- Reading data error
- Prepare tiny_tds gem for Ruby v3.1 on Windows HOT 3
- How to build for use in AWS-LAMBDA HOT 1
- Unable to change debug flags in freetds.conf
- TinyTds::Error: Bad numbytes parameter passed to dbstrcpy HOT 2
- TinyTds::Error: Adaptive Server connection failed - but works via tsql directly HOT 4
- Crashes (SIGABRT) Under Test Automation HOT 6
- Compatibility Inquiry: tiny_tds 2.1.7 with Ruby 3.3.0 HOT 2
- tiny_tds v3 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tiny_tds.