Fork and standard engine problems
Posted in 1993
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
I have an application that is a daemon process. This processes opens the database and processes requests for a while. Upon some event, the process forks a child process perform some time and cpu intensive database processing. Note that no exec is done. Once the child process finishes, it simply closes the database and dies. The algorithm used to start this child process is: Parent Child parent closes database parent uses sqlexit() to terminate connection with database backend parent forks child process child opens database parent uses sqlstart() to start connection child processes database with database backend parent processes requests child closes database and dies Note that I close the database and terminate the connection with the backend before forking the child process. This works most of the time. I do however have one case where I receive an error 259 (cursor is not open) once after forking the child process when fetching a row with a cursor (in the parent process). Successive opening and fetching with the cursor work correctly. I believe that I still have a problem with the child process interfering with the parent process. Maybe something is not being cleaned up correctly before the fork. Am I missing something or should the close->sqlexit->fork->sqlstart->open call sequence work? BTW, my environment is SunOS 4.1.1, ESQL/C 4.10.UC1, SE 4.10.UC2 Thanks. -- Brett M. Bergquist, Principal Engineer | "Remind me" ... "to write an General DataComm, Inc., | "article on the compulsive reading Middlebury, CT 06762 | of news." - Stranger in a Strange Land Email: bergquis@gdc.com Voice: (203) 758-1811 ext. 7635