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
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?
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