From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

It's impossible, but it happens.

Solved!
Go to solution

LV2013, Win7

 

OK, I'm working on a project which has a container window ("MegaMonitor").

On the window is a single TAB control with 12 pages.

On each page are 6 SubPanels, nothing else.

There is a single VI called the "Block" VI.

I put one instance of that VI into each of those 72 SubPanels, and the whole thing should run.

There is a TCP data stream coming in at 10 Hz, that gets decimated into various history arrays.  Each Subpanel chooses a way to view a certain set of channels from that datastream.

 

The problem is, sometimes the process works just fine and dandy, The window opens up and starts running in 3-4 seconds, it shuts down in less than 1 second.

Sometimes it's like walking thru sludge - it takes 20-30 seconds to open up and run, it takes 60 or more seconds to shut down and recover.

 

I don't know what will make it work fast or slow - a restart TENDS to make it work fast the first time after, but not always.

 

Here is the launching code, in the container window:

MM Launch.PNG

 

I've tried CALL and FORGET, and CALL and COLLECT methods, rather than the RUN VI method - no real difference in behavior.

I've tried AUTO DISPOSE REF bothe TRUE and FALSE - no difference.

 

I need to know when the process has shutdown.  The BLOCK Vi, as the first thing it does, puts a value into a STOP queue, and as the last thing it does, it takes a value OUT. 

So the CONTAINER window can look for an empty queue to determine that it's done.

 

Here is that Shutdown Code:

MM Shutdown.PNG

 

 

There is an EVENT which triggers shutdown of the window - each block sees that event and shuts down:

MM Block 10.PNG

 

After the event is heard, we log a debug message:

MM Block 11.PNG

 

We save a few things in a PREFS structure:

MM Block 12.PNG

 

We log another debug message:

MM Block 13.PNG

 

 

And, as the last thing we do, we de-queue an item from the STOP queue:

MM Block 14.PNG

 

 

The "SAVE A FEW THINGS" part is pretty simple - just store a structure into an array:

MM Block Shutdown.PNG

 

 

 

The SEND DEBUG thing just formats a string and sends via UDP to a receiver elsewhere.  The sludge behavior happens whether debugging is turned on or not.

 

Stay Tuned for the impossible part...

 

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 26
(3,503 Views)

 

So, here is a debugging log, with comments interspersed:

287115 - MM Unit 0 Block 3 Queue Event.
287115 - MM Unit 0 Block 1 Queue Event.

 

--- The QUEUE event is normal operation - Here we get a STOP event.

287189 - MM Unit 0 Block 1: About to Close
287234 - MM Unit 0 Block 6: About to Close
287235 - MM Unit 0 Block 10: About to Close
287236 - MM Unit 0 Block 4: About to Close
287236 - MM Unit 0 Block 14: About to Close
287237 - MM Unit 0 Block 12: About to Close
287238 - MM Unit 0 Block 16: About to Close
287238 - MM Unit 0 Block 18: About to Close
287239 - MM Unit 0 Block 19: About to Close
287240 - MM Unit 0 Block 26: About to Close
287240 - MM Unit 0 Block 23: About to Close
287241 - MM Unit 0 Block 28: About to Close
287241 - MM Unit 0 Block 7: About to Close
287242 - MM Unit 0 Block 5: About to Close
287242 - MM Unit 0 Block 11: About to Close
287243 - MM Unit 0 Block 8: About to Close
287244 - MM Unit 0 Block 15: About to Close
287245 - MM Unit 0 Block 20: About to Close
287245 - MM Unit 0 Block 24: About to Close
287246 - MM Unit 0 Block 3: About to Close
287246 - MM Unit 0 Block 0: About to Close
287247 - MM Unit 0 Block 27: About to Close
287247 - MM Unit 0 Block 25: About to Close
287247 - MM Unit 0 Block 31: About to Close
287248 - MM Unit 0 Block 53: About to Close
287267 - MM Unit 0 Block 30: About to Close
287267 - MM Unit 0 Block 32: About to Close
287268 - MM Unit 0 Block 41: About to Close
287268 - MM Unit 0 Block 36: About to Close
287269 - MM Unit 0 Block 35: About to Close
287269 - MM Unit 0 Block 13: About to Close
287269 - MM Unit 0 Block 37: About to Close
287269 - MM Unit 0 Block 22: About to Close
287269 - MM Unit 0 Block 9: About to Close
287269 - MM Unit 0 Block 34: About to Close
287269 - MM Unit 0 Block 57: About to Close
287269 - MM Unit 0 Block 21: About to Close
287269 - MM Unit 0 Block 33: About to Close
287270 - MM Unit 0 Block 2: About to Close
287270 - MM Unit 0 Block 43: About to Close
287270 - MM Unit 0 Block 45: About to Close
287270 - MM Unit 0 Block 46: About to Close
287271 - MM Unit 0 Block 48: About to Close
287271 - MM Unit 0 Block 49: About to Close
287271 - MM Unit 0 Block 50: About to Close
287271 - MM Unit 0 Block 64: About to Close
287271 - MM Unit 0 Block 51: About to Close
287271 - MM Unit 0 Block 29: About to Close
287271 - MM Unit 0 Block 54: About to Close
287290 - MM Unit 0 Block 47: About to Close
287290 - MM Unit 0 Block 55: About to Close
287291 - MM Unit 0 Block 44: About to Close
287291 - MM Unit 0 Block 42: About to Close
287291 - MM Unit 0 Block 40: About to Close
287291 - MM Unit 0 Block 39: About to Close
287292 - MM Unit 0 Block 38: About to Close
287292 - MM Unit 0 Block 56: About to Close
287292 - MM Unit 0 Block 58: About to Close
287292 - MM Unit 0 Block 17: About to Close
287292 - MM Unit 0 Block 59: About to Close
287292 - MM Unit 0 Block 60: About to Close
287292 - MM Unit 0 Block 71: About to Close
287292 - MM Unit 0 Block 70: About to Close
287293 - MM Unit 0 Block 68: About to Close
287293 - MM Unit 0 Block 66: About to Close
287293 - MM Unit 0 Block 52: About to Close
287293 - MM Unit 0 Block 62: About to Close
287293 - MM Unit 0 Block 67: About to Close
287293 - MM Unit 0 Block 63: About to Close
287293 - MM Unit 0 Block 69: About to Close
287293 - MM Unit 0 Block 65: About to Close
287294 - MM Unit 0 Block 61: About to Close

 

--- OK, all 72 blocks got the event and are preparing to stop.  They start closing:


287294 - MM Unit 0 Block 1: Closed
287294 - MM Unit 0 Block 6: Closed
287294 - MM Unit 0 Block 10: Closed
287294 - MM Unit 0 Block 4: Closed
287295 - MM Unit 0 Block 16: Closed
287295 - MM Unit 0 Block 14: Closed

 

Here, the container window chimes in, it's waiting for an empty queue.  The population is still 72, but it's only been 1 mSec since they started closing, so no big deal.

287295 - Queue population: 72

 

And 39 more blocks are closing:
287295 - MM Unit 0 Block 12: Closed
287295 - MM Unit 0 Block 18: Closed
287295 - MM Unit 0 Block 19: Closed
287295 - MM Unit 0 Block 26: Closed
287295 - MM Unit 0 Block 23: Closed
287296 - MM Unit 0 Block 28: Closed
287296 - MM Unit 0 Block 5: Closed
287296 - MM Unit 0 Block 7: Closed
287296 - MM Unit 0 Block 11: Closed
287296 - MM Unit 0 Block 8: Closed
287296 - MM Unit 0 Block 20: Closed
287296 - MM Unit 0 Block 15: Closed
287296 - MM Unit 0 Block 24: Closed
287296 - MM Unit 0 Block 3: Closed
287297 - MM Unit 0 Block 0: Closed
287297 - MM Unit 0 Block 27: Closed
287297 - MM Unit 0 Block 25: Closed
287297 - MM Unit 0 Block 31: Closed
287297 - MM Unit 0 Block 53: Closed
287297 - MM Unit 0 Block 30: Closed
287297 - MM Unit 0 Block 32: Closed
287297 - MM Unit 0 Block 36: Closed
287297 - MM Unit 0 Block 35: Closed
287297 - MM Unit 0 Block 41: Closed
287297 - MM Unit 0 Block 13: Closed
287297 - MM Unit 0 Block 37: Closed
287297 - MM Unit 0 Block 22: Closed
287297 - MM Unit 0 Block 9: Closed
287298 - MM Unit 0 Block 34: Closed
287298 - MM Unit 0 Block 57: Closed
287298 - MM Unit 0 Block 21: Closed
287298 - MM Unit 0 Block 33: Closed
287298 - MM Unit 0 Block 2: Closed

 

Now, here, for some reason, LabVIEW stops doing what I ask it and goes into a corner and pouts:
287557 - Queue population: 33
287689 - Queue population: 33
287821 - Queue population: 33
287953 - Queue population: 33
288085 - Queue population: 33
288217 - Queue population: 33
288349 - Queue population: 33
288481 - Queue population: 33
288613 - Queue population: 33
288745 - Queue population: 33
288877 - Queue population: 33
289009 - Queue population: 33
289141 - Queue population: 33
289273 - Queue population: 33
289405 - Queue population: 33
289537 - Queue population: 33
289669 - Queue population: 33
289801 - Queue population: 33

 

Here it finally gets around to closing one more:

289861 - MM Unit 0 Block 43: Closed

 

And now, it's back to pouting:
289933 - Queue population: 32
290061 - Queue population: 32
290189 - Queue population: 32
290317 - Queue population: 32
290445 - Queue population: 32
290573 - Queue population: 32
290701 - Queue population: 32
290829 - Queue population: 32
290957 - Queue population: 32
291085 - Queue population: 32
291213 - Queue population: 32
291341 - Queue population: 32
291469 - Queue population: 32
291597 - Queue population: 32
291725 - Queue population: 32
291853 - Queue population: 32
291981 - Queue population: 32
292109 - Queue population: 32
292237 - Queue population: 32
292365 - Queue population: 32
292493 - Queue population: 32
292621 - Queue population: 32
292749 - Queue population: 32
292877 - Queue population: 32
293005 - Queue population: 32
293133 - Queue population: 32
293261 - Queue population: 32
293389 - Queue population: 32
293517 - Queue population: 32
293645 - Queue population: 32
293773 - Queue population: 32
293901 - Queue population: 32
294029 - Queue population: 32
294157 - Queue population: 32
294285 - Queue population: 32
294413 - Queue population: 32
294541 - Queue population: 32
294669 - Queue population: 32
294797 - Queue population: 32
294925 - Queue population: 32

 

It apparently did absolutely nothing toward closing the VIs for about 5 seconds.

 

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 26
(3,502 Views)

Now for the impossible part:

295053 - Queue population: 0

295073 - Waited 7804 mSec on Closure

--- Whoa!  How did the queue get empty ?

 

 

And THEN, the CLOSED messages come in:
324367 - MM Unit 0 Block 45: Closed
429747 - MM Unit 0 Block 46: Closed
436287 - MM Unit 0 Block 48: Closed
437025 - MM Unit 0 Block 49: Closed
443566 - MM Unit 0 Block 50: Closed
444309 - MM Unit 0 Block 64: Closed
450854 - MM Unit 0 Block 51: Closed
451582 - MM Unit 0 Block 29: Closed
458117 - MM Unit 0 Block 54: Closed
465385 - MM Unit 0 Block 47: Closed
465385 - MM Unit 0 Block 55: Closed
465385 - MM Unit 0 Block 44: Closed
465385 - MM Unit 0 Block 42: Closed
465386 - MM Unit 0 Block 40: Closed
466839 - MM Unit 0 Block 39: Closed
480642 - MM Unit 0 Block 38: Closed
487176 - MM Unit 0 Block 56: Closed
487915 - MM Unit 0 Block 58: Closed
494444 - MM Unit 0 Block 17: Closed
495184 - MM Unit 0 Block 59: Closed
495554 - MM Unit 0 Block 60: Closed
495564 - MM Unit 0 Block 71: Closed
506100 - MM Unit 0 Block 70: Closed
512632 - MM Unit 0 Block 68: Closed
513431 - MM Unit 0 Block 66: Closed
520333 - MM Unit 0 Block 52: Closed
523967 - MM Unit 0 Block 62: Closed
527240 - MM Unit 0 Block 67: Closed
527972 - MM Unit 0 Block 63: Closed
534517 - MM Unit 0 Block 69: Closed
534881 - MM Unit 0 Block 65: Closed
538884 - MM Unit 0 Block 61: Closed
545812 - All done
569598 - Shutting Down

 

 

It's impossible for the queue to be reduced BEFORE the debug message goes out.  But there it is - it happened !

 

I realize that UDP is not guaranteed to send things in the correct order, but they are time-stamped when SENT, and they are NOT out of order.

 

So, HOW in the heck can the queue go empty before the message is sent?

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 26
(3,501 Views)

It's probably unrelated but I recall someone mentioning int he past that destroying an event registration refnum from within the event structure is not a good idea.  I think it might have been Jack Dunaway, I'm not sure.  I'm also not sure how that could play a role here but it's just a random thing I noticed with the code.  I would certainly position that node outside the event structure.

0 Kudos
Message 4 of 26
(3,476 Views)

destroying an event registration refnum from within the event structure is not a good idea.

 

Well, I've tried it both ways - I put it inside just for this last test, and it made no difference.

 

Thanks for your thoughts.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 26
(3,470 Views)

I was thinking that a rogue event with "lock UI" might have been making itself heard.  Not so in that case, sorry.

0 Kudos
Message 6 of 26
(3,466 Views)

After a restart of the computer, it SEEMS like it's faster, but it shows weird signs anyway:

 

012280 - MM Unit 0 Block 12: About to Close
012281 - MM Unit 0 Block 16: About to Close
012282 - MM Unit 0 Block 15: About to Close
012283 - MM Unit 0 Block 13: Closed
012283 - MM Unit 0 Block 66: About to Close
012283 - MM Unit 0 Block 8: About to Close
012284 - MM Unit 0 Block 11: About to Close
012288 - MM Unit 0 Block 14: About to Close
012288 - MM Unit 0 Block 9: Closed
012288 - MM Unit 0 Block 6: Closed
012288 - MM Unit 0 Block 5: Closed
012288 - MM Unit 0 Block 4: Closed
012288 - Queue population: 72
012288 - MM Unit 0 Block 7: Closed
012288 - MM Unit 0 Block 17: Closed
012288 - MM Unit 0 Block 18: Closed
012288 - MM Unit 0 Block 19: Closed
012288 - MM Unit 0 Block 20: Closed
012288 - MM Unit 0 Block 21: Closed
012288 - MM Unit 0 Block 3: Closed
012288 - MM Unit 0 Block 22: Closed
012288 - MM Unit 0 Block 23: Closed
012288 - MM Unit 0 Block 2: Closed
012289 - MM Unit 0 Block 1: Closed
012289 - MM Unit 0 Block 0: Closed
012289 - MM Unit 0 Block 24: Closed
012289 - MM Unit 0 Block 70: Closed
012289 - MM Unit 0 Block 71: Closed
012289 - MM Unit 0 Block 67: Closed
012289 - MM Unit 0 Block 69: Closed
012289 - MM Unit 0 Block 68: Closed
012289 - MM Unit 0 Block 65: Closed
012289 - MM Unit 0 Block 10: Closed
012289 - MM Unit 0 Block 64: Closed
012289 - MM Unit 0 Block 63: Closed
012289 - MM Unit 0 Block 62: Closed
012289 - MM Unit 0 Block 61: Closed
012289 - MM Unit 0 Block 58: Closed
012289 - MM Unit 0 Block 60: Closed
012289 - MM Unit 0 Block 59: Closed
012289 - MM Unit 0 Block 57: Closed
012289 - MM Unit 0 Block 56: Closed
012289 - MM Unit 0 Block 55: Closed
012289 - MM Unit 0 Block 53: Closed
012289 - MM Unit 0 Block 54: Closed
012289 - MM Unit 0 Block 52: Closed
012289 - MM Unit 0 Block 51: Closed
012290 - MM Unit 0 Block 50: Closed
012290 - MM Unit 0 Block 49: Closed
012290 - MM Unit 0 Block 48: Closed
012290 - MM Unit 0 Block 47: Closed
012290 - MM Unit 0 Block 46: Closed
012290 - MM Unit 0 Block 45: Closed
012290 - MM Unit 0 Block 44: Closed
012290 - MM Unit 0 Block 43: Closed
012290 - MM Unit 0 Block 42: Closed
012290 - MM Unit 0 Block 41: Closed
012290 - MM Unit 0 Block 40: Closed
012290 - MM Unit 0 Block 39: Closed
012290 - MM Unit 0 Block 38: Closed
012290 - MM Unit 0 Block 37: Closed
012290 - MM Unit 0 Block 36: Closed
012290 - MM Unit 0 Block 35: Closed
012290 - MM Unit 0 Block 34: Closed
012290 - MM Unit 0 Block 33: Closed
012290 - MM Unit 0 Block 32: Closed
012290 - MM Unit 0 Block 31: Closed
012291 - MM Unit 0 Block 30: Closed
012291 - MM Unit 0 Block 29: Closed
012316 - MM Unit 0 Block 28: Closed
012502 - Queue population: 0
012502 - MM Unit 0 Block 27: Closed
012522 - Waited 308 mSec on Closure
013956 - MM Unit 0 Block 26: Closed
014013 - MM Unit 0 Block 25: Closed
014019 - MM Unit 0 Block 12: Closed
014070 - MM Unit 0 Block 16: Closed
014083 - MM Unit 0 Block 15: Closed
014134 - MM Unit 0 Block 66: Closed
014144 - MM Unit 0 Block 8: Closed
014177 - MM Unit 0 Block 11: Closed
014234 - MM Unit 0 Block 14: Closed
014282 - All done

 

 

It still sees the queue population go to zero BEFORE the messages, which is "impossible".

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 7 of 26
(3,462 Views)

The second run after a restart shows signs of deterioration:

Here's the tail end of the log:

 

044950 - Queue population: 9
044950 - MM Unit 0 Block 16: Closed
044959 - MM Unit 0 Block 15: Closed
044986 - Queue population: 7
045014 - Queue population: 7
045020 - MM Unit 0 Block 12: Closed
045042 - Queue population: 6
045046 - MM Unit 0 Block 68: Closed
045061 - MM Unit 0 Block 20: Closed
045066 - Queue population: 4
045086 - Queue population: 4
045106 - Queue population: 4
045112 - MM Unit 0 Block 0: Closed
045126 - Queue population: 3
045127 - MM Unit 0 Block 2: Closed
045146 - Queue population: 0
045166 - Waited 2104 mSec on Closure
045224 - All done
045224 - MM Unit 0 Block 3: About to Close
045225 - MM Unit 0 Block 1: About to Close
045276 - MM Unit 0 Block 3: Closed
045276 - MM Unit 0 Block 1: Closed
051592 - Shutting Down

 

Still some pouting in the corner, and this time the queue goes empty BEFORE two of the blocks even START to close.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 8 of 26
(3,458 Views)

I would make absolutely sure that you're not either flushing or destroying that queue somewhere else in the shutdown sequence. Maybe put an error indicator on the error output from Queue Status. Of course you should release the queue when you're done with it, but maybe you're releasing it before you're actually done.

 

There are a couple of other things that worry me about your code, particularly the event structure inside a case structure (this is often a bad idea since the event structure will still queue events even when that case isn't active) and the 14-frame stacked sequence structure.

0 Kudos
Message 9 of 26
(3,449 Views)

I would make absolutely sure that you're not either flushing or destroying that queue somewhere else in the shutdown sequence. Maybe put an error indicator on the error output from Queue Status.

 

Well, lo and behold, there IS an error there - Error 1.

 

But I never touch that queue, not even to destroy it, except in two places:

1...  When the block starts, I put an element in, when it stops, I take an element out.

 

 

STOP queue 2.PNG

 

 

2... When I'm checking if eveyone's done.

 

STOP queue.PNG

 

There's nothing to kill it, as far as I can see.  But yet, it complains of an error 1 (bad parameter).  The only parameter is the RefNum, so somebody is killing the queue.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 10 of 26
(3,431 Views)