Newsgroups: comp.parallel.pvm
From: erd@regent.e-technik.tu-muenchen.de (Eric.Doenges)
Subject: Re: Spawned task output (stdout, stderr) doesn't show up in log file.
Organization: Technische Universitaet Muenchen, Germany	
Date: 20 Oct 1995 08:00:18 GMT
Message-ID: <467kui$nbe@sunsystem5.informatik.tu-muenchen.de>

Ken Lancaster <ken@wynde.com> writes:

>I've also observed that, even when all the expected IO appears in the 
>log file, messages appear in the file out of order.  For example,

[example deleted]

>When a log file is created ( 30% of the time ? ), I would expect
>to see "first message from task A", followed by either "hello from
>task B" or "second message from task A", depending on which task got to 
>their respective printf statement first.

>Instead, what I find in the log file is the message from task B (the child),
>FOLLOWED BY the output from task A (the parent), i.e.

>  [task B] "hello from task B"
>  [task A] "first message from task A"
>  [task A] "second message from task A"

>Sounds improbable, but that's what I see (when it works at all).
>One thing that MAY have an effect on this is that task A is a TCL/TK
>application, and performs the steps described above in response to
>a button click.  But despite that fact, the code described above for
>task A runs from beginning to end without interruption, just like any
>ordinary snippet of C code in a typical C program, so I don't believe
>that TCL/TK is causing the problem.

>Has anyone else using PVM experienced similar difficulties ?  With or
>without TCL/TK in the picture ?

I had a similar problem - I was trying to debug my programm with the help
of log messages, and sometimes they would appear, sometimes not. The problem
was that I was using buffered IO calls like fprintf, which are - buffered !
You don't know when your data will actually be written out from the buffer
into the log file. In my case, when the programm crashed, it never made it
to the log file at all. I fixed the problem by immediatly calling fflush
after calling a buffered IO function.

>Ken Lancaster
>ken@wynde.com
>Boulder, CO  (USA)
--
                                                                          (__)
     _/_/_/ _/_/   _/_/                                                   (oo)
    _/     _/ _/  _/ _/  Eric Doenges                             /--------\/
   _/_/   _/_/   _/ _/   (erd@regent.e-technik.tu-muenchen.de)   * o|     ||
  _/     _/ _/  _/ _/                                               ||----||
 _/_/_/ _/  _/ _/_/                                              ooo~~    ~~

