From: Chris van Engelen (cvengel@hzsbg01.lucent.com) Subject: Re: xemacs not dying on logout Newsgroups: comp.emacs.xemacs View: Complete Thread (11 articles) | Original Format Date: 1997/09/10 [Posted and mailed] In article , fjo@nada.kth.se (Fredrik Jönsson) writes: > The main problem is that in some cases xemacs 20.* won't catch > the fact that the Xsession has died, but remains and eat pretty > much all if the cpu. We noticed this behaviour with fvwm, but > now also with CDE, in both cases on solaris 2.5.1. I have had exactly the same problem with XEmacs under OpenWindows, CDE, fvwm, fvwm2, and fvwm95, from the very first version which I started using (19.12), up until the version of XEmacs I'm currently using (19.14). The only way to solve the problem is to patch function x_IO_error_handler in file device-x.c. Attached to this mail is my patch to this function for XEmacs 19.14, but I'm sure it is still valid for XEmacs 19.15 and 20.x. I have reported this problem to this newsgroup with XEmacs 19.12 and with XEmacs 19.13 (see the DejaNews server, and check for the keywords "engelen xemacs", and have sent mails to Ben Wing about this, but the XEmacs providers seem to think that this is not a very big problem, and have sofar not provided a solution. This is the patch to file device-x.c, the additional lines are indicated by the comment starting with my initials (CvE). It's just a very simple check on errno being equal to EPIPE, which indicates that the X-server has gone down: int x_IO_error_handler (Display *disp) { /* This function can GC */ Lisp_Object dev; struct device *d = get_device_from_display (disp); XSETDEVICE (dev, d); if (NILP (find_nonminibuffer_frame_not_on_device (dev))) { /* We're going down. */ stderr_out ("\n%s: Fatal I/O Error %d (%s) on display connection \"%s\"\n", (STRINGP (Vinvocation_name) ? (char *) string_data (XSTRING (Vinvocation_name)) : "xemacs"), errno, strerror (errno), DisplayString (disp)); stderr_out (" after %lu requests (%lu known processed) with %d events remaining.\n", NextRequest (disp) - 1, LastKnownRequestProcessed (disp), QLength (disp)); /* assert (!_Xdebug); */ } else { warn_when_safe (Qx, Qcritical, "I/O Error %d (%s) on display connection \"%s\"\n" " after %lu requests (%lu known processed) with " "%d events remaining.\n", errno, strerror (errno), DisplayString (disp), NextRequest (disp) - 1, LastKnownRequestProcessed (disp), QLength (disp)); } enqueue_magic_eval_event (io_error_delete_device, dev); /* CvE, July 16, 1996, XEmacs 19.14 */ /* Test for broken pipe error, which indicates X-server has gone down */ if ( errno == EPIPE ) { /* Most probably X-server has gone down: Avoid infinite loop by just exciting */ stderr_out( "\n\nXEmacs exiting on broken pipe (errno %d, %s)\n", errno, strerror( errno ) ); exit( 1 ); } return 0; } Good luck, -- Chris van Engelen ---------------------------------------------------------------------- | Lucent Technologies Phone : +31 35 687 4913 | | Network Systems Group Fax : +31 35 687 5964 | | Network Operations, Transport & Access E-mail: engelen@lucent.com | | Huizen, The Netherlands | ---------------------------------------------------------------------- The last good thing written in C was Schubert's Symphony No. 9 --------------------------------------------------------------------------------