Re: HELP! runaway sqlexec
Posted in 1993
In article <255g3nINNa7b@emory.mathcs.emory.edu>, bill@tardis.co.uk (William Hails) writes: > > Why not hook in a C function, `on begin' in a form, or called from main > in 4gl or esql/c or whatever is appropriate which installs a catcher > for SIGHUP which in turn does an sqlexit()? On second thoughts, > shouldn't informix do this for you? Anyway: > > #include <signal.h> > void (*signal())(); > > void catcher(); > > void (*oldfunc)(); > > void init_catcher() /* called at startup - change i/f as appropriate */ > { > oldfunc = signal(SIGHUP, catcher); > } > > void catcher() > { > sqlexit(); > > if (oldfunc) > (*oldfunc)(); > } > I assume that the software already does that. There are, however, several possibilities that come to mine. We have seen lately our interface to DATAKIT [ a networking product that our users come in on] itself dies [for whatever reason]. This has caused us other problems when the user exits [like the utmp file not being cleaned up, so we still think the user is logged in]. Since this is the NORMAL parent to the user process, I assume that it has the code that signals the SIGHUP to the children. [I presume that INIT doesn't - I might be wrong, since I'm not that familiar with the internals of UNIX]. Secondly, assuming that the parent is still functioning, possibly somehow more than one SIGHUP signal is generated??? [This is pure speculation]. In that case, if I remember correctly, the SIGNAL handling immediately defaults, and the second signal would kill process. Finally, what if it's not a SGHUP, but instead, the user hits delete or quit? Again, if the signal handling code does not have an ignore at the top of the function, a second signal would kill the parent. Even if there is such a call, A SMALL WINDOW EXISTS (before the SIG_IGN takes effect) where a second signal could kill the parent process in such a case. I'm not sure of any way around this, except possibly intercept the exit call, and make sure that sqlexit is called. I'm not sure how to do that in C - code your own exit rtn? [It can easily be done in C++, since you'd just have a destructor called. Hmm, I guess you could code a simple test case, and see what it calls and use that]. Standard disclaimers apply - this is just the results of a million monkeys stiting at keyboards - I merely read the output for something useful, and post it on the net ;-) Ihor Kinal att!trumpet!ijk