Connection gets into state where all queries fail

From: Scott Ribe <scott_ribe(at)killerbytes(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Connection gets into state where all queries fail
Date: 2004-06-22 21:06:39
Message-ID: BCFDFB7F.4A561%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):

2004-06-21 14:51:19 [5589] LOG: query: begin; set constraints all
deferred;
insert into "PatientCall_Step"
("id", "PatientCallId", "HandledByStaffId", "AssignedToStaffId", "DoneWhen",
"Summary", "Notes", "ContactIsAnxious", "IsMedicallyUrgent",
"PageMessageId", "AssignToNurseTakingCalls", "AssignNextToNurseTakingCalls")
values (7991, 7774, 944557, 297199, '2004-06-21 19:43:00.000-00', '...',
'...', 'f', 'f', 7992, 'f', 'f');
insert into "PageMessage"
("id", "FromStaffId", "ToStaffId", "PagerNum", "PagerMessage", "Source")
values (7992, 944557, 297199, '7872', 'bogus value', 'PatientCall');
commit;

2004-06-21 14:51:19 [5589] ERROR: value too long for type character
varying(80)

I've removed the actual varchar values, because the data is confidential.
Suffice it to say that there's a hole in the UI, and where the above says
'bogus value' there was indeed a value too long for the column, and the
value seems to have had an embedded CR toward the end. So the error message
from pg is correct.

But the very next query on that process is a simple one, and it fails like
so:

2004-06-21 14:51:58 [5589] LOG: query: select * from "PatientCall" where
"PatientId" =' 534824';

2004-06-21 14:51:58 [5589] ERROR: current transaction is aborted, queries
ignored until end of transaction block

In fact every transaction since then (nearly 300) on that same process has
failed with the same error. This is 7.3.2 running on OS X (I've tested 7.4
and intend to upgrade RSN.)

So I don't understand the errors. I even tried copying the initial query
from the log and pasting into psql, got the error, and was able to continue
making queries without further errors. Note that this is not a perfect way
to test, because the "embedded CR" might have been switched from CR to LF or
vice versa at some point in the logging/downloading/copying/pasting process.

- Is there something I need to do after an error like this, in order to get
the connection back to a usable state?

- Is this a bug?

- 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.

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2004-06-22 21:27:58 Re: More psql problems... >.<
Previous Message Laura Arbilla 2004-06-22 21:05:32 Can I interrupt queries already processing in the server?