Return-Path: postarch
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA18477; Fri, 3 Apr 92 13:52:15 -0800
Message-Id: <9204032152.AA18477@postgres.Berkeley.EDU>
From: postarch (Postgres Mailing Archive)
Subject: Re: Postgres can't keep up???
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
In-Reply-To: Your message of "Thu, 02 Apr 92 11:41:34 PST."
             <9204021941.AA01782@postgres.Berkeley.EDU> 
Date: Fri, 03 Apr 92 13:51:59 PST

you write:

>     while ((fgets(my_buf, 9999, fp)) != NULL){
> 
>          status = PQexec (my_buf);
>          printf("status of update %s\n", status);
>          bzero(my_buf, 10000);
>     	 PQreset ();
>          sleep(2);
>     }

> The file "test.log" consists of transactions, one per line:
> Example: begin append(...) append (....) replace .. end
> 
> Note: There is no read in any transaction. All transactions consist of 
> appends, deletes and replace only.

Don't do PQreset() in your while loop.  This causes the existing connection
to the backend to be closed, and the next PQexec then has to re-open one.
Every time a new connection is made you are starting another backend process.

> The problem is as follows:
> 
> If I eliminate "sleep(2)" then the program aborts with one of the following
> messages:
> 
> >> backend not responding >>
>   or 
> >>
> NOTICE:Apr  2 13:49:53:I have been signalled by the postmaster.
> 
> NOTICE:Apr  2 13:49:53:Some backend process has died unexpectedly and possibl
 +y
> 
> NOTICE:Apr  2 13:49:53:corrupted shared memory.  The current transaction was
> 
> NOTICE:Apr  2 13:49:53:aborted, and I am going to exit.  Please resend the
> 
> NOTICE:Apr  2 13:49:53:last query. -- The postgres backend
> >>>
> 
> The last line in the above message keeps on repeating.

The repeating NOTICE was a problem with the front-end reading messages from
an "undead" socket (i.e. after the backend has crashed).  It will go away in
the new release.  Are other users running concurrently?

> If I get rid of reset in the program, then the status returned by the first
> transaction is CBEGIN, the status returned by the second transaction is
> CEND and then the program stops without any message.

> Could somebody explain the above behavior?

I could not get this to happen.  Make sure you are running the queries
you think you are running.


Jeff Meredith
mer@postgres.berkeley.edu
