-
Notifications
You must be signed in to change notification settings - Fork 375
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
SQLSTATE[08S01]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x2714 #835
Comments
@Kryptonien Thanks for providing this info. We will investigate. In the meantime, I suggest trying the following:
|
Thanks for replying, after some investigation I managed to find the way to add the MultipleActiveResultSets instruction to the DSN. I've read about this feature here. One thing disturbe me in the source code of the Laravel Framework. In the microsoft documentation it's mentioned that this feature is disabled by default. The only option available with the Laravel Framework is "False" as per the following lines:
The new DSN string looks like the following: Anyway, I will keep you up to date, thanks for help. |
I have the same issue and same versions of pdo, sql, ubunt. However, the sqlserver is over a VPN y my problem reside executing and store procedure |
Hello, Might it be related to bug #809 ? The SqlServer could be overloaded ? |
No, it's not related to bug #809. I solve the problem moving to freetds. Im sorry but the driver is not yet mature. |
@Kryptonien As a similar problem was fixed very recently in unixODBC 2.3.7 and you say you have been trying to fix this for months, I have a feeling that you are still using an older version of unixODBC even though |
Indeed, I followed the instructions from bug #762 to install it manually. This is the result from ldd:
unixODBC 2.3.7 is installed in the "/usr/local/lib" folder. Furthermore, unixODBC 2.3.6 should be completely removed by these two commands, right ?
|
Okay, then you have the correct unixODBC. How frequently does the error occur? Are you certain that it never occurs using sqlcmd or isql? |
I suggest trying something like this script. |
Yes I have the correct unixODBC installed (2.3.7). Thanks for your concern. However, We are going to test again on a clean server to make it work. Thanks to all again, and thanks @david-puglielli @Kryptonien |
@david-puglielli The error occur at least once a day. It's always at 5am. There is a huge script running at that moment, that's why I was thinking of a server overload. Another huge script is suffering the same problem at midnight. I will try your suggestion and see if I get the same result from isql at those hours. |
@Kryptonien Do you have any updates on this? |
@david-puglielli not yet sorry, I overwritten my test.log by mistake. I've been really busy lately and completely forgot until today. Since the error occur in the middle of the night I have to schedule the task and not forget afterward ... 👍 I've also done some other tests, and managed to fix the error from midnight, in my opinion it was due to a remanent failing network because I only restarted the php-fpm service. One more thing, I said there was a huge script at 5am which is not true. It's only a loop with delete statements. Maybe optimizing this should fix the problem. It's more like a workaround than a fix ... I scheduled a new test for this night, I'll try to not overwrite it this time ! |
Turns out no error occur from the test script. The whole test.log is fine. The tests are every 5 seconds and both are successful:
Unless it's a really specific timed error, should i conclude there's no problem with the drivers ? (The midnight error is happening again. The last one was at 2018-09-03 00:10, I restarted the php-fpm service. No error anymore and then this night at 2018-09-08 00:10, but I think it's not relevant.) |
It seems like there is some network problem, and I think you're right that the problem is not with our drivers. There are a couple of other things you could try to narrow down the issue - either an ODBC trace, or profiling with the SQL Server profiler. Running an ODBC trace will tell you what ODBC calls are being made, while the SQL Server profiler will tell you what's happening on the server side. |
Closing this issue due to inactivity, @Kryptonien |
Hello @david-puglielli , I have ODBC Trace enabled and I have done some tests with SqlServer Profiler. Unfortunately, that's not helping me much. Do you have any recommandation on how to configure Sql Server Profiler in my situation ? Which events should I check ? I don't know what I should expect to find in the odbctrace.log. There's a bunch of calls, as you mentioned, all successfull. I appreciate your help. |
For the profiler, I'd suggest checking any events related to errors/warnings and any related to connections (ie. everything under Sessions and everything under Errors and Warnings in the Trace Properties->Events Selection dialog). As for the ODBC trace, look for any connection related calls and see if anything looks unusual (you can attach it here as well and we can take a look). |
I've already tried those options, but I'll give it another shot just to be sure. Here is the ODBC trace: https://pastebin.com/n88JtK3M |
After several tests there's no error or whatsoever which would explain those "Communication link failure". The failing statements are not even showing on the Sql Server Profiler as if it wasn't reaching the server. |
The trace didn't reveal anything but it may be incomplete. You should be able to obtain a more complete trace by setting TraceOn and TraceFile in the connection options in your php script (in addition to the instructions in this link). |
I did not succeed to get a log file. I also did a raw test, to be sure if it wasn't a framework related problem:
This raw test does not output any log file. Is there anything wrong ? |
The log file and path from TraceFile must be identical to the one listed in odbcinst.ini. Also one more thing to try - remove the port number from the server name in the connection string and see if the problem still occurs. |
@david-puglielli Here is the new pastebin with some chunks of the log file: https://pastebin.com/im1p0yN0 Thank you for your time. |
The connection failures seem to happen only on calls to SQLExecute. Can you try cross-referencing the timestamps with the results of SQL Server profiling to see what the server is doing during these calls? The timestamps are located in the lines starting with Here is something else to try - see if the SQL Server port is being used by another program, by running |
Hi, I think I figured it out. Looks like it's a timeout related issue as per this topic. I tried the workaround by increasing the timeout and it seems to have reduce the error to none (excluding periods of DB slowdowns I'm experiencing). Is it an intended behavior, when a statement is hard killed by PHP, to close the connection ? (I'm assuming this is what's happening) I'm pretty confident about the fact that this is not a Laravel related issue because the problem showed up at the moment I started using pdo_sqlsrv, but I could be wrong ! Looking forward to your feedbacks. NB1: The intended behavior of my script is to throw a TimeoutException and store it to the failed_jobs table. It was working well back then as far as I remember. NB2: Meanwhile, I'll do some more tests. |
hi @Kryptonien @david-puglielli is not around till later next week, but glad to hear that you have seemingly figured out the real issue. As you probably know, there are multiple factors (this link gives you an idea) that can cause the connection timeout period to expire before the data source responds to the request, When that happens, the statement fails to be executed. That being said, it doesn't look like the problem is ODBC driver or Laravel related. About your script that throws a TimeoutException, maybe things no longer work the same over time? Say, the existing databases / data tables / network need to be fine tuned? Let's see if @david-puglielli has any other idea when he comes back, and yes, please continue to explore and do some more tests, @Kryptonien |
It's ok, everyone needs to blow off someday ;) Plus, it's not like if I was in a hurry or something, my issue is kind of fixed. Thanks for letting me know anyway. |
This seems rather similar to #885 . @Kryptonien if your PHP process is receiving POSIX signals it will throw out the connection. |
@mathieuk I don't know anything about POSIX but by reading your ticket this looks similar enough to me. Are you using Beanstalkd to process your jobs ? I was wondering if the issue could be kind of related to that. Since I can't reproduce the issue everytime it's hard to investigate. I will look closely at your ticket to see the progress. |
@Kryptonien it doesn't really matter what job driver you use. Laravel uses POSIX signals (namely, SIGALRM) to protect against run away jobs. I believe the default timeout is 60 seconds. If SIGALRM arrives (the timeout is hit) while your job is executing a MSSQL query you'll end up with the error messages you mentioned. If that's not your scenario, and you're not using signals in a different way, then maybe it isn't the same issue but I figured it seemed quite similar :) |
@mathieuk Yeah that's exactly what I thought. But I've done a bunch of tests in order to reproduce the issue repetitively, without success. In my case it's really random even though it shouldn't be. |
@Kryptonien a bit of a stretch, but you might try and run a worker under
This shows my test script received SIGALRM. Perhaps you can rule out that situation that way. |
@mathieuk I noticed two cases:
Strace
Error Log
Strace
Error Log
|
@Kryptonien Is this still an issue? There are new releases of both the ODBC driver and SQLSRV drivers, please check if they fix your connection issues. |
Experiencing the same issue. I'm using 64-bit Ubuntu 18.04.2, with PHP 7.2 installed from the distro's repository. sqlcmd returns the same error too. The SQL Server is version 2005 (64-bit, exact version is 9.0.5000) running in Windows 2003 Server Enterprise. Any ideas? Can we try something to further debug the issue? |
@yitam Thanks for letting me know. So, FreeTDS is the way to go I guess. Thanks! |
Thanks for keeping me up to date, I will take a look at those new releases. 👍 |
Still happening :) PHP Driver versionpdo_sqlsrv 5.6.0+11812 Microsoft ODBC Driver versionlibmsodbcsql-17.3.so.1.1 PHP version7.2.16-1+ubuntu16.04.1+deb.sury.org+1 |
I have encountered the same problem. Have you solved this problem now? |
@nyg123 please elaborate the problem you've encountered and whether it is consistently reproducible. If so, please provide the repro scenario (scripts, drivers' versions, etc.) |
@Kryptonien @nyg123 The latest release of the ODBC driver, version 17.4, may fix the connection issues you're seeing. Please upgrade your msodbcsql17 install (instructions here). |
@david-puglielli Looks like I am unable to reproduce the problem with this new release. Though I have a fairly different environment than before. I'm now using Docker instead of Vagrant. I will try this new release in my production environment as soon as I can to ensure this is fixed. Thank you. |
I’m now depending on incoming signals throwing connection exceptions during query/fetching. So, does this version change signal handling or does it fix other connections issues?
… Op 7 aug. 2019 om 20:24 heeft David Puglielli ***@***.***> het volgende geschreven:
@Kryptonien @nyg123 The latest release of the ODBC driver, version 17.4, may fix the connection issues you're seeing. Please upgrade your msodbcsql17 install (instructions here).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@Kryptonien You're welcome. Please let us know if the problem crops up again. @mathieuk I don't know if the new version changes anything related to signal handling, but as indicated on issue #885, the signal handling issue is out of our scope and not something we can address. Please try the new driver and report any differences in behaviour from before. Meanwhile, we will continue to monitor progress on the PHP side. |
I had the same problem but I got to solve with this command |
@Kryptonien we decided to close this issue due to inactivity. Please feel free to reopen if necessary. |
Just removed DB_PORT and it worked like magic! |
where??? |
sqlalchemy.exc.OperationalError: (pyodbc.OperationalError) ('08S01', '[08S01] [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x68 (104) (SQLExecDirectW)') I have the same problem today because the length of the field is not enough relative to the length of the data. Lengthening the length of the field will solve the problem. |
PHP Driver version
SQL Server version
Client operating system
PHP version
Microsoft ODBC Driver version
Table schema
CREATE TABLE dbo.failed_jobs (
id BIGINT IDENTITY PRIMARY KEY,
connection NVARCHAR(MAX) NOT NULL,
queue NVARCHAR(MAX) NOT NULL,
payload NVARCHAR(MAX) NOT NULL,
exception NVARCHAR(MAX) NOT NULL,
failed_at DATETIME DEFAULT getdate() NOT NULL
) GO
Problem description
I randomly get the following errors:
SQLSTATE[08S01]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x2714
SQLSTATE[08S02]: [Microsoft][ODBC Driver 17 for SQL Server]SMux Provider: Physical connection is not usable [xFFFFFFFF]
I tried several solutions I found but none of them seems to work, though it looks like there is an improvement:
This is my unixODBC version
By the way, I am not using the odbc.ini file as I am working with laravel PHP framework, which I presume create its own DSN string. I've followed the FAQ instructions by using the isql command and everything is fine.
I also checked the following compatibily documentation: https://docs.microsoft.com/en-us/sql/connect/php/system-requirements-for-the-php-sql-driver?view=sql-server-2017
If relevant:
As you can see, on the first hand, the delete query is failing and return the infamous "TCP Provider: Error code 0x2714", then, the insert statement fails. (In the failed_jobs table)
I do not know what I can do more, I hope I can find some help here since it's been months I try to kill that bug. Ever since I upgraded from pdo_dblib to pdo_sqlsrv.
The text was updated successfully, but these errors were encountered: