Re: What the heck is happening here?

From: Alex Pilosov <alex(at)pilosoft(dot)com>
To: Paul Tomblin <ptomblin(at)xcski(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: What the heck is happening here?
Date: 2001-06-11 21:33:44
Message-ID: Pine.BSO.4.10.10106111729370.28444-100000@spider.pilosoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It smells like somewhere, something, is stepping on itself and tries to
use the same connection in two different processes. Usually I'm getting
this if I'm not careful and if I establish connection before forking. (You
shouldn't do that).

In mod_perl case, make sure that your stuff does not try to establish
connections on startup, and only does that (using ApacheDBI to cache
connections) when the page is requested.

Also, it is possible that every day some script tries to rotate logs and
SIGHUPs the httpd. mod_perl may do strange stuff on restart. Try manually
sending HUP to server and see what happens.

-alex

On Mon, 11 Jun 2001, Paul Tomblin wrote:

> I have a mod_perl script that opens a database connection, and keeps it
> open. But every day the script stops running. Today I look in the logs,
> and at 10:37 I see my script detect a bad return from a $conn->exec of the
> following query:
> SELECT id, datasource_key, type, name, address,
> state, country, latitude, longitude, declination,
> main_frequency, elevation, datasource
> FROM waypoint
> WHERE latitude >= -90 AND latitude <= 90 AND
> longitude >= -180 AND longitude <= 180 AND
> (country IN ('UNITED STATES') OR
> (state IN ('AK','AL','AR','AZ','CA','CO','CT','DC','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VA','VT','WA','WI','WV','WY') AND country = 'UNITED STATES') OR
> (state IN ('') AND country = 'CANADA') ) AND
> type IN ('AIRPORT','DME','FAN MARKER','MARINE NDB','NDB','NDB/DME','TACAN','UHF/NDB','VOR','VOR/DME','VORTAC')
> ORDER BY id, datasource
>
> (yeah, I know the query has some redundancy in it - that's not the problem
> here) but it prints the following message:
>
> message: Unknown protocol character 'Unknown protocol character '8' read from backend. (The protocol character is the first character the backend sends in response to a query it receives).
> Unknown protocol character '0' read from backend. (The protocol character is the first character the backend sends in response to a query it receives).
> Unknown protocol character '.' read from backend. (The protocol character is the first character the backend sends in response to a query it receives).
> Unknown protocol character '3' read from backend. (The protocol character is the first character the backend sends in response to a query it receives).
> Unknown protocol character 'Unknown protocol character '.' read from backend. (The protocol character is the first character the backend sends in response to a query it receives).
>
> It returns all the query rows, but I do another query within the query,
> and every one of those prints out the following error message:
> PQexec: you gotta get out of a COPY state yourself.
> Which is kind of strange because I don't even know how to use COPY.
>
> Then the next connection to the web server does the same thing, but the
> next one gets the "you gotta get out of a COPY state yourself" on the big
> query.
>
> Any ideas? Should I stop keeping the connection open so long?
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Konstantin Borchert 2001-06-11 21:38:05 Monitoring PostgreSQL
Previous Message Pete Leonard 2001-06-11 21:12:36 stumped on view/rule/delete problem.