-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lost Connections Crashing. Better dberrhandle Implementation #79
Comments
It is important to read the full thread from above, the link is only the last part. Will need to QA out client.c code. Also, this is another link on SQL Server and it's keep alive setting. Which could also play into poor connections. But the main emphasis should be on a better dberrhandle implementation. http://blogs.msdn.com/b/sql_protocols/archive/2006/03/09/546852.aspx |
This thread has some interesting keep-alive talk. |
Is there any way to handle these exceptions within my Rails application? |
Technically yes, read up here in the adapter. https://github.com/rails-sqlserver/activerecord-sqlserver-adapter#auto-connecting |
ActiveRecord::ConnectionAdapters::SQLServerAdapter.auto_connect returns nil |
No, you have to define your own methods to do what you want. These are callbacks so you can get more info and debug. As the docs say, the currently log. So if you want to add more to that or change it, do something like this in a confi/initializers/ file. module ActiveRecord
module ConnectionAdapters
class SQLServerAdapter < AbstractAdapter
protected
def self.did_retry_sqlserver_connection(connection,count)
# ...
end
def self.did_lose_sqlserver_connection(connection)
# ...
end
end
end
end |
hmm, if
is the default, shouldn't i see at least one of these messages in the log? And this is most i get when i run from command-line. When i run this via wrapper (with rubyw.exe) as a service that crash messages doesn't even show anywhere and the process still stays up as a zombie so noone can even tell that the service died. |
Is there a solution for this or not? I really have difficulty to understand. Setting
does not work for me? At a post above you're saying that wouldn't be enough. It's not me who created this adapter who come I can fix this by my self? :| HOW to prevent my app to die because of that kind of dead connections?? Doesn't this question have an answer? With a plain english? |
Both versions 0.6.0.rc1 x86-mingw32 and 0.5.1 x86-mingw32 crash after connection is lost; no reconnection attempt, no single entry in the log |
Someone needs to provide a suggested patch to save me some time till I get a chance to look at this. Also, I have this test that is in skip mode which would help with debugging. |
I have built tiny_tds with my patch (BTW great job with the mini_portile!) and I can confirm it solves the issue: after dropping the connection (using tcpview utility from sysinternals) it is now nicely reconnecting (CONNECTION RETRY: ActiveRecord::ConnectionAdapters::SQLServerAdapter retry #0. in the log file) instead of blowing up the the process. |
Working on pushing a v0.6.0 release soon.
On Jul 5, 2013, at 4:32 PM, Krzysztof Chodak notifications@github.com wrote:
|
Closing this since issue #124 is the fix. |
I don't know if this a problem in TinyTds or FreeTDS or just a crappy SqlServer that is on it's last legs: So I have two questions:
Thanks, this Gem has been a lifesaver btw! |
Please check awl log file first
|
awl=sql
|
I'm tracking. I'll get with our support team to pour through the logs. |
Yes it is
|
Why don't you build a gem from master and try a newer version. We have fixes around this area. |
Based on this James K. Lowden's excellent stack trace review.
http://lists.ibiblio.org/pipermail/freetds/2012q2/027793.html
The text was updated successfully, but these errors were encountered: