Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!nsc!pyramid!eric From: eric@pyramid.pyramid.com (Eric Bergan) Newsgroups: comp.windows.x Subject: Re: Xlib not seeing net connection drop? Message-ID: <75030@pyramid.pyramid.com> Date: 25 Jun 89 17:47:45 GMT References: <8906251323.AA27600@Larry.McRCIM.McGill.EDU> Reply-To: eric@pyramid.pyramid.com (Eric Bergan) Organization: Pyramid Technology Corp., Mountain View, CA Lines: 53 In article <8906251323.AA27600@Larry.McRCIM.McGill.EDU> mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) writes: >I'm seeing a strange problem which appears to be something strange in >the guts of Xlib, or (perhaps) my failure to notice something buried >somewhere in the Xlib documentation. > >When killing xinit's distinguished client (it's one I wrote expressly >for the purpose of being xinit's distinguished client), I will >sometimes later see mterms (always on other machines) running in the >background soaking up as much cpu as UNIX is willing to give them, >clearly in infinite loops, left over from the X session. > >Taking core dumps (with "kill -STOP" and "gcore") revealed that the >infinite loop is in the code that reads from the pty and the X >connection. This code looks roughly like this: > > while (1) > { if (XQLength(disp) > 0) > { read events and act on them > } > choose a timeout for the select - see below > call select() on the pty and XConnectionNumber(disp) > if (the select timed out) > { if (the window needs updating) update it > if (there might be stuff to flush to the X server) > { XSync(disp,False); /* see below */ > } > continue; > } > if (select indicates something on the X connection) > { XEventsQueued(disp,QueuedAfterReading); > continue; > } > if (select indicates something on the pty) > { handle stuff on the pty > } > } xperfmon seems to suffer from the same problem. The select down in the Xlib is not reacting properly to the EOF and instead, just ends up looping, doing lots of select()'s. The problem may be with any application that tries to do select()s on the same fd's that the Xlib is using. Has anyone come up with a workaround (or fix) for either Xlib or xperfmon? eric ...!pyramid!eric -- eric ...!pyramid!eric