Re: sqlturbo connection gets inherited
Posted in 1994
Todd Saylor writes: > I just learned something interesting about sqlturbo connections. Perhaps > this is common knowledge somewhere, but it's new to me: When a process > (an ESQL/C process, for example) begins talking to Informix, it spawns > an sqlturbo process and opens a pipe to it. 2 file descriptors are used; > one for reading and one for writing. Nothing exciting so far. > > Now, when the original process creates son processes for other reasons, > they too inherit the open pipes. This can lead to orphaned sqlturbo > processes if the parent exits/dies but the child remains. The orphaned > sqlturbo, in this case, will go away when the child process goes away. > To me, it seems dangerous that son processes begin life accidentally > connected to an sqlturbo. This could lead to additional problems if > the son tried to read/write these files. Yes, it WILL lead to problems if many child process start using the same sqlturbo. If the child process needs to deal with the database it needs to start the sqlturbo. > Has anybody else noticed this? Is there any simple solution? It would > seem that Informix could set the "close on exec" flag for the pipe fd's, > so that the open files would not be inherited. Perhaps there is some > reason one would want them inherited, but I can't think of one. > > I'm running Informix 5.01, on an IBM RS/6000, but I would guess that > this behavior is common to many or all platforms. I first ran into this with Informix 2.1 in building a network management system. A network reader would get some data and then spawn a child process to handle the data. Due to the volume of date several child process would be running a once. This worked very well when we moved all the SQL code into the child processes. The parent would get some data, spawn a child, the child would open the database and this creates a new sqlexec for each child. As long the parent does not open the database it does not start an sqlexec. Regards - Lester ############################################################################# # Lester Knutsen lester@access.digex.net # # Advanced DataTools Corporation Voice: 703-256-0267 # # Providing Informix Database Tools and Consulting # #############################################################################