From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 3F126BB83 for ; Fri, 12 May 2006 00:05:27 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k4BM5R6N000438 for ; Fri, 12 May 2006 00:05:27 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA13307 for ; Fri, 12 May 2006 00:05:26 +0200 (MET DST) Received: from mz1.forethought.net (mzpi3.forethought.net [216.241.36.12]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k4BM5Oa0029631 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Fri, 12 May 2006 00:05:26 +0200 Received: from [216.241.35.41] (helo=[10.0.0.2]) by mz1.forethought.net with esmtp (Exim 4.51) id 1FeJHe-0007fb-Cj for caml-list@inria.fr; Thu, 11 May 2006 16:05:22 -0600 Message-ID: <4463B51F.6080807@gushee.net> Date: Thu, 11 May 2006 16:05:19 -0600 From: Matt Gushee User-Agent: Thunderbird 1.5.0.2 (X11/20060504) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] LablGTK2: problem w/ GMain.Io References: <445E4697.3010109@gushee.net> <59824.213.41.240.180.1147112751.squirrel@webmail.nerim.net> In-Reply-To: <59824.213.41.240.180.1147112751.squirrel@webmail.nerim.net> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4463B527.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4463B524.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lablgtk:01 gmain:01 andrieu:01 giochannel:01 lablgtk:01 uncaught:01 callbacks:01 re-raising:01 handler:01 stderr:01 callbacks:01 printexc:01 unix:01 unix:01 nonblock:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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/