LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

STATE-EVENT machine causing FREEZE executable VI

Solved!
Go to solution

Hello all. I have a slight problem that I have not been able to pull it out, for just about a couple of months now... The executable of this VI, just

freezes randomly and I do not know why. I've tried many fixes in my code, and still the problem persists.

 

I attached some images instead of code, because I have many subVI's. I don't know if I upload the whole project, you are going to be able to

reproduce it. Funny thing when I'm debugging, this error (freeze) won't appear.

 

Basically my code is based on STATE-EVENT architecture. Inside two states I have and event on each state. In this two events I'm waiting

for a code to be scanned (control string receives code) and after this event is generate I exit the respective event and go to another state in the

state machine. So my guess is like this:

 

States                                   Event             Status

WAIT SnorkelDummy           Yes                 OK

WRITE SnorkelDummy        No                 OK      

WAIT Blower                        Yes                 I'm guessing that here the error comes, and VI freezes

WRITE Blower                      No                  I think the problem is not produce here, because no

                                                                    event is in this state.

 

Can someone PLEASE help me with this issue. I'm driving nuts here!!

 

 

0 Kudos
Message 1 of 20
(4,616 Views)
Solution
Accepted by topic author JLuna

With event structures, it is possible to lock the front panel until an event is handled. For instance, if you're not in the "Wait Blower" state but you change the "Blower WR" value, it could lock up your front panel until that event is handled, which may be never, locking your UI. If you edit the event structure you can see if "Lock panel" is checked or not.

 

In general, it is good to only have a single event structure to make it harder to run into this situation.

Message 2 of 20
(4,598 Views)

Based on your statement, I still don't understand how can the Blower WR state change if:

 

  • Blower WR Control is hidden
  • To be able to write to this control, the key focus property is inside an specific 'state machine'. So this control is practically available until the program enters this state.
  • Once the program is inside this 'state machine' the event can now happen, but only just until this situations completes.

So, I'm still wondering how does it activates (as you mention) and locks my UI.

 

Anyhow, just as one more test... I'm going to follow your advice to have only 1 'event structure' and see how this works. I attached a screenshot

of the part of the code I replaced with a while loop; just waiting for a 'value BLOWER WR' to happen.

 

Thanks for you reply.

 

 

 

0 Kudos
Message 3 of 20
(4,556 Views)

You clearly have race condition and DATA FLOW problem. 

Run your code with Execution highlight and it will be clear to you. 

 

You are read the string control Blower WR when the loop starts, and just before your loop can iterate you clear the control again. You will alway read an empty string from the control. 

0 Kudos
Message 4 of 20
(4,545 Views)

I don't think it's race condition. Because inside event 'BLOWER value change' I save the new value in a cluster. When the event loop exits, I clear

the control value for next iteration.

 

also this issue I'm having just happens randomly. It could happen only once per day or it can even pass 3 days with no error, then at the 4th it appears. So weird. I'm going to testing first. Then evaluate and see the outcome. I'll be posting for any news.

 

Thanks for your answer by the way, I really appreciate it.

0 Kudos
Message 5 of 20
(4,531 Views)