Re: What the heck is happening here? - Mailing list pgsql-general

From Alex Pilosov
Subject Re: What the heck is happening here?
Date
Msg-id Pine.BSO.4.10.10106111729370.28444-100000@spider.pilosoft.com
Whole thread Raw
In response to What the heck is happening here?  (Paul Tomblin <ptomblin@xcski.com>)
Responses Re: What the heck is happening here?  (Paul Tomblin <ptomblin@xcski.com>)
List 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')
ANDcountry = '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
thefirst 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
inresponse to a query it receives). 
> Unknown protocol character '.' read from backend.  (The protocol character is the first character the backend sends
inresponse to a query it receives). 
> Unknown protocol character '3' read from backend.  (The protocol character is the first character the backend sends
inresponse to a query it receives). 
> Unknown protocol character 'Unknown protocol character '.' read from backend.  (The protocol character is the first
characterthe 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?
>
>


pgsql-general by date:

Previous
From: Pete Leonard
Date:
Subject: stumped on view/rule/delete problem.
Next
From: Paul Tomblin
Date:
Subject: Re: What the heck is happening here?