Re: Strange \copy failure

From: Steve Woodcock <swoodcock(at)scholastic(dot)co(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Strange \copy failure
Date: 2001-06-21 08:18:36
Message-ID: m3zob2mejn.fsf@soitsrv03.southam.sch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> That is strange. Try attaching to the hung backend with gdb and getting
> a backtrace, viz:
>
> gdb /path/to/postgres-executable
> gdb> attach PID-of-backend-process
> gdb> bt
> gdb> quit
>
> Might also be a good idea to do similarly for the psql process, in case
> that's where the problem is.
>
> regards, tom lane

(You'll notice I've upgraded to 7.1.2 (PGDG RPMS))

This is the backend:

[root(at)soitsrv03 /root]# gdb /usr/bin/postgres
GNU gdb 19991004
Copyright 1998 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-redhat-linux"...(no debugging symbols found)...
(gdb) attach 21499
Attaching to program: /usr/bin/postgres, Pid 21499
Reading symbols from /usr/lib/libssl.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libcrypto.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libz.so.1...(no debugging symbols found)...done.
Reading symbols from /lib/libcrypt.so.1...done.
Reading symbols from /lib/libresolv.so.2...done.
Reading symbols from /lib/libnsl.so.1...done.
Reading symbols from /lib/libdl.so.2...done.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /usr/lib/libreadline.so.3...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
Reading symbols from /lib/libtermcap.so.2...done.
Reading symbols from /usr/lib/gconv/ISO8859-1.so...done.
Reading symbols from /lib/libnss_files.so.2...done.
0x4025fc62 in __libc_send () from /lib/libc.so.6
(gdb) bt
#0 0x4025fc62 in __libc_send () from /lib/libc.so.6
#1 0x80c7ea2 in pq_flush ()
#2 0x8139092 in elog ()
#3 0x80a849c in DoCopy ()
#4 0x80a7fba in DoCopy ()
#5 0x80a751f in DoCopy ()
#6 0x80fe500 in ProcessUtility ()
#7 0x80fca25 in pg_exec_query_string ()
#8 0x80fdab6 in PostgresMain ()
#9 0x80e8035 in PostmasterMain ()
#10 0x80e7c1c in PostmasterMain ()
#11 0x80e6e77 in PostmasterMain ()
#12 0x80e6826 in PostmasterMain ()
#13 0x80c89fe in main ()
#14 0x401c59cb in __libc_start_main (main=0x80c8890 <main>, argc=3, argv=0xbffffb44, init=0x8065a78 <_init>,
fini=0x8145f2c <_fini>, rtld_fini=0x4000aea0 <_dl_fini>, stack_end=0xbffffb3c) at ../sysdeps/generic/libc-start.c:92
(gdb) quit
The program is running. Quit anyway (and detach it)? (y or n) y
Detaching from program: /usr/bin/postgres, Pid 21499

This is psql:

[root(at)soitsrv03 /root]# gdb `which psql`
GNU gdb 19991004
Copyright 1998 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-redhat-linux"...(no debugging symbols found)...
(gdb) attach 21498
Attaching to program: /usr/bin/psql, Pid 21498
Reading symbols from /usr/lib/libpq.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libssl.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libcrypto.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libz.so.1...(no debugging symbols found)...done.
Reading symbols from /lib/libcrypt.so.1...done.
Reading symbols from /lib/libresolv.so.2...done.
Reading symbols from /lib/libnsl.so.1...done.
Reading symbols from /lib/libdl.so.2...done.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /usr/lib/libreadline.so.3...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
Reading symbols from /lib/libtermcap.so.2...done.
Reading symbols from /lib/libnss_files.so.2...done.
0x4026b15e in __select () from /lib/libc.so.6
(gdb) bt
#0 0x4026b15e in __select () from /lib/libc.so.6
#1 0x4002487c in ?? () from /usr/lib/libpq.so.2
#2 0x4001e0ff in pqFlush () from /usr/lib/libpq.so.2
#3 0x4001c8b9 in PQendcopy () from /usr/lib/libpq.so.2
#4 0x804fc91 in strcpy () at ../sysdeps/generic/strcpy.c:30
#5 0x804f9ae in strcpy () at ../sysdeps/generic/strcpy.c:30
#6 0x804a822 in strcpy () at ../sysdeps/generic/strcpy.c:30
#7 0x804a52e in strcpy () at ../sysdeps/generic/strcpy.c:30
#8 0x804f150 in strcpy () at ../sysdeps/generic/strcpy.c:30
#9 0x80502b6 in strcpy () at ../sysdeps/generic/strcpy.c:30
#10 0x401d69cb in __libc_start_main (main=0x804fcc0 <strcpy+22720>, argc=1, argv=0xbffffae4, init=0x8049be0 <_init>,
fini=0x805797c <_fini>, rtld_fini=0x4000aea0 <_dl_fini>, stack_end=0xbffffadc) at ../sysdeps/generic/libc-start.c:92

This may be relevant: when I C-z the psql session and 'kill %p', psql
terminates and the backend continues copying records from line
841... and copies to the end. Subsequently (in a new psql session) I
can see all the records have been loaded properly.

Hope this helps.

Regards, Steve Woodcock

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-06-21 14:02:12 Re: Strange \copy failure
Previous Message 楊 慧泉 2001-06-21 05:45:59 about createdb err