[comp.windows.x] XIOErrorHandler

dan@watson.ibm.COM (Walt Daniels) (10/06/89)

Submitting for a friend (Walt)
Is this an IBM problem, or is it a genetic defect?
------------
I'm installing an XIOErrorHandler so that my application can do some
reasonable clean-up and shutdown if the connection to the window
fails.  (I'm running AIX/RT - latest updates to X) My XIOErrorHandler
gets control just fine when I run the client on one node and the
server on another and I kill the server.  But if I run the client and
server on the same machine and I kill the server (or cancel the
window), the default AIX SIGPIPE signal handler gets control, prints
"Broken pipe" and then exits.  My handler never gets called.  The
reason why this happens is that Xlib is writing to a pipe, and if the
pipe gets broken, the AIX SIGPIPE handler gets control and never gives
Xlib the chance to check the error code from the write and invoke the
XIOErrorHandler.  I really think that Xlib should do something with
SIGPIPE signals other than letting the default action take place.
This would allow the XIOErrorHandler (Xlib's default, or user
specified) to get invoked.  I can get around the problem by saying
"signal(SIGPIPE, SIG_IGN);" in my application, but I think this call
should be in Xlib.

I'm not totally sure why it worked for the remote case.  But I would
guess that TCP/IP (or whatever the transport mechanism is for remote
pipes) is handling SIGPIPE.

Karl Schultz
Engineering Graphics Products

cat@island.uu.net (Cathleen Greenberg) (10/14/89)

In article <100689.093908.dan@watson.ibm.com> dan@watson.ibm.COM (Walt Daniels) writes:
>Submitting for a friend (Walt)
>Is this an IBM problem, or is it a genetic defect?
>------------
> I really think that Xlib should do something with
>SIGPIPE signals other than letting the default action take place.
>This would allow the XIOErrorHandler (Xlib's default, or user
>specified) to get invoked.


To answer the question -- no it is not just IBM -- I have the same problem
on a sun 3/60 -- and I agree that Xlib should do something other than
hand over control so that the only message is broken pipe.


On a similar note -- does anyone else have problems with large Ximages??
When reading (and sometimes writing) TIFF files, I will either get
an XIO error (broken pipe) or sometimes the program quits with
no message at all.  The program handles images better on an NCD X terminal
than on a sun 3/60 -- anyone have any ideas?? Anyone else experiencing this
phenomenon??

--Cathleen Greenberg
  ...sun!island!cat
-- 
--------------------------------------------------------------------------------
Cathleen Greenberg				work: (415) 491-1000
  						sun!island!cat
  						ucbcad!island!cat                               

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (10/16/89)

    Is this an IBM problem, or is it a genetic defect?

It is a genetic defect in Unix, not X.

    I can get around the problem by saying
    "signal(SIGPIPE, SIG_IGN);" in my application, but I think this call
    should be in Xlib.

Sorry, I have to disagree.  Signals are a scarce resource, and SIGPIPE
might be used/handled by the application for other reasons.  Having Xlib
step on the signal handler would be a significant incompatible change.