Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!otello!yachaya!gongolo!peter From: peter@gongolo.SUBLINK.org (Peter Komanns) Newsgroups: comp.databases Subject: Re: INFORMIX bug? Summary: You have to do more... Keywords: informix bug 4gl Message-ID: <369@gongolo.SUBLINK.org> Date: 24 Nov 90 13:49:04 GMT References: <8330@pbhyf.PacBell.COM> <1990Nov20.221658.19496@informix.com> <8335@pbhyf.PacBell.COM> Lines: 39 In article <8335@pbhyf.PacBell.COM>, jwas@PacBell.COM (Joe Wasik) writes: > In article <1990Nov20.221658.19496@informix.com> markj@informix.com (Mark Jeske(Chicago Consultan)t) writes: > >>In our case, since the Informix-4GL application starts up > >>other background jobs, the sqlexec program hangs around until those other jobs > >>are finished and it then interferes with the logoff process. > > >I would try the following in your code before you exit. > > > > close database > > call sqlexit() > > While I admit I hadn't even considered doing a close, it's now been tried > and unfortunately it doesn't work. > > In fact, the sqlexit() function also appears to wait. It seems to be waiting > for confirmation that sqlexec back-end has died. It doesn't get it, so the > program hangs at the sqlexit() function. An interrupt allows it to continue, > but without killing the sqlexec back-end. The back-end processor "sqlexec" uses a pipe() call to be activated, and uses two SHORT variables, called "_sqlpin" and "_sqpout". In order to properly close the piping process you have to manage these file (pipe) descriptors. In fact, the same error ( sqlexec doesn't want to die ) occurs when: - you fork() your process and want the father to exit - you exec() another SQL based process - you system() another SQL process in the background ("&" at the end of the command). I fixed this bug using fcntl() and setting the close-on-exec flag for both the pipe descriptors above AND using sqlexit(), and all works correctly. Those two extern (global) variables aro undocumented, of course. **************************************************************************** Peter Komanns - SINDATA srl - Vimercate - ITALY Phone (voice) +39,39,6083733 (fax)+39,39,60,83,957 SUBLINK:peter@cucciolo BANG:.!rutgers!deejay!yachaya!gongolo!cucciolo!peter ****************************************************************************