Re: [HACKERS] Mac OS X, PostgreSQL, PL/Tcl

From: Scott Goodwin <scott(at)scottg(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org
Subject: Re: [HACKERS] Mac OS X, PostgreSQL, PL/Tcl
Date: 2004-02-22 06:07:35
Message-ID: 68D19EFC-64FD-11D8-863F-000A95A0910A@scottg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Found the problem. If I have a very long environment variable exported
and I start PG, PG crashes when I try to load PG/Tcl. In my case I use
color ls and I have a very long LS_COLORS environment variable set.

I have duplicated the problem by renaming my .bashrc and logging back
in. With this clean environment, I started PG and loaded PG/Tcl without
any problems. I then created the following environment variable on the
command line:

LONG_VAR=aaaaaaaaaaaaaaaaaa:bbbbbbbbbbbbbbbbbbb:cccccccccccccccccc:
ddddddddddddddddddd:eeeeeeeeeeeeeeeeeee:fffffffffffffff:
ggggggggggggggggg:hhhhhhhhhhhhhhhhhhhh:iiiiiiiiiiiiiiiiiii:
jjjjjjjjjjjjjjjjjjjjj:kkkkkkkkkkkkkkkkkkkkkk:llllllllllllllllllll:
mmmmmmmmmmmmmmmmmmmmmmm:nnnnnnnnnnnnnnnnnnnnnnnnn:
ooooooooooooooooooooooo:pppppppppppppppppppppp:qqqqqqqqqqqqqqqqqqqqqqq:
rrrrrrrrrrrrrrrrrrrrrrr:ssssssssssssssssssssssssss:
ttttttttttttttttttttttttttt:uuuuuuuuuuuuuuuuuuuuuuuuu:
vvvvvvvvvvvvvvvvvvvvvv:wwwwwwwwwwwwwwwwwwwwwwwwwwwwww:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:yyyyyyyyyyyyyyyyyyyyyyyyyyyyy:
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

and exported it. (Obviously the line above is going to be broken into
multiple lines by the mailer...).

Then I stopped and restarted PG, loaded PG/Tcl and PG crashed. You
*must* stop and restart PG for the problem to exhibit itself, otherwise
it won't pick up the change in the environment. I suspect I'm running
into a buffer overflow situation.

Ok, it fails consistently when LONG_VAR is 523 characters or greater;
works consistently when LONG_VAR is 522 characters or smaller. Might
not fail at the same number for others.

/s.

To prove that this was the problem, I cleaned out my environment by
moving my .bashrc file to another name, logged out, logged in, start
On Feb 21, 2004, at 1:51 AM, Tom Lane wrote:

> Scott Goodwin <scott(at)scottg(dot)net> writes:
>> Hoping someone can help me figure out why I can't get PL/Tcl to load
>> without crashing the backend on Mac OS 10.3.2.
>
> FWIW, pltcl seems to work for me. Using up-to-date Darwin 10.3.2
> and PG CVS tip, I did
> configure --with-tcl --without-tk
> then make, make install, etc. pltcl installs and passes its regression
> test.
>
>> psql:/Users/scott/pgtest/add_languages.sql:12: server closed the
>> connection unexpectedly
>> This probably means the server terminated abnormally
>> before or while processing the request.
>
> Can you provide a stack trace for this?
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-02-22 17:21:48 Re: [HACKERS] Mac OS X, PostgreSQL, PL/Tcl
Previous Message Damon Hart 2004-02-22 03:43:36 intermittent error: 'variable not found in subplan target list' - INCOMPLETE SUBMISSION

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Brown 2004-02-22 11:57:36 Re: Too-many-files errors on OS X
Previous Message Heikki Linnakangas 2004-02-22 02:26:56 Re: Two-phase commit