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 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
<== Date ==> <== Thread ==>

Subject: RE: How to turn off spewing messaging from asyn/stream devicse.
From: "Luchini, Kristi L." <luchini@slac.stanford.edu>
To: Mark Rivers <rivers@cars.uchicago.edu>, "'tech-talk@aps.anl.gov'" <tech-talk@aps.anl.gov>
Date: Thu, 9 Nov 2017 23:28:23 +0000
Hi Mark,

The messages may originate from streamdevice, because the command doesn't work. I  just tried again message are still being issued, but "noAutoConnect"  does turn off the messages.

- Kristi

-----Original Message-----
From: Mark Rivers [mailto:rivers@cars.uchicago.edu] 
Sent: Thursday, November 09, 2017 2:35 PM
To: Luchini, Kristi L.; 'tech-talk@aps.anl.gov'
Subject: RE: How to turn off spewing messaging from asyn/stream devicse.

Hi Kristi,

> 3) turn on/off the error messages sent to the console.

If those error messages were coming from asyn you could do the following:

asynSetTraceMask("port", 0, 0)

argument:
"port" the name of the asyn port
0 asyn address, normally 0
0 asyn trace mask, 0 is no message, ASYN_TRACE_ERROR=1, etc.

However, because those messages are coming from streamDevice and not asyn that does not work.  I have asked Dirk to consider changing the streamDevice error reporting so that if asyn is being used (which it almost always is) then it uses the asynTrace mechanism for control messages.  That would allow controlling them as above.  This would require some refactoring of streamDevice because the asyn dependency is currently confined to a single source code file.  The error messages are printed with the "error()" macro which is defined to be StreamError(), which in turn calls this:

void StreamVError(int line, const char* file, const char* fmt, va_list args) {
    char timestamp[40];
    StreamPrintTimestampFunction(timestamp, 40); #ifdef va_copy
    if (StreamDebugFile)
    {
        va_list args2;
        va_copy(args2, args);
        fprintf(StreamDebugFile, "%s ", timestamp);
        vfprintf(StreamDebugFile, fmt, args2);
        fflush(StreamDebugFile);
        va_end(args2);
    }
#endif
    fprintf(stderr, "\033[31;1m");
    fprintf(stderr, "%s ", timestamp);
    if (file)
    {
        fprintf(stderr, "%s line %d: ", file, line);
    }
    vfprintf(stderr, fmt, args);
    fprintf(stderr, "\033[0m");
}

As I read this there is no way to suppress the error messages except to send the output to a debug file or to route stderr somewhere else.

> 2) configure the rate at which the auto reconnection is attempted,

If autoConnect is true then asynManager will try to connect to the port:
- Every 20 seconds
- Any time a request is queued to talk to the port, i.e. a record processes.

So asyn itself will only periodically try to connect every 20 seconds, and it won't print any message if it is not successful.

However, streamDevice I/O Intr scanned records are special, because they are actually not "interrupt" driven but do reads from the device periodically.  I just did a quick read of the AsynDriverInterface.cc code, and it appears to me that if the port is disconnected it waits for the ReplyTimeout time and tries again.  The default value of ReplyTimeout is 1.0 second, which is consistent with what you are seeing.  You could increase the ReplyTimeout value in your protocol file to increase the rate at which streamDevice tries to reconnect.

Mark


-----Original Message-----
From: tech-talk-bounces@aps.anl.gov [mailto:tech-talk-bounces@aps.anl.gov] On Behalf Of Luchini, Kristi L.
Sent: Thursday, November 09, 2017 2:21 PM
To: 'tech-talk@aps.anl.gov'
Subject: How to turn off spewing messaging from asyn/stream devicse.

Hello,

I have a serial device that uses streamdevice,  from a CALC record, with the SCAN file set to "I/O Intr".   The device has  a simple interface, in that it can only send data once per second, and that's it.

record(calcout, "$(BL)GammaDoseRate") {
  field(DESC, "gamma dose rate")
  field(DTYP, "stream")
  field(OUT,  "@$(proto) read($(BL)) $(PORT)")
  field(SCAN, "I/O Intr")
  field(CALC, "A<8388608 ? 0.01*A : 0.01*(8388608-A)") # .A is filled in by $(proto) # SDIS is for alarm propogation only
  field(SDIS, "$(BL)GammaHeartBeat CP MS")
  field(EGU,  "mR/hr")
  field(PREC, "2")
  field(HOPR, "10.0")
  field(LOPR, "-1.0")
  field(HIGH, "$(HIGH=0.5)")
  field(HYST, "$(HYST=0.02)")
  field(HSV,  "MINOR")
  field(FLNK, "$(BL)GammaCommCheck")
}

For this application I have the asyn options set to disconnect on a read timeout and to autoConnect.

drvAsynIPPortConfigure("GAMMA_B44_12" ,"${TS_NODE}:2107",0,0,0) asynSetOption("GAMMA_B44_12", 0, "disconnectOnReadTimeout", "Y")

If this devices gets a read timeout, the driver sends an error message to the IOC console, and the device does disconnect. Next the driver tries to reconnect a second later,  at which time I get another timeout and error message, and thus begins the flood of messages to the console.

2017/11/09 11:44:15.178742 GAMMA_B44_12 BSOIC:B44:12:GammaString: I/O error after reading 0 bytes: ""
2017/11/09 11:44:15.178756 GAMMA_B44_12 BSOIC:B44:12:GammaString: Protocol aborted
2017/11/09 11:44:16.178952 GAMMA_B44_12 BSOIC:B44:12:GammaString: asynError in read. Asyn driver says: ts-b044-pp01:2107 disconnected:
2017/11/09 11:44:16.178979 GAMMA_B44_12 BSOIC:B44:12:GammaString: I/O error after reading 0 bytes: ""
2017/11/09 11:44:16.179003 GAMMA_B44_12 BSOIC:B44:12:GammaString: Protocol aborted

I can setup the database to turn off these messages after a period of time by setting  "noAutoConnect".  However, I'd like to instead do the following:

1) set autoConnect
2) configure the rate at which the auto reconnection is attempted,
3) turn on/off the error messages sent to the console.

Is this possible?

Regards,
 Kristi




Replies:
RE: How to turn off spewing messaging from asyn/stream devicse. Mark Rivers
References:
How to turn off spewing messaging from asyn/stream devicse. Luchini, Kristi L.
RE: How to turn off spewing messaging from asyn/stream devicse. Mark Rivers

Navigate by Date:
Prev: RE: EPICS base R3.15.5 special CONFIG and RULE files Luchini, Kristi L.
Next: RE: How to turn off spewing messaging from asyn/stream devicse. Luchini, Kristi L.
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
Navigate by Thread:
Prev: RE: How to turn off spewing messaging from asyn/stream devicse. Mark Rivers
Next: RE: How to turn off spewing messaging from asyn/stream devicse. Mark Rivers
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
ANJ, 09 Nov 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·