Thread: psql 7.3.1 crash

psql 7.3.1 crash

From
Tilo Schwarz
Date:
First of all a big THANK YOU to all out there making PostgreSQL possible!
Especially the new features in 7.3 (drop column, schema and the new
constraint handling) make life easier.

Now to my problem:
Short version: I was able to crash psql repeatedly using the \e command and
EDITOR=gnuclient

Long version:
I have a 7.3.1 setup which look normal (to me):

postgres@rtulmx0101 pgsql_data > uname -a
Linux rtulmx0139 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown

postgres@rtulmx0101 pgsql_data > pg_config --configure
'--prefix=/usr/local' '--enable-debug' '--with-cassert' '--with-tcl'
'--with-perl' '--with-python' '--with-pam' '--with-openssl'

postgres@rtulmx0101 pgsql_data > pg_config --version
PostgreSQL 7.3.1

postgres@rtulmx0101 pgsql_data > pg_controldata
pg_control version number:            72
Catalog version number:               200211021
Database cluster state:               in production
pg_control last modified:             Thu Jan 23 13:36:50 2003
Current log file ID:                  0
Next log file segment:                4
Latest checkpoint location:           0/34B2748
Prior checkpoint location:            0/33A026C
Latest checkpoint's REDO location:    0/34B2748
Latest checkpoint's UNDO location:    0/0
Latest checkpoint's StartUpID:        23
Latest checkpoint's NextXID:          188402
Latest checkpoint's NextOID:          221689
Time of latest checkpoint:            Thu Jan 23 13:36:47 2003
Database block size:                  8192
Blocks per segment of large relation: 131072
Maximum length of identifiers:        64
Maximum number of function arguments: 32
Date/time type storage:               Floating point
Maximum length of locale name:        128
LC_COLLATE:                           C
LC_CTYPE:                             C

Now, if I do
postgres@rtulmx0101 pgsql_data > export EDITOR=gnuclient

and then
postgres> psql
Welcome to psql 7.3.1, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

SET       (the SET comes from setting the search_path in my startup file)
tschwarz=# \e
tschwarz=# SELECT * fSegmentation fault (core dumped)

That was the last I got while pressing <TAB> to complete the 'f' to 'from'.

gdb sais this:

> gdb /usr/local/bin/psql core
GNU gdb 5.1.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-suse-linux"...
Core was generated by `psql'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/libpq.so.3...done.
Loaded symbols for /usr/local/lib/libpq.so.3
Reading symbols from /lib/libpam.so.0...done.
Loaded symbols for /lib/libpam.so.0
Reading symbols from /usr/lib/libssl.so.0.9.6...done.
Loaded symbols for /usr/lib/libssl.so.0.9.6
Reading symbols from /usr/lib/libcrypto.so.0.9.6...done.
Loaded symbols for /usr/lib/libcrypto.so.0.9.6
Reading symbols from /lib/libz.so.1...done.
Loaded symbols for /lib/libz.so.1
Reading symbols from /lib/libreadline.so.4...done.
Loaded symbols for /lib/libreadline.so.4
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libncurses.so.5...done.
Loaded symbols for /lib/libncurses.so.5
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /lib/libnss_nis.so.2...done.
Loaded symbols for /lib/libnss_nis.so.2
Reading symbols from /lib/libnss_dns.so.2...done.
Loaded symbols for /lib/libnss_dns.so.2
#0  0x40280d8d in chunk_free () from /lib/libc.so.6
(gdb) bt
#0  0x40280d8d in chunk_free () from /lib/libc.so.6
#1  0x40280c53 in free () from /lib/libc.so.6
#2  0x08059cb2 in psql_completion (text=0x80717d8 "tr", start=14, end=16) at
tab-complete.c:863
#3  0x40172142 in gen_completion_matches () from /lib/libreadline.so.4
#4  0x401731c3 in rl_complete_internal () from /lib/libreadline.so.4
#5  0x4017191f in rl_complete () from /lib/libreadline.so.4
#6  0x4016b30e in _rl_dispatch () from /lib/libreadline.so.4
#7  0x4016b00b in readline_internal_char () from /lib/libreadline.so.4
#8  0x4016b105 in readline_internal_charloop () from /lib/libreadline.so.4
#9  0x4016b13c in readline_internal () from /lib/libreadline.so.4
#10 0x4016ac56 in readline () from /lib/libreadline.so.4
#11 0x0804edae in gets_interactive (prompt=0x8068f40 "tschwarz=# ") at
input.c:54
#12 0x0804f832 in MainLoop (source=0x4032bd20) at mainloop.c:185
#13 0x08051662 in main (argc=1, argv=0xbffff024) at startup.c:299
#14 0x402299ed in __libc_start_main () from /lib/libc.so.6
(gdb)

Now I tried with EDITOR=vi ... no problem.

Then I tried again with EDITOR=gnuclient, this time I got:

> export EDITOR=gnuclient
> psql
Welcome to psql 7.3.1, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

SET
tschwarz=# \e     <typing a query in gnuclient/xemacs, then pressing DONE,
SAVE>
Segmentation fault (core dumped)

The result of the query was shown correctly, but when I hit 'q', psql dumped
core. You can see the query in the backtrace below:

> gdb /usr/local/bin/psql core
GNU gdb 5.1.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-suse-linux"...
Core was generated by `psql'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/libpq.so.3...done.
Loaded symbols for /usr/local/lib/libpq.so.3
Reading symbols from /lib/libpam.so.0...done.
Loaded symbols for /lib/libpam.so.0
Reading symbols from /usr/lib/libssl.so.0.9.6...done.
Loaded symbols for /usr/lib/libssl.so.0.9.6
Reading symbols from /usr/lib/libcrypto.so.0.9.6...done.
Loaded symbols for /usr/lib/libcrypto.so.0.9.6
Reading symbols from /lib/libz.so.1...done.
Loaded symbols for /lib/libz.so.1
Reading symbols from /lib/libreadline.so.4...done.
Loaded symbols for /lib/libreadline.so.4
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libncurses.so.5...done.
Loaded symbols for /lib/libncurses.so.5
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /lib/libnss_nis.so.2...done.
Loaded symbols for /lib/libnss_nis.so.2
Reading symbols from /lib/libnss_dns.so.2...done.
Loaded symbols for /lib/libnss_dns.so.2
#0  0x40280d8d in chunk_free () from /lib/libc.so.6
(gdb) bt
#0  0x40280d8d in chunk_free () from /lib/libc.so.6
#1  0x40280c53 in free () from /lib/libc.so.6
#2  0x08055206 in printQuery (result=0x807a188, opt=0x80691b0,
fout=0x4032bea0) at print.c:1158
#3  0x0804e114 in SendQuery (query=0x8074e40 "select * from trace;") at
common.c:433
#4  0x0804fe42 in MainLoop (source=0x4032bd20) at mainloop.c:433
#5  0x08051662 in main (argc=1, argv=0xbffff024) at startup.c:299
#6  0x402299ed in __libc_start_main () from /lib/libc.so.6
(gdb)

BTW, the postmaster logfile said something like "unexpected EOF from client",
but I can't remember correctly.

Any ideas?

Regards,

    Tilo

Re: psql 7.3.1 crash

From
Tom Lane
Date:
Tilo Schwarz <mail@tilo-schwarz.de> writes:
> Short version: I was able to crash psql repeatedly using the \e command and
> EDITOR=gnuclient

Fixed for 7.3.2 --- thanks for the report.  If you need the patch today,
it's a silly 2-character change; see
http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/psql/command.c

            regards, tom lane

Re: psql 7.3.1 crash

From
"Shridhar Daithankar"
Date:
On 24 Jan 2003 at 0:25, Tom Lane wrote:

> Tilo Schwarz <mail@tilo-schwarz.de> writes:
> > Short version: I was able to crash psql repeatedly using the \e command and
> > EDITOR=gnuclient
>
> Fixed for 7.3.2 --- thanks for the report.  If you need the patch today,
> it's a silly 2-character change; see
> http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/psql/command.c

Is that cvsweb.cgi a readymade package? It is cooler than anything I have ever
seen i.e between CVS command line and HP softcm only..

Bye
 Shridhar

--
QOTD:    "Don't let your mind wander -- it's too little to be let out alone."


Re: psql 7.3.1 crash

From
Tom Lane
Date:
"Shridhar Daithankar" <shridhar_daithankar@persistent.co.in> writes:
>> Fixed for 7.3.2 --- thanks for the report.  If you need the patch today,
>> it's a silly 2-character change; see
>> http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/psql/command.c

> Is that cvsweb.cgi a readymade package? It is cooler than anything I have ever
> seen i.e between CVS command line and HP softcm only..

I believe so --- gnu.org and redhat both use interfaces that look really
similar to this, and probably are just slightly different releases of
the same code.  Try searching freshmeat for "cvsweb".

            regards, tom lane

OT: cvsweb (was: psql 7.3.1 crash)

From
Ian Barwick
Date:
On Friday 24 January 2003 16:25, Tom Lane wrote:
> "Shridhar Daithankar" <shridhar_daithankar@persistent.co.in> writes:
> >> Fixed for 7.3.2 --- thanks for the report.  If you need the patch today,
> >> it's a silly 2-character change; see
> >> http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/psql/com
> >>mand.c
> >
> > Is that cvsweb.cgi a readymade package? It is cooler than anything I have
> > ever seen i.e between CVS command line and HP softcm only..
>
> I believe so --- gnu.org and redhat both use interfaces that look really
> similar to this, and probably are just slightly different releases of
> the same code.  Try searching freshmeat for "cvsweb".

http://www.freebsd.org/projects/cvsweb.html

It's basically a single Perl CGI script. You may have to edit the
script a little but it's otherwise simple to install.

Ian Barwick
barwick@gmx.net


Re: OT: cvsweb (was: psql 7.3.1 crash)

From
Mikhail Terekhov
Date:
Take a look at

http://viewcvs.sourceforge.net/

Mikhail


Ian Barwick wrote:
> On Friday 24 January 2003 16:25, Tom Lane wrote:
>
>>"Shridhar Daithankar" <shridhar_daithankar@persistent.co.in> writes:
>>
>>>>Fixed for 7.3.2 --- thanks for the report.  If you need the patch today,
>>>>it's a silly 2-character change; see
>>>>http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/psql/com
>>>>mand.c
>>>
>>>Is that cvsweb.cgi a readymade package? It is cooler than anything I have
>>>ever seen i.e between CVS command line and HP softcm only..
>>
>>I believe so --- gnu.org and redhat both use interfaces that look really
>>similar to this, and probably are just slightly different releases of
>>the same code.  Try searching freshmeat for "cvsweb".
>
>
> http://www.freebsd.org/projects/cvsweb.html
>
> It's basically a single Perl CGI script. You may have to edit the
> script a little but it's otherwise simple to install.
>
> Ian Barwick
> barwick@gmx.net