Skip site navigation (1) Skip section navigation (2)

RE: [ODBC] RE: [PATCHES] Fix for ODBC close

From: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
To: "'Bruce Momjian'" <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Cc: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>, PostgreSQL odbc list <pgsql-odbc(at)postgreSQL(dot)org>, PostgreSQL-patches <pgsql-patches(at)postgreSQL(dot)org>
Subject: RE: [ODBC] RE: [PATCHES] Fix for ODBC close
Date: 2001-02-11 19:17:45
Message-ID: 8568FC767B4AD311AC33006097BCD3D61A297C@woody.vale-housing.co.uk (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-odbcpgsql-patches

> -----Original Message-----
> From: Bruce Momjian [mailto:pgman(at)candle(dot)pha(dot)pa(dot)us]
> Sent: 11 February 2001 06:31
> To: PostgreSQL-development
> Cc: Dave Page; PostgreSQL odbc list; PostgreSQL-patches
> Subject: Re: [ODBC] RE: [PATCHES] Fix for ODBC close
> 
> 
> OK, I have a pretty good guess about the cause of the ODBC shutdown
> failure message in the server logs.  Sending 'X' is still causing the
> error message.
> 
> The error you are seeing is from the backend libpq code, the area that
> communicates with clients.
> 
> So, let's assume the problem is not the platform, but the 
> client code. 
> Libpq properly shuts connections without triggering that 
> message.  ODBC
> does trigger the message.
> 
> libpq closes connections with:
> 
> 		(void) pqPuts("X", conn);
> 		(void) pqFlush(conn);
> 
> while ODBC closes with:
> 
> 		SOCK_put_char(self, 'X');
> 		SOCK_flush_output(self);
> 
> They then close() the socket.
> 
> It seems the difference is in the flushing.  libpq has elaborate flush
> code:
> 
> 	while (len > 0)
> 	{
> 			sent = send(conn->sock, ptr, len, 0);
> 			len -= sent;
> 
> 			if (pqWait(FALSE, TRUE, conn))
> 	}
> 
> and pqWait does:
> 
> 		if (select(conn->sock + 1, &input_mask, 
> &output_mask, (fd_set *) NULL,
> 
> 
> For flush, ODBC does a simple:
> 
> 	written = send(self->socket, (char *) self->buffer_out, 
> self->buffer_filled_out, 0);
> 
> 
> It seems we may need to add flush code similar to libpq in ODBC.
> 
> At a minimum, we have to put the send() in a loop and keep going until
> there are no more bytes to send.  Not sure the select() is required.
> 
> Comments?
> 
> After I receive comments, I will prepare a patch people can test.

Sounds reasonable though I must admit this isn't exactly my area of
expertise! I'll certainly test any patches though and make a .dll available
for others to try.

Regards,

Dave.

pgsql-hackers by date

Next:From: Ryan KirkpatrickDate: 2001-02-11 22:03:33
Subject: Recovery of PGSQL after system crash failing!!!
Previous:From: Tom LaneDate: 2001-02-11 18:25:46
Subject: Re: ODBC backward versions

pgsql-odbc by date

Next:From: Dave PageDate: 2001-02-11 19:28:22
Subject: RE: RE: [PATCHES] Re: [HACKERS] 6.2 protocol
Previous:From: Tom LaneDate: 2001-02-11 18:19:17
Subject: Re: Re: [ODBC] RE: [PATCHES] Fix for ODBC close

pgsql-patches by date

Next:From: Hiroshi InoueDate: 2001-02-12 00:59:16
Subject: Re: [ODBC] RE: [PATCHES] Fix for ODBC close
Previous:From: Tom LaneDate: 2001-02-11 18:19:17
Subject: Re: Re: [ODBC] RE: [PATCHES] Fix for ODBC close

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group