PRB: Error 17832 Caused by Blocking Timeout in 16-Bit Sockets (164516)



The information in this article applies to:

  • Microsoft SQL Server 6.0
  • Microsoft SQL Server 6.5

This article was previously published under Q164516

SYMPTOMS

When the 16-bit sockets Net-Library (Dbmssoc3.dll) is used on a computer running Windows 95 to connect to SQL Server, the connection may time out with an operating system error -2. On the server side, a series of "17832 Unable to read login packet" errors are logged in the SQL Server errorlog. The errors appear to occur simultaneously at first, and the frequency of the error then changes to one error per second. This lasts for a period of time approximately equal to the LoginTimeOut set by the application.

WORKAROUND

To work around this problem, do either of the following:
  • Install the updated Wsock.vxd file for Windows 95 discussed in the following article in the Microsoft Knowledge Base:

    175056 : "Error -2" in 16-Bit Program When Disconnecting from SQL Server




    -or-
  • Increase the blocking timeout value to avoid by setting the MaxSecondsToBlock value under the [SQL Server] section in the Win.ini file. For example, you can use the following entry to set the blocking timeout to 20 seconds:
          [SQL Server]
          MaxSecondsToBlock=20
    

MORE INFORMATION

To avoid re-entrancy issues, the 16-bit sockets Net-Library makes socket connect calls in blocking mode. It registers its own blocking hook function, which temporarily disables Windows message dispatching, and will time out the connect call if the connect call does not return within the blocking timeout (the default is five seconds). Upon receiving error 10004 (WSAEINTR) due to the blocking timeout, DB-Library or the ODBC driver will retry the connection at incremental time intervals up to one second, until the logon timeout finally expires. However, when a socket connect call is interrupted on Windows 95, Winsock (Wsock.vxd) incorrectly returns an undocumented error -2 on all subsequent connect attempts, even though the connections are established successfully. The 16-bit Net-Library then reacts to the unrecognized error -2 by closing the socket. On the server side, SQL Server reports the Open Data Services error 17832 for each logon attempt when it tries to read from the closed connection, through which the logon packet is expected to be sent.

On a normal TCP/IP network, the default blocking timeout (five seconds) should be long enough, so socket connections are made without ever having to invoke the blocking timeout. But if for any reason you observe that SQL Server connections using the 16-bit sockets Net-Library fail frequently with operating system error -2, and a large number of error 17832s are logged on the server, you can increase the blocking timeout value to avoid the problem. Just set the MaxSecondsToBlock value under the [SQL Server] section in the Win.ini file. For example, you can use the following entry to set the blocking timeout to 20 seconds:
   [SQL Server]
   MaxSecondsToBlock=20

Modification Type:MinorLast Reviewed:2/22/2005
Keywords:kbinterop kbnetwork kbprb KB164516