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  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: weird behaviour of SNL test program running on Soft IOC on LINUX
From: "Mark Rivers" <[email protected]>
To: "Oleg Makarov" <[email protected]>, "EPICS tech-talk" <[email protected]>
Cc: [email protected], "Stepanov, Sergey" <[email protected]>
Date: Mon, 16 Mar 2009 12:10:12 -0500

Hi Oleg,

 

I have seen a problem that might be related.  

 

Would the symptoms you see be consistent with epicsThreadSleep() simply returning too soon?

 

I was getting that problem when my Linux IOC was linked with some code that uses the new Posix 1.b timer routines.  Those routines cause SIGALRM signals to be generated, potentially very frequently.  SIGALRM signals will cause the Posix nanosleep() function to return immediately with errno=EINTR.  nanosleep is what epicsThreadSleep uses on Linux.

I modified the epicsThreadSleep code in libCom/osi/os/posix/osdThread.c as follows:

 

RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/libCom/osi/os/posix/osdThread.c,v

retrieving revision 1.67.2.32

diff -u -r1.67.2.32 osdThread.c

--- osdThread.c 6 Aug 2008 16:54:25 -0000       1.67.2.32

+++ osdThread.c 16 Mar 2009 17:08:28 -0000

@@ -606,7 +606,8 @@

     delayTime.tv_sec = (time_t)seconds;

     nanoseconds = (seconds - (double)delayTime.tv_sec) *1e9;

     delayTime.tv_nsec = (long)nanoseconds;

-    nanosleep(&delayTime,&remainingTime);

+    while(nanosleep(&delayTime,&remainingTime) == -1)

+       delayTime = remainingTime;

 }

 

It would be interesting to see if this fixes your problem.  Could your soft IOC be using the Posix 1.b timer routines?

 

Mark

 

 

 


From: [email protected] [mailto:[email protected]] On Behalf Of Oleg Makarov
Sent: Monday, March 16, 2009 11:04 AM
To: EPICS tech-talk
Cc: [email protected]; Stepanov, Sergey
Subject: weird behaviour of SNL test program running on Soft IOC on LINUX

 

A small SNL test program strangely misbehaves when it being run on Soft IOC on LINUX.

Under VxWorks this SNL test program program behaves as expected.


program test("name=my_test, dev=23b:GO:mom:")

  %%#include <string.h>

  string str_rsp; assign str_rsp to "{dev}StrRsp";

  string str_cmd; assign str_cmd to "{dev}StrCmd";

 

  ss main {

    state tst {

      when(pvConnectCount() == pvChannelCount()) {

        strcpy (str_cmd, "I522");

        pvPut(str_cmd); epicsThreadSleep(1.0);

        pvGet (str_rsp); epicsThreadSleep(1.0);

        printf ("str_rsp = %s \n", str_rsp);

        strcpy (str_cmd, "I521");

        pvPut(str_cmd); epicsThreadSleep(1.0);

    } state tst

  }

}


This program interacts with device using two EPICS PV strings:

1)  writes a command "I522" and sleeps one second

2) reads a response and sleeps one second

3) prints a response at IOC console

4) writes a command "I521" and sleeps one second

The program repeats this sequence periodically.

 

being run under the VxWorks OS program behaves exactly as expected:


23b:ioc2> seq &test, "name=my_test, mtr=23b:GO:mom:"

SEQ Version 2.0.12: Mon Feb 9 13:16:21 2009

Spawning state program "test", thread 0x1ee970f0: "my_test"

value = 518615280 = 0x1ee970f0

23b:ioc2> str_rsp = 378.88

str_rsp = 378.88

str_rsp = 378.88

str_rsp = 378.88

str_rsp = 378.88

str_rsp = 378.88

str_rsp = 378.88


camonitor connected to these two PV strings shows timing as expected:


gmca@mar3:~ 6> camonitor 23b:GO:mom:StrCmd 23b:GO:mom:StrRsp

23b:GO:mom:StrCmd 2009-03-13 18:12:19.025831 I522

23b:GO:mom:StrRsp 2009-03-13 18:12:19.042497 378.88

23b:GO:mom:StrCmd 2009-03-13 18:12:21.025831 I521

23b:GO:mom:StrRsp 2009-03-13 18:12:21.025831 100

23b:GO:mom:StrCmd 2009-03-13 18:12:22.025831 I522

23b:GO:mom:StrRsp 2009-03-13 18:12:22.025831 378.88

23b:GO:mom:StrCmd 2009-03-13 18:12:24.025831 I521

23b:GO:mom:StrRsp 2009-03-13 18:12:24.025831 100

23b:GO:mom:StrCmd 2009-03-13 18:12:25.025830 I522

23b:GO:mom:StrRsp 2009-03-13 18:12:25.025830 378.88

23b:GO:mom:StrCmd 2009-03-13 18:12:27.025830 I521

23b:GO:mom:StrRsp 2009-03-13 18:12:27.025830 100


being run under Soft IOC on LINUX strange things happen - on the concole it prints a string corresponding to the responce on the second command and sometimes it prints a string with the first command "I522":


str_rsp = 100

str_rsp = 100

str_rsp = I522

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = I522

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = I522

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = I522

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = I522

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = I522

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = I522

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = I522

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = 100

str_rsp = I522

str_rsp = 100

str_rsp = 100


camonitor connected to these two PV strings also shows a strange timing - two commands get posted without time delays:


23b:GO:mom:StrCmd 2009-03-13 18:27:02.628072 I522

23b:GO:mom:StrCmd 2009-03-13 18:27:04.978072 I521

23b:GO:mom:StrCmd 2009-03-13 18:27:06.628072 I522

23b:GO:mom:StrRsp 2009-03-13 18:27:06.628072 378.88

23b:GO:mom:StrCmd 2009-03-13 18:27:08.628072 I521

23b:GO:mom:StrCmd 2009-03-13 18:27:08.628072 I522

23b:GO:mom:StrRsp 2009-03-13 18:27:08.628072 100

23b:GO:mom:StrCmd 2009-03-13 18:27:11.644738 I521

23b:GO:mom:StrCmd 2009-03-13 18:27:11.644738 I522

23b:GO:mom:StrCmd 2009-03-13 18:27:14.644738 I521

23b:GO:mom:StrCmd 2009-03-13 18:27:14.644738 I522

23b:GO:mom:StrCmd 2009-03-13 18:27:17.644738 I521

23b:GO:mom:StrCmd 2009-03-13 18:27:17.644738 I522

23b:GO:mom:StrCmd 2009-03-13 18:27:20.644738 I521

23b:GO:mom:StrCmd 2009-03-13 18:27:20.644738 I522

23b:GO:mom:StrCmd 2009-03-13 18:27:23.661404 I521

23b:GO:mom:StrCmd 2009-03-13 18:27:23.661404 I522


Any ideas on how to correct this problem with SNL test program running on Soft IOC under LINUX OS?

 

Regards,

 

Oleg A. Makarov,
Beamline Instrumentation Scientist

 


Argonne National Laboratory
9700 South Cass Avenue
Argonne, IL 60439-4861

 

Phone 630 252 0668
Fax 630 252 0667


Replies:
Re: weird behaviour of SNL test program running on Soft IOC on LINUX Oleg Makarov
References:
weird behaviour of SNL test program running on Soft IOC on LINUX Oleg Makarov

Navigate by Date:
Prev: weird behaviour of SNL test program running on Soft IOC on LINUX Oleg Makarov
Next: Re: weird behaviour of SNL test program running on Soft IOC on LINUX J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: weird behaviour of SNL test program running on Soft IOC on LINUX Oleg Makarov
Next: Re: weird behaviour of SNL test program running on Soft IOC on LINUX Oleg Makarov
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 31 Jan 2014 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·