From: | Abdul-Wahid Paterson <aw(at)lintrix(dot)net> |
---|---|
To: | Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: after postgres upgrade - ERROR: current transaction |
Date: | 2003-09-16 16:23:20 |
Message-ID: | 1063729399.18985.340.camel@yusuf.lintrix.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have kinda put my finger on the problem. It seems that a transaction
was crashing out somewhere in my code and a rollback was not being done
(I have not found the line of code yet) and the next PHP script to take
on the connection was therefore getting a message saying that the
current transaction was aborted.
I changed my PHP connection setting to not use persistent connections
and the problem was fixed. Although, that was not a good solution for me
as I have high sever load.
I then wrote a php shutdown function to always do a rollback at the end
of the script. I switched on the persistent connections again, and
everything was fine. Thus concluding that the problem was indeed a
failed transaction that had not been rollback. (At least this will be
good enough until I can sift through the thousands of lines of code
looking for transaction code that has a missing rollback).
The thing that still puzzles me is this: If you remember from my earlier
post, the only thing I have changed here is the database server (from
postgres 7.1.3 to 7.3.4). What I don't understand is why did 7.1.3 never
cause a problem with the failed transactions not being rolledback?
Postgres surely doesn't know that it is a new PHP script using the
connection as all Postgres knows about is the Apache HTTP process
holding the connection open. Can anyone shed some light on the
difference between version? Or perhaps there is something else in
Postgres configuration that would change the above behaviour.
Best regards,
Abdul-Wahid
On Mon, 2003-09-15 at 19:48, Robert Treat wrote:
> While I would recommend you upgrade your php to be built against 7.3,
> before that you can use one of the new 7.3 error messages to find out
> where things are going awry. in your postgresql.conf set
> log_min_error_statement = error. this will cause the offending sql
> statement to be written to your logs, with this you can narrow down
> where in your web code your problems are being created, and better
> attack the problem at that point.
>
> Robert Treat
>
> On Mon, 2003-09-15 at 14:18, Abdul-Wahid Paterson wrote:
> > Hi,
> >
> > I have had a site working for the last 2 years and have had no problems
> > until at the weekend I replace my database server with a newer one. The
> > database migration went like a dream and I had the whole db changed over
> > in 1 hour.
> >
> > Since the upgrade I have been getting the following error message
> > sporadically.
> >
> > ERROR: current transaction is aborted, queries ignored until end of
> > transaction block
> >
> >
> > I have the following setup
> >
> > Webserver:
> > Apache 1.3.27 (Redhat 7.2)
> > PHP 4.1.2
> >
> > Database server (old): Postgres 7.1.3
> > Database server (new): Postgres 7.3.4
> >
> > The PHP scripts have not changed. I am using PEAR::DB for database
> > access. I think it is the PEAR::DB that is actually making the
> > transactions because some times the error message some times gets
> > generated when I don't even have a transaction. Not too sure about that
> > though.
> >
> > The funny thing is, when I first start up the web-server I don't get any
> > error messages and the site carries on working fine just as it did when
> > using the old database server.
> >
> > However, after about an hour. I suddenly get 10 errors a minute from my
> > site (average of course) with the majority of pages still accessing
> > fine. After a bit more time, this doubles to 20 errors a minute. If I
> > carry on leaving the site, I eventually get error messages every second.
> > The error message seem to be generated from completely unrelated bits of
> > my code.
> >
> > When I restart Apache the error messages go away and the site functions
> > as normal.
> >
> > My theory is, since I am using persistent connections in PHP, a
> > connection is some how becoming...unstable...for the want of a better
> > word. That connection then returns an error on every single request.
> >
> > To put my theory to test, I have turned off the persistent connections
> > on my site and everything appears to be working fine now. I now need to
> > work out where to go from here as my server load is high and I would
> > prefer to use persistent connections.
> >
> > Has anyone experienced any similar problems with changing Postgres
> > versions? Do I need to upgrade my PHP on the web-server as the RedHat
> > postgres the PHP was built against was Postgres 7.1.3? Anyone have any
> > suggestions on how I can fix this?
> >
> > Regards,
> >
> > --
> > Abdul-Wahid Paterson
> >
> > Lintrix Networking & Comms. ltd. Web: http://www.lintrix.net/
> > Tel: +44 (0) 870 285 4703 Mobile: +44 (0)7971 506177
> > Fax: 0870 133 0433 Email/Jabber: aw(at)lintrix(dot)net
> > --------------------------------------------------------------------
> > Web-Hosting | Development | Security | Consultancy | Domains
> > --------------------------------------------------------------------
--
Abdul-Wahid Paterson
Lintrix Networking & Comms. ltd. Web: http://www.lintrix.net/
Tel: +44 (0) 870 285 4703 Mobile: +44 (0)7971 506177
Fax: 0870 133 0433 Email/Jabber: aw(at)lintrix(dot)net
--------------------------------------------------------------------
Web-Hosting | Development | Security | Consultancy | Domains
--------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Treat | 2003-09-16 16:54:29 | Re: after postgres upgrade - ERROR: current transaction |
Previous Message | Andrew Rawnsley | 2003-09-16 15:24:20 | Re: State of Beta 2 |