Open jrgns opened 4 years ago
I've seen this before as well, and I don't like it... I agree TinyTDS should do a better job with this in my opinion.
I tried to write a test this evening to reproduce this error (basically that #execute
returns false). I tried various Toxiproxy configurations, does not work. I also tried to kill a session, this brings up Cannot continue the execution because the session is in the kill state.
What works consistently on my machine (and about 90% of the time on CI) is the following:
it 'raises error when query cannot be sent' do
client = new_connection
assert_client_works(client)
thread1 = Thread.new do
client.execute("SELECT 1 as [one]").do
end
thread2 = Thread.new do
assert_equal false, client.execute("SELECT 1 as [one]")
end
thread1.join
thread2.join
end
I assume, when the result are read in thread1
and Ruby decides to switch to thread2
, our FreeTDS wrapper is in an invalid state, which can trigger the issue. Likely, because they both try to access the DBPROCESS
object, which should not be allowed.
I would suggest: We implement the exception as suggest in #469, but without any tests, as long as we do not know how to reliably trigger it. Still, I think the exception would be an improvement, since it prevents subsequents errors for users.
Before submitting an issue please check these first!
$ tsql -C
to find out.If none of these help. Please fill out the following:
Environment
Operating System
TinyTDS Version and Information
Description
Previously posted this on the sequel gem. It looks like there's an expectation for the TinyTDS client to raise an exception when the connection is dead, not return false.
The following shows that the client is returning false: