caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Matt Gushee <matt@gushee.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] LablGTK2: problem w/ GMain.Io
Date: Thu, 11 May 2006 16:05:19 -0600	[thread overview]
Message-ID: <4463B51F.6080807@gushee.net> (raw)
In-Reply-To: <59824.213.41.240.180.1147112751.squirrel@webmail.nerim.net>

Olivier Andrieu wrote:

 >> and daemon modes with no apparent problems. On the second box, normal
 >> mode works fine; the app will also run in daemon mode. But when I
 >> attempt to send a command to the app in daemon mode, I get the following
 >> error message:
 >>
 >>   ** (bantam.bin:13244): CRITICAL **: GIOChannel watch: callback 
raised \
 >>      an exception
 >
 > That's because your callback raised an exception (!). LablGTK traps
 > uncaught exceptions from callbacks instead of re-raising them and exiting
 > the main  loop. For signals, there is a user-overridable handler that
 > simply prints the exception name to stderr ; for other types of callbacks
 > (IO watches, timeouts, etc.) you simply get this error message.
 >
 > In your code you should wrap your "watcher" function in a try...with 
block
 > and print the exception using Printexc.to_string to see what's going
 > wrong.

Thanks for the tip ... I suppose I should have thought of it myself.

Anyway, I seem to have solved the problem ... I had:

   msg_fd <-
     Unix.openfile msg_pipe [Unix.O_RDONLY; Unix.O_NONBLOCK] 0o600;

Apparently the file descriptor should *not* be opened in non-blocking 
mode (is that really so obvious that it doesn't need to be documented 
anywhere??). But I'm still puzzled, because the behavior was very 
inconsistent: it worked on one box but not another--though perhaps the 
difference in GTK versions would account for that. What was really 
strange, though, was that if I attempted to display the GUI in the 
normal way, i.e. with the command

   $ bantam -s

'bantam' being a shell script which, given the '-s' option, does the 
following:

   echo '%show' > ${TMPDIR}/bantam-${USER}/message.pipe

(which in my case resolves to

   echo '%show' > /tmp/bantam-matt/message.pipe

) --this caused the I/O error. Yet, if invoked the same 'echo' command 
directly in an interactive shell (in this case, bash running in an 
rxvt), it never caused the error. Why on earth would that be, I wonder?

-- 
Matt Gushee
The Reluctant Geek: http://matt.gushee.net/rg/


  reply	other threads:[~2006-05-11 22:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-07 19:12 Matt Gushee
2006-05-08 18:25 ` [Caml-list] " Olivier Andrieu
2006-05-11 22:05   ` Matt Gushee [this message]
2006-05-11 23:13     ` Matthew Hannigan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4463B51F.6080807@gushee.net \
    --to=matt@gushee.net \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).