简体   繁体   English

TinyTds错误:Adaptive Server连接超时

[英]TinyTds Error: Adaptive Server connection timed out

We are running a ruby on rails application on rails 3.2.12 (ruby 1.9.3) with current tinyTDS gem 0.6.2. 我们在rails 3.2.12(ruby 1.9.3)上使用当前tinyTDS gem 0.6.2在rails应用程序上运行ruby。

We use MS SQL 2012 or 2014 and facing more then usual the following error message: 我们使用MS SQL 2012或2014,面对更常见的以下错误消息:

TinyTds::Error: Adaptive Server connection timed out: EXEC sp_executesql [...]

Database AUTOCLOSE is off. 数据库AUTOCLOSE已关闭。 TCP Socket Timeouts are default Windows system. TCP套接字超时是默认的Windows系统。

Application server is on machine #1 (windows server), SQL server is on machine #2 (windows server). 应用程序服务器位于计算机#1(Windows服务器)上,SQL服务器位于计算机#2(Windows服务器)上。

When I check the connections (netstat) I have like 250 connections open for around 20-30 users. 当我检查连接(netstat)时,我想为大约20-30个用户打开250个连接。 I run perform.exe to see idle time on SQL server for the data and log disks. 我运行perform.exe来查看SQL服务器上的数据和日志磁盘的空闲时间。

database.yml has connection pool:32 and reconnect:true . database.yml有连接pool:32并且reconnect:true

To me it looks like that tinyTDS lost connection and any exception prevents from reconnecting. 对我而言,看起来tinyTDS失去连接,任何异常都无法重新连接。

The question is, how can I debug into the problem to find out what the problem is? 问题是,如何调试问题以找出问题所在?

UPDATE UPDATE

My mistake, the original error message belongs to tinytDS 0.5.x. 我的错误,原始错误消息属于tinytDS 0.5.x. Since I updated to the latest version I get the following error in addition or instead: 自从我更新到最新版本后,我得到以下错误:

ActiveRecord::LostConnection (TinyTds::Error: DBPROCESS is dead or not enabled: BEGIN TRANSACTION):

First, that pool size seems excessive. 首先,该池大小似乎过多。 Are you using a ton of threads? 你使用了大量的线程吗? If not, then only one connection will be used per app request/response. 如果没有,则每个应用请求/响应仅使用一个连接。 Just seems like that value is way to high. 看起来这个价值很高。

Second, what SQL timed out? 二,什么SQL超时? Have you found that certain SQL is slower than others? 您是否发现某些SQL比其他SQL慢? If so, then you have two options. 如果是这样,那么你有两个选择。 The first would be to tune the DB using standard practices like indexes, etc. The second would be to increase the "timeout" option in your database.yml. 第一种方法是使用索引等标准做法来调整数据库。第二种方法是增加database.yml中的“超时”选项。 The default timeout is 5000 which is 5 seconds. 默认超时为5000,即5秒。 Have you tried setting it to 10000? 你试过把它设置为10000吗? I guess what I am asking is how are you sure this is a "connect" timeout vs a "wait" timeout? 我想我问的是你怎么确定这是一个“连接”超时与“等待”超时?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Rails和Azure:TinyTds :: Error:Adaptive Server连接失败 - Rails and Azure: TinyTds::Error: Adaptive Server connection failed PostgreSQL:无法连接到服务器:连接超时 - PostgreSQL: could not connect to server: Connection timed out TinyTds::Error: 在配置文件中找不到服务器名称 - TinyTds::Error: Server name not found in configuration files Appfog + Rails 3 + Postgresql + IronWorker =>无法连接到服务器:连接超时(PG :: Error) - Appfog + Rails 3 + Postgresql + IronWorker => could not connect to server: Connection timed out (PG::Error) Redis::TimeoutError:连接超时错误 -Rails 缓存 - Redis::TimeoutError: Connection timed out Error -Rails cache Ruby / Rails + Resque抛出“连接超时”错误 - Ruby/Rails + Resque throwing “Connection timed out” Error REST服务连接超时 - Connection timed out with REST service 安装导轨中的连接超时 - Connection Timed out in Installing rails 接收“ActiveRecord :: StatementInvalid:PG :: ConnectionBad:PQconsumeInput()无法从服务器接收数据:连接超时”在rake任务中 - Receiving “ActiveRecord::StatementInvalid: PG::ConnectionBad: PQconsumeInput() could not receive data from server: Connection timed out” in rake task 如何在Rails上捕获TinyTds :: Error - How to catch TinyTds::Error on Rails
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM