esql/c v5, sqlexec problem followup
Posted in 1995
Topics: Installation, Setup & Upgrades, Connectivity: ESQL/C, 4GL & Embedded SQL
I posted with a problem before : > SCO UNIX 3.2v4.2 platform, SE & esql/c v5. I have a program that > connects to the database (thereby forking off sqlexec) and then > forks & execs a different program which also connects to the database. > > The problem is when the parent process closes the database and exits, > the parent process exits, but sqlexec does not. It will exit when the > child process dies. It hangs even if the child process doesn't connect > to the database. Um, no prepare statements, if that might make a > difference, all embedded and it (apparently) works otherwise. Well, if there is anyone interested, this is what ended up happening: I tried having my child set its own process group and fork again. This seemed to let the parent process exit okay, but the intermediate process hung around as a <defunct> process. So I installed a SIGCHLD signal handler that did a waitpid. Worked fine. Great. Then I put an sqlexit after my close database because that's what the third party software we're using does. It immediately hung at the sqlexit. I uninstalled the signal handler, it was fine. But then I still had the <defunct> processes. After much experemnetation, it looks like if I just close all file descriptors up to OPEN_MAX as one of the very first things in the child program, everything is fine. My best guess is that somehow it gets hung up onm the pipes that get dup'ed when child processes are forked. I'm not completely satisfied with this explanation though, since forking twice shouldn't get rid of this problem. And since all the closes on all the file descriptors fail. All of them. (I don't close stdin stdout or stderr). When I called support, dude didn't know what a signal was. When I started to explain it to him he said I would have to call the OS vendor for support. After explaining part of his job to him he asked for the signal handler function. I told him I could just tell him, since it was one line. I read it to him, my function returned an int. So after I read it to him (int sigchld_handler(int sig) { waitpid(-1, NULL, WNOHANG); return; }) I tilod him it should probably be a void function. He thought I meant to replace the word "return" with the word "void". He also asked me when I called the signal handler. The support person knew neither the platform or the LANGUAGE he was supporting. I was appalled. He hasn't gotten back to me yet either, I got to this point on my own. Is their support ALWAYS this horrible? Thanks for your help. fleur -- Fleur Diana Dragan / fleur@clark.net -- It's my name. Really, it is. Belly dancers make favorite wives.