Hi
I am glad I put the question mark in the subject. This is not a bug in the
sequencer but rather in the SNL program. Can you spot it?
Cheers
Ben
On Wednesday 24 February 2010, Benjamin Franksen wrote:
> Hello,
>
> here is a trivial SNL program I wrote in order to reproduce a
> misbehaviour that occurs once in a while in one of our production state
> machines.
>
> Two state sets communicate via a state variable "x" which is assigned to
> a bo record and monitored by the program. The master sets x to one, then
> waits for the slave to reset it to zero. The slave waits for x to become
> one, then resets it to zero. This all happens in an infinite loop.
>
> Since there is only one place where x gets set to one (in the master),
> and one place where it gets reset to zero (in the slave), the assertions
> in the calls to check() should never fail.
>
> Your IOC should load this simple database:
>
> record(bo,"x") {
> }
>
> and this sequencer program:
>
> program SeqTest
>
> %{
> #include <assert.h>
>
> static int check(x) {
> assert(x);
> return 1;
> }
> }%
>
> int done = 0;
> int start = 1;
>
> int x;
> assign x to "x";
> monitor x;
>
> ss Master {
> state idle {
> when (check(!x)) {
> printf("Master: work\n");
> } state work
> }
> state work {
> entry {
> printf("Master: start slave\n");
> x = start;
> pvPut(x);
> }
> when (!x) {
> printf("Master: slave finished\n");
> } state idle
> }
> }
>
> ss Slave {
> state idle {
> when (x) {
> printf("Slave: start work\n");
> } state work
> }
> state work {
> entry {
> printf("Slave: enter state work\n");
> }
> when (check(x)) {
> printf("Slave: work done\n");
> x = done;
> pvPut(x);
> } state idle
> }
> }
>
>
> In my tests, the IOC will run for a while but inevitably crash with
>
> STESTIOC1C: ../seqtest.st:7: test: Assertion `x' failed.
> [1] 8507 abort ./st.cmd
>
> This looks like a bug in the sequencer to me. I am testing with
> base-3.14.8.2 and seq-2.0.12.
>
> (BTW, changing the pvPut calls to SYNC makes no difference.)
>
> Cheers
> Ben
>
--
"...And you know what incurable diseases do: they invite the quacks and
charlatans in, who in this case take the form of Software Engineering
gurus." (Dijkstra, EWD1305)
- References:
- Sequencer bug? Benjamin Franksen
- Navigate by Date:
- Prev:
Sequencer bug? Benjamin Franksen
- Next:
caml Patrick Thomas
- 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
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Sequencer bug? Benjamin Franksen
- Next:
Re: Fwd: Sequencer bug? Benjamin Franksen
- 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
2020
2021
2022
2023
2024
|