Обсуждение: pg_connect dumps core
Moin, I have problems with tclsh8.3, libpgtcl.so and pg_connect. What is wrong with this simple code: load libpgtcl.so pg_connect db This gives me an Segmentation Fault and dumps core under FreeBSD 4.2. Are there known problems? Pgaccess works without any problems and communicates perfect with the db. Ich I call pg_connect with a wrong db name the function gives me an error message. I use PostgreSQL 7.0.3. Here the tclsh session: tclsh8.3 % load libpgtcl.so % pg_connect m3 Connection to database failed FATAL 1: Database "m3" does not exist in the system catalog. % pg_connect m2 Segmentation fault (core dumped) in postgresql errlog there are: FATAL 1: Database "m3" does not exist in the system catalog. pq_recvbuf: unexpected EOF on client connection Many thanks Matthias
Matthias Teege <matthias@mteege.de> writes: > tclsh8.3 > % load libpgtcl.so > % pg_connect m3 > Connection to database failed > FATAL 1: Database "m3" does not exist in the system catalog. > % pg_connect m2 > Segmentation fault (core dumped) > in postgresql errlog there are: > FATAL 1: Database "m3" does not exist in the system catalog. > pq_recvbuf: unexpected EOF on client connection Strange. Evidently it's getting as far as opening the connection (pq_recvbuf is used in the backend, not the postmaster), but then crashing after that. I can't see any reason why it would work for pgaccess but not for you. (I notice that pgaccess uses the conninfo style of arguments to pg_connect, but that shouldn't make a difference...) Can you provide a stack backtrace from the core file? regards, tom lane
Tom Lane <tgl@sss.pgh.pa.us> writes: > Strange. Evidently it's getting as far as opening the connection > (pq_recvbuf is used in the backend, not the postmaster), but then > crashing after that. I can't see any reason why it would work for > pgaccess but not for you. (I notice that pgaccess uses the conninfo > style of arguments to pg_connect, but that shouldn't make a > difference...) Hmm, I tested this one but without success. > Can you provide a stack backtrace from the core file? This one? (gdb) bt #0 0x281ca5d9 in Tcl_GetEncodingName () from /usr/local/lib/libtcl83.so #1 0x281daee4 in Tcl_CreateChannel () from /usr/local/lib/libtcl83.so #2 0x281843dd in PgSetConnectionId () from /usr/local/pgsql/lib/libpgtcl.so #3 0x28182549 in Pg_connect () from /usr/local/pgsql/lib/libpgtcl.so #4 0x805efa0 in TclInvokeStringCommand () #5 0x8079fbb in TclExecuteByteCode () #6 0x805f9f3 in Tcl_EvalObjEx () #7 0x8083a85 in Tcl_RecordAndEvalObj () #8 0x808395f in Tcl_RecordAndEval () #9 0x804b485 in StdinProc () #10 0x808a493 in Tcl_NotifyChannel () #11 0x805daf7 in FileHandlerEventProc () #12 0x804bb36 in Tcl_ServiceEvent () #13 0x804be15 in Tcl_DoOneEvent () #14 0x804b731 in Tcl_MainLoop () #15 0x804b364 in Tcl_Main () #16 0x804af5f in main () #17 0x804aea9 in _start () Many thanks Matthias -- Matthias Teege -- matthias@mteege.de -- http://emugs.de make world not war PGP-Key auf Anfrage
Tom Lane <tgl@sss.pgh.pa.us> writes: > Strange. Evidently it's getting as far as opening the connection > (pq_recvbuf is used in the backend, not the postmaster), but then > crashing after that. I can't see any reason why it would work for > pgaccess but not for you. (I notice that pgaccess uses the conninfo I have an idea an run my test script with wish8.3 and it works. No core dump. Thats the different between pgaccess and my script. With tclsh8.3 it dumps core. Looks like a "bug" in tclsh8.3? Here my test script. load libpgtcl.so proc getDBs { {host "localhost"} {port "5432"} } { # datnames is the list to be result set conn [pg_connect template1-host $host -port $port] set res [pg_exec $conn "SELECT datname FROM pg_database ORDER BY datname"] set ntups[pg_result $res -numTuples] return for {set i 0} {$i < $ntups} {incr i} { lappend datnames [pg_result $res-getTuple $i] } pg_result $res -clear pg_disconnect $conn return $datnames } getDBs Strange because I want to write I server script with tclsh and not with wish. ;-( Thanks again Matthias -- Matthias Teege -- matthias@mteege.de -- http://emugs.de make world not war PGP-Key auf Anfrage
> I have an idea an run my test script with wish8.3 and it > works. No core dump. Thats the different between pgaccess > and my script. With tclsh8.3 it dumps core. Looks like a > "bug" in tclsh8.3? > Here my test script... Good script; it works fine for me under tclsh-8.3.2 (after removing the "return" in the middle of the posted script). - Thomas
Thomas Lockhart <lockhart@alumni.caltech.edu> writes: > > I have an idea an run my test script with wish8.3 and it > > works. No core dump. Thats the different between pgaccess > > and my script. With tclsh8.3 it dumps core. Looks like a > > "bug" in tclsh8.3? > > Here my test script... > > Good script; it works fine for me under tclsh-8.3.2 (after removing the > "return" in the middle of the posted script). ;-) Sorry, pilot error. The return ist really wrong but that didnt solve my problem. I use 8.3.1. I will check out the FreeBSD archives. Maybe a bug in the port. Many thanks Matthias -- Matthias Teege -- matthias@mteege.de -- http://emugs.de make world not war PGP-Key auf Anfrage
Matthias Teege wrote: > Tom Lane <tgl@sss.pgh.pa.us> writes: > > > Strange. Evidently it's getting as far as opening the connection > > (pq_recvbuf is used in the backend, not the postmaster), but then > > crashing after that. I can't see any reason why it would work for > > pgaccess but not for you. (I notice that pgaccess uses the conninfo > > style of arguments to pg_connect, but that shouldn't make a > > difference...) > > Hmm, I tested this one but without success. > > > Can you provide a stack backtrace from the core file? > > This one? Yepp, that's what Tom meant. Tom, let me add to it that I noticed recently that libpgtcl isn't Tcl8.3 safe. It didn't went that far for me (no core dumps), but it mangled some inputs because Tcl8.3 does anything internally in UNICODE (IIRC) and the libpgtcl functions don't care for encoding. For the actual error, I cannot reproduce that with 7.0.3 and Tcl8.3 here on RedHAT 6.1. So there might be as well something wrong with his Tcl installation. Jan > > (gdb) bt > #0 0x281ca5d9 in Tcl_GetEncodingName () from /usr/local/lib/libtcl83.so > #1 0x281daee4 in Tcl_CreateChannel () from /usr/local/lib/libtcl83.so > #2 0x281843dd in PgSetConnectionId () from /usr/local/pgsql/lib/libpgtcl.so > #3 0x28182549 in Pg_connect () from /usr/local/pgsql/lib/libpgtcl.so > #4 0x805efa0 in TclInvokeStringCommand () > #5 0x8079fbb in TclExecuteByteCode () > #6 0x805f9f3 in Tcl_EvalObjEx () > #7 0x8083a85 in Tcl_RecordAndEvalObj () > #8 0x808395f in Tcl_RecordAndEval () > #9 0x804b485 in StdinProc () > #10 0x808a493 in Tcl_NotifyChannel () > #11 0x805daf7 in FileHandlerEventProc () > #12 0x804bb36 in Tcl_ServiceEvent () > #13 0x804be15 in Tcl_DoOneEvent () > #14 0x804b731 in Tcl_MainLoop () > #15 0x804b364 in Tcl_Main () > #16 0x804af5f in main () > #17 0x804aea9 in _start () > > Many thanks > Matthias > > -- > Matthias Teege -- matthias@mteege.de -- http://emugs.de > make world not war > PGP-Key auf Anfrage > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Jan Wieck <janwieck@yahoo.com> writes: > For the actual error, I cannot reproduce that with 7.0.3 and > Tcl8.3 here on RedHAT 6.1. So there might be as well > something wrong with his Tcl installation. Hmm, I will try to reproduce the error an another computer with an fresh installation of PostgreSQL and TCL. What default encoding scheme do you use with PostgreSQL. I use Latin 1. Maybe there is a problem? Is the libpgtcl under aktiv development? Many thanks Matthias -- Matthias Teege -- matthias@mteege.de -- http://emugs.de make world not war PGP-Key auf Anfrage