Re: Connection gets into state where all queries fail

From: Scott Ribe <scott_ribe(at)killerbytes(dot)com>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Connection gets into state where all queries fail
Date: 2004-06-22 22:30:15
Message-ID: BCFE0F17.4A580%scott_ribe@killerbytes.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>> OK, I'm using a pool of worker threads that each have a connection (from my
>> own software, no PHP or anything like that involved), and a connection is in
>> a state where all queries fail. Looking back through the log I find the
>> first entry where this connection has an error (there are successful queries
>> on it prior, so it's not the first query):
>>
>
> Your problem is that you have an error within a transaction and as the
> error message states:
>
>> 2004-06-21 14:51:58 [5589] ERROR: current transaction is aborted, queries
>> ignored until end of transaction block
>
> All your queries will be ignored until you complete the transaction,
> either with a commit or a rollback. I find the message very clear, how
> do you think it could be reworded to be more clear?

What's not clear is why I should be told this when the invalid query ended
with a commit.

>> - Is there something I need to do after an error like this, in order to get
>> the connection back to a usable state?
>
> COMMIT or ROLLBACK
>
>> - Is this a bug?
>
> In your program, yes. Although I find it interesting that your commit
> is ignored after the error. Just send it as a seperate query.

Yes, exactly. I've never seen a commit be ignored like this--believe me I've
had other erroneous queries, and the connections never got borked like this.

>> - Is there anything I can do to provide more information? I still have the
>> server running right now, but I'm going to have to reboot soon because this
>> is causing problems.
>
> Just add a transaction commit or rollback after the error.

I'll certainly add such code as a fail-safe, but I'd still like to
understand more fully what has happened. Can I really be 100% sure this
would keep the connection usable, given that the 1 commit already somehow
failed to end the transaction block? I can certainly understand that a
commit submitted by itself might be recognized where for some reason the
original one was skipped over, but I'd still like to know more about what
happened.

--
Scott Ribe
scott_ribe(at)killerbytes(dot)com
http://www.killerbytes.com/
(303) 665-7007 voice

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2004-06-22 22:41:38 Re: Connection gets into state where all queries fail
Previous Message Martijn van Oosterhout 2004-06-22 22:12:23 Re: flock user defined function