"backend closed" --- I'd like to write a conversion function - Mailing list pgsql-hackers

From Kovacs Zoltan
Subject "backend closed" --- I'd like to write a conversion function
Date
Msg-id Pine.LNX.4.21.0101252150160.13596-100000@pc10.radnoti-szeged.sulinet.hu
Whole thread Raw
Responses Re: "backend closed" --- I'd like to write a conversion function
List 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@pc10.radnoti-szeged.sulinet.hu
          http://www.math.u-szeged.hu/~kovzol                        ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz
 



pgsql-hackers by date:

Previous
From: Frank Joerdens
Date:
Subject: Re: beta3 Solaris 7 (SPARC) port report [ Was: Looking for . . . ]
Next
From: ncm@zembu.com (Nathan Myers)
Date:
Subject: Re: beta3 Solaris 7 (SPARC) port report