![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
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 |
#2
| |||
| |||
|
|
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. |
#3
| |||
| |||
|
|
Scott Goodwin <scott (AT) scottg (DOT) net> writes: 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. Interesting. Did you check whether the limiting factor is the longest variable length, or the total size of the environment? ("env|wc" would probably do as an approximation for the latter.) regards, tom lane |
#4
| |||
| |||
|
|
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. |
#5
| |||
| |||
|
|
Scott Goodwin <scott (AT) scottg (DOT) net> writes: 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 was able to duplicate this. I am not entirely sure why the problem is dependent on the environment size, but I now know what causes it. It seems Darwin's libc keeps its own copy of the argv pointer, and when we move argv and then scribble on the original, it causes problems for subsequent code that tries to look at argv[0] to determine the executable's location. (It's a good thing Darwin is open source, 'cause I'm not sure we'd have ever seen the connection if we hadn't been able to look at the source code for their libc.) The fix is basically + #if defined(__darwin__) + #include <crt_externs.h + #endif + #if defined(__darwin__) + *_NSGetArgv() = new_argv; + #endif which you can stick into main.c if you need a workaround. I applied a more extensive patch to HEAD that refactors this code into ps_status.c, but I'm disinclined to apply that patch to stable branches... regards, tom lane |
#6
| |||
| |||
|
|
I'll grab the CVS PG copy and try it out. Is this something the Darwin folks should be notified about? It might cause problems with other apps. |
![]() |
| Thread Tools | |
| Display Modes | |
| |