EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: Filtering messages print on the IOC shell console
From: Freddie Akeroyd - UKRI STFC via Tech-talk <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Fri, 10 Apr 2020 17:22:10 +0000

I am not a VxWorks user so apologies if these are silly suggestion.

 

It looks like the stderr output is being delayed, could it somehow be going via a background process like logTask() ?

 

It seems that printf() is part of fioLib rather than ansiLib, which I think makes it unbuffered and different to fprintf(stdout, … ). I see iocsh.cpp uses   fprintf(epicsGetStdout(), … ) etc.  but I had a feeling the ioc shell on vxWorks was somehow a little different to linux/windows. If the command echoing on vxWorks was being done via printf() or another non-ansiLib route then I could believe that could lead to garbled output. If you change where the error is being printed in dblexRoutines.c to use printf() rather than errPrintf() does that change the output ordering?

 

Regards,

 

Freddie  

 

From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of Mark Rivers via Tech-talk
Sent: 10 April 2020 00:48
To: 'Johnson, Andrew N.' <anj at anl.gov>
Cc: 'EPICS tech-talk' <tech-talk at aps.anl.gov>
Subject: RE: Filtering messages print on the IOC shell console

 

I replaced

 

fflush(epicsGetStderr())

 

with

 

taskDelay(120)

 

to wait 2 seconds.  As expected the taskDelay command itself is garbled but it then allows time for the rest of the error messages to appear before the next vxWorks shell command is executed.

 

dbLoadTemplate "DAC.template"

value = filename="..0/dbStatic/dbLexRout = ines.c" line numb0xer=264

S_nfsLib_NF0

#fflush(epicsGetStderr())

peninNOENT dbRead otaskDelay(120)

g file /corvette/home/epics/devel/dac128V-2-9/db/xsingleDAC.db

filename="../dbStatic/dbLexRoutines.c" line number=264

S_nfsLib_NFSERR_NOENT dbRead opening file /corvette/home/epics/devel/dac128V-2-9/db/xsingleDAC.db

filename="../dbStatic/dbLexRoutines.c" line number=264

S_nfsLib_NFSERR_NOENT dbRead opening file /corvette/home/epics/devel/dac128V-2-9/db/xsingleDAC.db

filename="../dbStatic/dbLexRoutines.c" line number=264

S_nfsLib_NFSERR_NOENT dbRead opening file /corvette/home/epics/devel/dac128V-2-9/db/xsingleDAC.db

filename="../dbStatic/dbLexRoutines.c" line number=264

S_nfsLib_NFSERR_NOENT dbRead opening file /corvette/home/epics/devel/dac128V-2-9/db/xsingleDAC.db

filename="../dbStatic/dbLexRoutines.c" line number=264

S_nfsLib_NFSERR_NOENT dbRead opening file /corvette/home/epics/devel/dac128V-2-9/db/xsingleDAC.db

filename="../dbStatic/dbLexRoutines.c" line number=264

S_nfsLib_NFSERR_NOENT dbRead opening file /corvette/home/epics/devel/dac128V-2-9/db/xsingleDAC.db

filename="../dbStatic/dbLexRoutines.c" line number=264

S_nfsLib_NFSERR_NOENT dbRead opening file /corvette/home/epics/devel/dac128V-2-9/db/xsingleDAC.db

value = 0 = 0x0

 

 

# Initialize Acromag IP-330 ADC

# initIp330(

#   const char *portName, int carrier, int slot,

#   const char *typeString, const char *rangeString,

#   int firstChan, int lastChan,

#   int intVec)

# portName    = name to give this asyn port

 

If, as Eric Norum says, stderr should be flushing each character then why does stderr output appear in the middle of the following vxWorks commands? 

 

Mark

 

 

From: Mark Rivers
Sent: Thursday, April 9, 2020 6:37 PM
To: 'Johnson, Andrew N.' <anj at anl.gov>
Cc: J. Lewis Muir <jlmuir at imca-cat.org>; EPICS tech-talk <tech-talk at aps.anl.gov>; Konrad, Martin <konrad at frib.msu.edu>
Subject: RE: Filtering messages print on the IOC shell console

 

I just tried Andrew’s suggestion of adding

 

fflush(epicsGetStderr())

 

after the dbLoadTemplate line that generates lots of error messages.  It did not seem to help.

 

# Initialize Systran DAC

# initDAC128V(char *portName, int carrier, int slot)

# portName  = name to give this asyn port

# carrier     = IPAC carrier number (0, 1, etc.)

# slot        = IPAC slot (0,1,2,3, etc.)

initDAC128V("DAC1", 0, 3)

value = 0 = 0x0

dbLoadTemplate "DAC.template"

filename=".value = ./dbStatic/d0bLexRoutines.c" lin = e number=264

S_nf0xsLib_NFSERR_NOENT 0

fflush(epicsGetStderr())

value = dbRead openi0ng file /corvette/h = ome/epics/devel/d0xac128V-2-9/db/xsin0

 

gleDAC.dbize Acromag IP-330 ADC

 

ic/dbLee="../dbStat# initIp330(

umber=264.c" line n#   const char *portName, int carrier, int slot,

S

T dbRea_NFSERR_NOEN#   const char *typeString, const char *rangeString,

vette/hng file /cor#   int firstChan, int lastChan,

128Vepics/devel/dac#   int intVec)

db-9/db/xsingleDAC.# portName    = name to give this asyn port

 

filarrier     = IPAC carrier number (0, 1, etc.)

dbLexRoutines.c" l/# slot        = IPAC slot (0,1,2,3, etc.)

ine number=264

S_nf# typeString  = "D" or "S" for differential or single-ended

bRead oSERR_NOENT d# rangeString = "-5to5","-10to10","0to5", or "0to10"

te/home/epics/devet#               This value must match hardware setting selected

xsingac128V-2-9/db/# firstChan   = first channel to be digitized.  This must be in the range:

leDAC.db

filename=".     0 to 31 (single-ended)

t/dbStatic/dbLexRou#               0 to 15 (differential)

=264.c" line number# lastChan    = last channel to be digitized

S_nfsLib_N

openingOENT dbRead # intVec        Interrupt vector

e/epics/devel/e/hominitIp330("Ip330_1",0,2,"D","-5to5",0,15,120)

value = 0 = 0x0

 

 

Mark

 

 

From: Johnson, Andrew N. <anj at anl.gov>
Sent: Thursday, April 9, 2020 5:47 PM
To: Mark Rivers <rivers at cars.uchicago.edu>
Cc: J. Lewis Muir <jlmuir at imca-cat.org>; EPICS tech-talk <tech-talk at aps.anl.gov>; Konrad, Martin <konrad at frib.msu.edu>
Subject: Re: Filtering messages print on the IOC shell console

 

Sorry guys, I really meant to reply to this thread last week, but it’s been pretty crazy – presumably everyone now has time to work on their list of “things to fix” and this results in more tech-talk and private conversations than normal.

 

I want to see if the garbling goes away if I do this in the startup script:

dbLoadTemplate(...)

fflush(stderr)

 

Mark, that is worth trying; here’s how:

 

fflush(epicsGetStderr())

 

If it works we should at least add an equivalent flush to the iocsh code after it runs each command. I'm not sure if we can do anything about the VxWorks target shell, maybe Freddie’s setvbuf() idea could be made to work but I haven’t looked into that – VxWorks should have setvbuf() since it was in C89.

 

Messages that are printed using errlogPrintf() or the epicsPrintf synonym should already be getting flushed immediately because there’s a flush built into the errlogPrintf() code, but any messages printed using fprintf(stderr, …) could benefit from another flush.

 

- Andrew

 

 

On Apr 9, 2020, at 1:18 PM, Mark Rivers <rivers at cars.uchicago.edu> wrote:

 

I was going to test the hypothesis that the problem was that stderr needed an fflush after each command.  I was hoping that this would be easy to do from the vxWorks shell, but I'm not sure how to get the FILE  pointer to stderr from the command line?


I want to see if the garbling goes away if I do this in the startup script:


dbLoadTemplate(...)

fflush(stderr)

...


Mark



________________________________
From: J. Lewis Muir <jlmuir at imca-cat.org>
Sent: Thursday, April 9, 2020 1:00 PM
To: EPICS Tech-Talk
Cc: 'Konrad, Martin'; Johnson, Andrew N.; Mark Rivers
Subject: Re: Filtering messages print on the IOC shell console

On 03/27, Mark Rivers wrote:

Hi Martin,

dbLoadTemplate.y is printing messages using fprintf(stderr,...);
My recommendation would be to print all messages to the same stream.


Unfortunately this is out of my control.  The problem I am seeing is the garbling of output from dbLoadTemplate (EPICS base) and the echoing of subsequent vxWorks shell commands (Wind River).

But this suggests that the vxWorks shell is proceeding to execute the next command before the previous one has displayed all of its output on the console?  This does not seem correct.


Any more thoughts on this garbled output issue?  Specifically, how can
it be fixed?

Thanks!

Lewis

 

-- 

Complexity comes for free, simplicity you have to work for.

 


References:
Filtering messages print on the IOC shell console Paduan Donadio, Marcio via Tech-talk
Re: Filtering messages print on the IOC shell console Johnson, Andrew N. via Tech-talk
Re: Filtering messages print on the IOC shell console Konrad, Martin via Tech-talk
Re: Filtering messages print on the IOC shell console Konrad, Martin via Tech-talk
RE: Filtering messages print on the IOC shell console Mark Rivers via Tech-talk
Re: Filtering messages print on the IOC shell console J. Lewis Muir via Tech-talk
Re: Filtering messages print on the IOC shell console Mark Rivers via Tech-talk
Re: Filtering messages print on the IOC shell console Johnson, Andrew N. via Tech-talk
RE: Filtering messages print on the IOC shell console Mark Rivers via Tech-talk
RE: Filtering messages print on the IOC shell console Mark Rivers via Tech-talk

Navigate by Date:
Prev: Re: Home motorSim Device Mark Rivers via Tech-talk
Next: Re: Filtering messages print on the IOC shell console Johnson, Andrew N. via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Filtering messages print on the IOC shell console Mark Rivers via Tech-talk
Next: Re: Filtering messages print on the IOC shell console Johnson, Andrew N. via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 10 Apr 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·