php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32854 mssql_pconnect fails under load and doesn't recover
Submitted: 2005-04-27 13:09 UTC Modified: 2005-11-14 01:00 UTC
Votes:29
Avg. Score:4.8 ± 0.6
Reproduced:27 of 27 (100.0%)
Same Version:11 (40.7%)
Same OS:14 (51.9%)
From: gerritgiliomee at hotmail dot com Assigned: fmk (profile)
Status: No Feedback Package: MSSQL related
PHP Version: 5.0.4 OS: Windows 2000 sp4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gerritgiliomee at hotmail dot com
New email:
PHP Version: OS:

 

 [2005-04-27 13:09 UTC] gerritgiliomee at hotmail dot com
Description:
------------
Using mssql_pconnect to connect to a MS SQL2000 server on another box.  Everything works a treat until I put some load on.  When I go above a certain threshhold, e.g. using Apache Benchmark, 20 concurrent users, 500 requests, mssql_pconnect fails with this error:

"Warning: mssql_pconnect() [function.mssql-pconnect]: Unable to connect to server: servername"

This is understandable as things will break above a certain point, however, after this happens, mssql_pconnect seems to have hung, even if I change the connection details, or try using mssql_connect, I still get the same error.

The only thing that resolves it is restarting IIS.

Using Win2K (sp4), IIS5, MS SQL 200 (sp2).

PS: I have made sure I'm using the right version of ntwdblib.dll.

It's also worth noting that my phpinfo() reports "Library Version: 7.0" instead of the presumed 8.0.  Not sure if this is connected to the SQL version though.

I've toggled around and have these mssql settings in my php.ini
[MSSQL]
; Allow or prevent persistent links.
mssql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mssql.max_persistent = 100

; Maximum number of links (persistent+non persistent).  -1 means no limit.
mssql.max_links = 100

; Minimum error severity to display.
mssql.min_error_severity = 10

; Minimum message severity to display.
mssql.min_message_severity = 10

; Compatability mode with old versions of PHP 3.0.
mssql.compatability_mode = Off

; Connect timeout
mssql.connect_timeout = 5

; Query timeout
mssql.timeout = 60

; Valid range 0 - 2147483647.  Default = 4096.
mssql.textlimit = 4096

; Valid range 0 - 2147483647.  Default = 4096.
mssql.textsize = 4096

; Limits the number of records in each batch.  0 = all records in one batch.
mssql.batchsize = 0

; Specify how datetime and datetim4 columns are returned
; On => Returns data converted to SQL server settings
; Off => Returns values as YYYY-MM-DD hh:mm:ss
;DEV - used to be completely commented out
mssql.datetimeconvert = Off

; Use NT authentication when connecting to the server
mssql.secure_connection = Off

; Specify max number of processes. Default = 25
mssql.max_procs = 25



Any help will be much appreciated.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-07 00:00 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-11-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-04-18 07:27 UTC] cobus at revotxt dot co dot za
Hi,

We got the same problem using PHP 5.1.2 on Windows 2003 SP1, connecting to MS SQL2000 using mssql_connect() or PDO_ODBC.

We've had this problem (with mssql_connect) since PHP 4.3.10, so please don't tell us to use the latest snapshot unless you know for a fact that this problem has been addressed.

We have three IIS machines and one database machine in a lab. After putting pressure on one of the IIS machines, we got it in a state that it won't make any new database connections whereas the others IIS machines communicate fine. This problem is very difficult to reproduce in the lab.

We also switched the code (while not restarting IIS) to use PDO_ODBC to connect to the same database server. Here we received the same result. The one machine was still "hung" and not making database connections.

We tried getting more information with mssql_get_last_message() but got an empty string, and from the exception that PDO throws just this: "SQLSTATE[] SQLConnect: 0"
 [2006-05-03 08:14 UTC] contact at isi-developpement dot com
Dear all,

We use Apache 2, PHP 5.1.0, MS SQL2000 up-to-date, Windows XP SP2 French up-to-date.

The mssql_pconnect() function seem to not use the same connection each time it is used.

If we open a web page with 3 iframes contening each one a connection to the database, there are 3 connections openned on the web server.

In fact, after using the web server, we obtain the classic error message "Warning: mssql_pconnect() [function.mssql-pconnect]: Unable to connect to server: servername"
The only way is to restart Apache.

Have a good day to all.

Laurent.
 [2006-06-28 08:19 UTC] nusepas at gmail dot com
I have also the same problem

I'm using apache 2.0, with php5.1.4, with freetds 0.63 under Fedora Core 5.

Last I was with a Fedora Core 3, using apache1.3, php4.1 and unknown version of freetds.

I have the right version of mssql.so but also gives me that error, but don't hangs the server


Warning: mssql_pconnect() [function.mssql-pconnect]: Unable to connect to server: 192.168.2.55 in /var/www/html/solid/funcions.php on line 11
Error al conectar:
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 01 10:03:45 2023 UTC