Skip to Content.
Sympa Menu

freetds - Re: Problem with MSSQL Server 2000 SP1 / Apache 1.3.20 + PHP 4.0.6 + freetds 0.53 during queries

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: James Cameron <cameron AT stl.dec.com>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Problem with MSSQL Server 2000 SP1 / Apache 1.3.20 + PHP 4.0.6 + freetds 0.53 during queries
  • Date: Mon, 12 Nov 2001 09:56:55 +1100


Stefan Carstens wrote:
> Error: 104 (Connection reset by peer) TDS: Write failed in
> tds_write_packet"

This is ECONNRESET being returned by write() on line 165 of
src/tds/write.c and indicates an unexpected connection closure triggered
by the connection peer, which is the SQL server.

A normal close() or shutdown() by the peer should result in read()
returning zero. Even if the peer turns off linger, we should get
ECONNRESET only from a read(), and EPIPE from write.

But if they close() without us asking them to, and we don't check using
select() to see if the socket is readable, we are ignoring the closure
and when we try to write() the peer will send a RST and we'll get
ECONNRESET.

The definition of ECONNRESET says 'A network connection was closed for
reasons outside the control of the local host, such as by the remote
machine rebooting or an unrecoverable protocol violation.'

Possible sources of an ECONNRESET:
- operating system of client,
- operating system of server,
- application software of server (the Microsoft SQL Server product),
- operating system of another machine with same IP address.

Trace the network packets using tcpdump between the client and the
server, looking for RST packets. If packets are seen at the same time
that FreeTDS reports a write failure, the problem is probably not the
operating system of the client. Look for the source of the RST packets
by analysing the packets before the RST.

References:

http://www.lcg.org/sock-faq/flatfaq.php3

--
James Cameron




Archive powered by MHonArc 2.6.24.

Top of Page