Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 582CA6323A0 for ; Mon, 24 Aug 2009 21:48:23 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 54790-09 for ; Tue, 25 Aug 2009 00:48:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by mail.postgresql.org (Postfix) with ESMTP id 686F6632198 for ; Mon, 24 Aug 2009 21:48:11 -0300 (ADT) Received: from 122-57-44-76.jetstream.xtra.co.nz ([122.57.44.76] helo=[192.168.1.3]) by tremor.opencloud.co.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1MfkCj-0006Vw-MN; Tue, 25 Aug 2009 12:48:05 +1200 Message-ID: <4A9334C4.2060503@opencloud.com> Date: Tue, 25 Aug 2009 12:48:04 +1200 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Maciek Sakrejda CC: pgsql-jdbc@postgresql.org Subject: Re: PGStream synchronization References: <895e58dd0908241736q3575cdc2v461d879c5b5f9dcb@mail.gmail.com> In-Reply-To: <895e58dd0908241736q3575cdc2v461d879c5b5f9dcb@mail.gmail.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/57 X-Sequence-Number: 19906 Maciek Sakrejda wrote: > We've found some synchronization issues around PGStream in > QueryExecutorImpl and ProtocolConnectionImpl. Specifically, while > QueryExecutorImpl synchronizes all its uses off PGStream, > ProtocolConnectionImpl uses the same PGStream directly when close() is > called. This can easily cause protocol-level errors and, > theoretically, at least, bad data shoved into a COPY IN query while > the actual Connection.close() is ignored. This doesn't just affect > COPY, though--anything that causes writes to the QueryExecutorImpl's > pgStream could be affected. > > The only thing I've achieved so far is protocol-level errors, but > that's a serious enough issue on its own. > > It's not immediately clear how to fix this, since we don't want to > synchronize PGStream itself. Should ProtocolConnectionImpl just > delegate to QueryExecutorImpl on close() perhaps, with > QueryExecutorImpl handling the actual writes to PGStream? What's the expected behaviour when Connection.close() is called concurrently with other work happening on the connection - should the close interrupt the current operation? -O