Thread: "backend closed" --- I'd like to write a conversion function

"backend closed" --- I'd like to write a conversion function

From
Kovacs Zoltan
Date:
I've got "backend closed" errors --- they seem to be indeterministic.
I am using 7.0.2 but I tried this with 7.1beta3 as well and the error
was similar (but not completely same).

I wrote a char* -> char* conversion function. Now I would use textout()
and textin() to make it possible using my converter for varchars. I use
them, OK. But sometimes calling pfree() closes my backend.

I haven't tried this with the new Datum-based builtin converter functions
with 7.1 yet because we are heavily standing on the base of 7.0.2.

What I exactly did:
1.                    2.                       3.                  4.
text* ----textout---> char* ---konvertal_c---> char* ----textin--> text*

In 7.0.2 if I use malloc() I only can release the 3. variable, if I
would do a free() for the 2. variable, I get the "backend closed" error
at once. OK, I realized that a new way is suggested for doing this:
palloc() and pfree(). OK, it works: no "backend closed" error if I use
them, or at least not at once. But I also get these type of errors,
especially for bigger queries or if I put my text* -> text* (i.e.
varchar -> varchar) conversion machine into an ORDER BY clause.

In 7.1beta3 I also got the next message:

Backend message type 0x44 arrived while idle
pqReadData() -- backend closed the channel unexpectedly.       This probably means the backend terminated abnormally
  before or while processing the request.
 
The connection to the server was lost. Attempting reset: Failed.

The differences between the 7.0.2 and 7.1beta3 behaviour, that
7.1beta3 doesn't like pfree() calls.

What to do? Please help if you can.

Regards, Zoltan

--                         Kov\'acs, Zolt\'an                        kovacsz@pc10.radnoti-szeged.sulinet.hu
          http://www.math.u-szeged.hu/~kovzol                        ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz
 



Re: "backend closed" --- I'd like to write a conversion function

From
Stephan Szabo
Date:
You probably should be getting core files from this.  Have you tried
recompiling with debugging and asserts on and then looking through the
core file, that might give some more information as to the details.

On Thu, 25 Jan 2001, Kovacs Zoltan wrote:

> I've got "backend closed" errors --- they seem to be indeterministic.
> I am using 7.0.2 but I tried this with 7.1beta3 as well and the error
> was similar (but not completely same).
> [...] 
> What to do? Please help if you can.