Re: Sudden semi-deterministic disconnection between queries - Mailing list pgsql-general

From Richard Huxton
Subject Re: Sudden semi-deterministic disconnection between queries
Date
Msg-id 200403101015.03585.dev@archonet.com
Whole thread Raw
In response to Sudden semi-deterministic disconnection between queries  (Peter Schuller <peter.schuller@infidyne.com>)
Responses Re: Sudden semi-deterministic disconnection between queries
List pgsql-general
On Wednesday 10 March 2004 07:34, Peter Schuller wrote:
> Hello,
>
> I have a difficult-to-debug problem. I will try to keep this as brief as
> possible without leaving things out. In a certain situation my application
> fails with:
>
>    org.postgresql.util.PSQLException: Connection is closed.  Operation is
> not permitted.
>
> After some debugging I realized that this would happen on the first query,
> regardless of what it is, *after* a specific previous query. In other
> words:
>
>    query1
>    query2
>    ...
>    queryN     <- seems to cause the failure
>    queryN+1 <- failure
>
> queryN *seemingly* completes successfully without any error messsage, but
> then I get the above error when executing queryN+1.

When I get this it's because of bad quoting, which means it never sees queryN
finished until queryN+1 happens. Missing semicolon/closing bracket etc.

> Does anyone have any suggestions at all of what might cause this, or how I
> might debug further? Can I make postgresql do extremely verbose logging
> somehow? For example, if the postmaster is intentionally closing the
> connection it would be interesting to know why.

Assuming you're logging anything, start with LOG_STATEMENT and perhaps follow
up with SERVER_MIN_MESSAGES. Note that you can do this with SQL
  SET LOG_STATEMENT=on;

There are details on log settings in the runtime configuration section of the
manuals. You can log huge amounts of info if you like.
--
  Richard Huxton
  Archonet Ltd

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: load testing
Next
From: Richard Huxton
Date:
Subject: Re: Sudden semi-deterministic disconnection between queries