Re: I-SE and I-4GL RDS technical question
Posted in 1996
>From: laci@informix.opensoft.kfki.hu >Date: Tue, 20 Feb 1996 09:42:40 +0100 >X-Informix-List-Id: <news.21384> > >I have some important questions. >The situation : > An fglgo process runs a 4GL program that started a transaction > and executed an UPDATE statement within it. > The server process is sqlexec (I-SE). > Both processes run on the same UNIX machine and communicate with > each other via pipes. >Questions : > 1) Could the fglgo process catch the SIGTERM or SIGINT signal > or I can only stop it with the SIGKILL ? The fglgo process should catch SIGINT if you have done DEFER INTERRUPT but you will need to check INT_FLAG in your code. It should stop on receipt of SIGTERM, but not all versions do this -- if they do not stop, they ignore the signal completely. You may be able to override this if you call C code to install your own SIGTERM handler, but then again, the code may reinstate its own handler every so often (ie, it might not work). > 2) Can the sqlexec process observe in all possible situations > that his parent fglgo process has been stopped prematurely and > rollback the uncommitted transaction or could it be orphaned and the > started transaction won't be rolled back? The sqlexec process connected via a pipe on the local machine knows that the parent process has died because it reads zero bytes from the pipe. At that point, it rolls back the current transaction and exits. > What is the difference > in this respect if the processes run on different UNIX machines > communicating via TCP/IP ? If the sqlexec is really on another machine, there is actually an intermediate process (typically sqlexec or sqlrm) on the local machine connected to the fglgo by a pipe. This process should notice the absence of its parent because it reads zero bytes from a pipe (or writes on a pipe and gets a SIGPIPE because there is no process to read from the pipe), and it will then close up shop, rolling back the current transaction. > 3) In which situations could the sqlexec process be orphaned exactly if > there are any ? I believe there are circumstances under which the sqlexec process can get orphaned but be unaware of it if the remote machine is a PC and the PC is switched off. However, I may be getting confused with the behaviour of older versions of fglgo which didn't notice that their standard input was closed and went into a tight loop trying to read data from a file descriptor which had no data to give. That has been fixed in more recent (4.14/6.02, I think) versions. > Is there any way to stop an orphaned sqlexec process > so that the started transaction be rolled back ? You can try sending it signals, but be very cautious. Start with the simpler ones (SIGINT, SIGQUIT, SIGTERM, SIGHUP, SIGPIPE). Do not send SIGKILL to an sqlexec process. If you do, it will die, but its transaction will not be rolled back. >Thanks for advance ! > >Gabor (bloyd@informix.opensoft.kfki.hu) Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>