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

From: Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: "backend closed" --- I'd like to write a conversion function
Date: 2001-01-25 20:51:58
Message-ID: Pine.LNX.4.21.0101252150160.13596-100000@pc10.radnoti-szeged.sulinet.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu
http://www.math.u-szeged.hu/~kovzol
ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martin A. Marques 2001-01-25 21:14:43 Talking about Solaris 7
Previous Message Frank Joerdens 2001-01-25 20:47:16 Re: beta3 Solaris 7 (SPARC) port report [ Was: Looking for . . . ]