Odd program behaviour - Mailing list pgsql-interfaces
From | James Thompson |
---|---|
Subject | Odd program behaviour |
Date | |
Msg-id | Pine.GSO.4.05.9903071657210.22421-100000@noether.math.ksu.edu Whole thread Raw |
In response to | ECPG & 'exec sql connect to' question ("Pavel PaJaSoft Janousek" <janousek@fonet.cz>) |
Responses |
Re: [INTERFACES] Odd program behaviour
|
List | pgsql-interfaces |
I'm desperate here. I've got two days invested in this and have not made any progress at all. I'm hoping someone has run into the following and might be able to give me a clue. I have a a bunch of C functions that access the database via ecpg. I have used SWIG to wrap these functions so that they may used in TCL/TK I have the front end written in TCL/TK. Everything works fine when saving data but pulling data from the database results in a segfault when using the TCL/TK front end. The same functions work fine when called from a C test program. In addition the customer_create function listed in the backtrace is used alot in the front end without problems. It only seems to bomb when I'm actively fetching data from the database. A backtrace on the core file gives me this. #0 0x40248090 in ?? () from /lib/libc.so.6 #1 0x40247fa5 in ?? () from /lib/libc.so.6 #2 0x804ec5a in obmalloc (size=84) at memory.c:28 #3 0x804c896 in customer_create () at customer.ec:73 #4 0x8049ce2 in packet_create () at packet.ec:78 #5 0x804c475 in packet_query (object=0x80ecb60) at packet.ec:795 #6 0x80512c2 in _wrap_packet_query (clientData=0x0, interp=0x8058d~b8, objc=2, objv=0x8059a48) at obe_wrap.c:1818 #7 0x400ca467 in ?? () from /usr/local/lib/libtcl.so Now I'm fairly new to gdb but this looks like it's dying inside the obmalloc which is simply... obmalloc(size_t size) { void *tmp; assert(size!=0); tmp = malloc(size); while (tmp == NULL) { fprintf(stderr, "obmalloc: memory exhausted. 2 second delay before retry"); sleep(2); tmp = malloc(size); } return tmp; } I'm at the point that I can't think straight anymore. Does anyone have a suggestion on why the code would work correctly from C but not TCL? Oh, and if you wan't more info on what I'm trying to do visit www.math.ksu.edu/~jamest/obe I'd be willing to move the code up now if anyone wants to look at it. I've mangled it up enough this weekedn it's probably good for a laugh. Thanks in advance for any ideas you can provide. ->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-< James Thompson 138 Cardwell Hall Manhattan, Ks 66506 785-532-0561 Kansas State University Department of Mathematics ->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
pgsql-interfaces by date: