Re: [ROOT] fgets oddity

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Wed Jul 18 2001 - 17:48:47 MEST


Hi Jiri,

  I've applied your patch. Thanks.

Cheers, Fons.



Jiri Masik wrote:
> 
> Hi,
> 
> I suggest the following modification to TUnixSystem.cxx. It should
> cause interrupted system calls (by means of signals) to be resumed.
> cheers
>         Jiri
> 
>   --------------------------------------------------------------------------------
>                           Name: TUnixSystem.diff
>    TUnixSystem.diff       Type: text/x-patch
>                    Description: SA_RESTART
> 
>   --------------------------------------------------------------------------------
> 
> Jiri Masik <Jiri.Masik@cern.ch> writes:
> 
> > Hi Fons,
> >
> > maybe it is related to the signal handling in Root. Could you explain
> > what should happen on SIGCHLD? The problem seems to disappear when I
> > comment SIGCHLD record from the gSignalMap in TUnixSystem.cxx.
> >
> >       Jiri
> >
> > Fons Rademakers <Fons.Rademakers@cern.ch> writes:
> >
> > > Hi Jiri,
> > >
> > >  I've seen the same on my linux machine (run stress two times and the second
> > > will be scrambled. It is related to the OpenPipe() call. If you could debug
> > > and fix this for me I would be very happy.
> > >
> > > Cheers, Fons.
> > >
> > >
> > > masik@fzu.cz wrote:
> > > >
> > > > Hi,
> > > >
> > > > has anybody seen a problem reading output of external commands by
> > > > fgets after popen (gSystem->OpenPipe) call? It can be noticed as a
> > > > garbage/empty line at the end of test/stress output where system info
> > > > is being obtained. I've seen this on Debian/PPC and some Debian/x86
> > > > (but not all machines fail). As for non-linux boxes I had a chance to
> > > > test only dxplus(OSF1) at CERN for which it is less frequent but it
> > > > happens too. Root version is 3.01/06, libc-2.2.3-6, Linux version
> > > > 2.4.6-pre8, gcc-3.0.
> > > >
> > > > Please see the following example
> > > >
> > > >   --------------------------------------------------------------------------------
> > > >                       Name: poproot2.cxx
> > > >    poproot2.cxx       Type: text/x-c++src
> > > >                Description: poproot2.cxx
> > > >
> > > >   --------------------------------------------------------------------------------
> > > >
> > > > [dxplus02] /afs/cern.ch/user/j/jmasik/public >  g++ -I$ROOTSYS/include
> > > > poproot2.cxx `root-config --libs`
> > > > [dxplus02] /afs/cern.ch/user/j/jmasik/public > ./a.out
> > > > fgets returned NULL
> > > > [dxplus02] /afs/cern.ch/user/j/jmasik/public > ./a.out
> > > > *  OSF1 dxplus02 V4.0 1229 alpha
> > > >
> > > > Any information on popen and fgets I have doesn't mention the need to
> > > > test anything beyond returned pointers. Bad runs have this line in
> > > > their tracelogs.
> > > > read(4, 0x30018000, 4096)               = ? ERESTARTSYS (To be restarted)
> > > >
> > > > Do you have an idea what's wrong? Everything works if I comment out
> > > > TSystem.h and remove `root-config --libs` from the compile command on
> > > > Debian/PPC, on OSF removing TSystem.h is enough.
> > > >
> > > >         Jiri
> > > >
> > > > I don't know how to strace on OSF, on Linux it looks like
> > > > ....
> > > > open("/data/masik/root-v3.02.gcc3/include/RQ_OBJECT.h", O_RDONLY) = 3
> > > > brk(0x103ae000)                         = 0x103ae000
> > > > fstat64(0x3, 0x7fffe938)                = 0
> > > > mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
> > > > 0) = 0x30017000
> > > > read(3, "// @(#)root/base:$Name:  $:$Id: "..., 4096) = 4096
> > > > _llseek(0x3, 0, 0, 0x7fffe8f8, 0)       = 0
> > > > read(3, "// @(#)root/base:$Name:  $:$Id: "..., 4096) = 4096
> > > > read(3, "ar *method) \\\n      { Emit(\"Chan"..., 4096) = 152
> > > > read(3, "", 4096)                       = 0
> > > > pipe([4, 5])                            = 0
> > > > fork()                                  = 4880
> > > > close(5)                                = 0
> > > > fstat64(0x4, 0x7ffff0c8)                = 0
> > > > mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
> > > > 0) = 0x30018000
> > > > read(4, 0x30018000, 4096)               = ? ERESTARTSYS (To be
> > > > restarted)
> > > > --- SIGCHLD (Child exited) ---
> > > > fstat64(0x1, 0x7fffe9e8)                = 0
> > > > mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
> > > > 0) = 0x30019000
> > > > ioctl(1, 0x402c7413, 0x7fffe848)        = 0
> > > > write(1, "fgets returned NULL\n", 20)   = 20
> > >
> > > --
> > > Org:    CERN, European Laboratory for Particle Physics.
> > > Mail:   1211 Geneve 23, Switzerland
> > > E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
> > > WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:52 MET