LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Enqueue Timed out no error - ideas?

Solved!
Go to solution
Solution
Accepted by topic author James_W

After a bit more pondering....

 

HOLD IT! you are enqueueing with a 1msec tmo.   Let's just ask ourselves the silly question "How long does it take to increment the 1msec clock by 1?"  The hardware itself clicks along nicely a 1msec and then the OS calls into the kernel driver to see if the hardware counter incremented so, 0 < Cntr++ <= 1msec.  So, tmo occurs at the variable latency of cntr++ from enqueue call start.  

 

SeeThe help file note 

 

Allign the call start with a short increment and a memory allocation...AND BINGO! you get yourself a hard to replicate enqueue timeout.

 

The 8-Ball is working! Pass the kudos!


"Should be" isn't "Is" -Jay
Message 21 of 48
(3,530 Views)

@JÞB wrote:

After a bit more pondering....

 

HOLD IT! you are enqueueing with a 1msec tmo.   Let's just ask ourselves the silly question "How long does it take to increment the 1msec clock by 1?"  The hardware itself clicks along nicely a 1msec and then the OS calls into the kernel driver to see if the hardware counter incremented so, 0 < Cntr++ <= 1msec.  So, tmo occurs at the variable latency of cntr++ from enqueue call start.  

 

SeeThe help file note 

 

Allign the call start with a short increment and a memory allocation...AND BINGO! you get yourself a hard to replicate enqueue timeout.

 

The 8-Ball is working! Pass the kudos!


Are you saying here that if I put the timeout at zero, it will occur more frequently and it needs to be at >1 then .
(I wonder if thats why I put the timeout is 1 not zero, to reduce this timeout error and I haven't commented it?)🤔
the VI is classed as Time critical and the loop actual contents are :

James_W_1-1639040214774.png

I have no control over the data packet termination, and as its more commonly the sender queue that gets full (rechecked the messages - its a limited queue size on the sender, that defines the buffer. ) if this loop runs too slowly I need the enqueue timeout as small as possible.

Someone else wrote the code originally (I added the timeout) and I've already stripped a string subset function to remove the TCP header and put it in the dequeue loop function (unless that's possibly giving me a performance hit.)
Not sure how using a DVR here works better as I would get a race between Write/EnQ and Read/DeQ?
DeQ turns the string into the required dataset.

Kudos when I'm sure I understand the last post Jay 😉

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 22 of 48
(3,514 Views)

@James_W wrote:

As an aside, the source device strikes me as ill-designed when it has a 19+ MB/sec stream rate, a mere 500 byte buffer, and a hard crash when the buffer fills.

 

-Kevin P


I might have got my numbers wrong, don't know.😉

- They certainly look bad, which makes me think I've got them wrong.

 

Having a look at tow to implement Wiebe's idea at the moment. (Having trouble reproducing the problem, The last test failed to read the TCP port fast enough in the producer loop😣)

 

James


A good old circular would also do the trick.

 

The circular buffer can be either a by wire (data in a cluster or class), FGV (that won't scale up well) or DVR. But if the input is correct, there's no reason a queue wouldn't work.

 

A benefit of a DIY buffer is you can probe it's internals.

 

Of course you could make a base buffer class, with a queue child, a DVR circular buffer child and a FGV buffer child. Then you can switch implementations, even at run time (not during a test of course). 😊

EDIT: Come to think of it, if you want to fill a buffer, the buffer doesn't need to be circular. A simple array (plain, in a class, cluster, FGV or DRV) would work.

0 Kudos
Message 23 of 48
(3,513 Views)

James, let me see a snip of the Obtain Queue code and the deQ loop I want to see what you have there. (inline them please, I'm working on a phone)  post a link to the queue for help file too. I need to refresh my memory on odd effects between tmo -1, 0, and +1.  But, tmo = +1 should be the worst case.  Additionally,  if you set a max Q size, EnQ will block until Queue space is available. 

 

It should be easy to spin up a quick test vi to check timeout behavior ( heck, the shipping examples SHOULD have one)

 

If, the queue IS filling and blocking EnQ we can find ways to spin the DeQ faster and do something like flush the queue into a Collector to dump data chunks to the data consumer.( piggybacking off wiebe with the built-in pt-by-pt pallet)

 

 


"Should be" isn't "Is" -Jay
Message 24 of 48
(3,490 Views)

Now, I'm going to spoil everything you know and like about named queues.

 

ObQ has a max queue size optional input default-1 (unlimited)

 

ObQ also has an optional Name input. If not null the ObQ looks in the application context for an existing queue of that name and either returns the existing ref or creates a new one. 

 

What is not documented anywhere is how the max size input is treated if the queue exists.  Obviously, no matter how it is implemented, you have a loaded gun pointing at one foot or the other (and AQ hasn't told us which toe is going to get shot off.)

 

Frankly, I firmly believe "Named queue detractors" have run up against the undocumented behavior and pulled the trigger.


"Should be" isn't "Is" -Jay
Message 25 of 48
(3,483 Views)

Can't post the DeQ code - it goes towards the core of company IP as I start splitting up the datastream there.
If DeQ lags and queue gets full, design is that EnQ should terminate (FAST), flush the queue and close the TCP connection.


Queue holds a buffer of 5 mins of data - at 200MB/s this would be a 60GB buffer, at 180MB/s this is 54GB. (This is more than most PCs have fitted as standard and comes close to the limit of a server grade machine standard setup) - so you are quite right with your earlier statement of big data and it being a memory allocation delay. I can't afford for the raw data to be split and for processing sent to multiple modules with their own memory spaces for different mathematical operations with this sort of data set size.
DeQ speed is limited by processing modules pulling data out (it enqueues to another queue with a queue size of 5 for processing).

James_W_0-1639060232154.png


I'm currently looking to see if the timeout might be caused by running out of physical memory on the PC, and therefore causing slightly more delay at the EnQ step - I'm not sure  if this is the issue as the data rate was low when this was reported, and I'm now stressing it at higher rates to try and induce performance related issues faster.

I've tried compiling with the name removed but not noticed any difference in performance. I pulled the EnQ back out of a subVI and it started spinning slightly faster (don't know why - I think I'm reaching threading limits).
This program is the most intensive program I've ever come across and pushes the boundaries of what a multicore machine can do in real time (and it needs a slightly better architecture - but where to optimise without breaking is difficult). You couldn't write this in anything other than LabVIEW though 😁

James_W_1-1639061144838.png

Basic setup of obtain queue above (doesn't matter if named)

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 26 of 48
(3,481 Views)

@James_W wrote:

Queue holds a buffer of 5 mins of data - at 200MB/s this would be a 60GB buffer, 


Yes, if you enqueue bytes.

 

If you enqueue strings, it's an 8 bytes pointer + a minimum string size word of 2 bytes per element.

 

So it's 60GX10 = 600 GB.

 

For all empty strings.

 

This might become a problem while filling the queue... A timeout might be the result.

Message 27 of 48
(3,477 Views)

@JÞB wrote:

Now, I'm going to spoil everything you know and like about named queues.

 

ObQ has a max queue size optional input default-1 (unlimited)

 

ObQ also has an optional Name input. If not null the ObQ looks in the application context for an existing queue of that name and either returns the existing ref or creates a new one. 

 

What is not documented anywhere is how the max size input is treated if the queue exists.  Obviously, no matter how it is implemented, you have a loaded gun pointing at one foot or the other (and AQ hasn't told us which toe is going to get shot off.)

 

Frankly, I firmly believe "Named queue detractors" have run up against the undocumented behavior and pulled the trigger.


🤣 Lovely description, but as I always check to see if the Queue exists before creating, not a problem for me (and I created my named Queue from a static, re-entrant VI which holds name, datatype and size in 😉).

I think I remember AQ mentioning in a post somewhere how this works (years ago). I think when a ObQ first runs, the name and size is defined and "added to a list". It cannot be changed until it has been released everywhere and removed from the list, so if you call it first with size 5 and then call it again with size -1, size is still 5 until all queue references have been closed to to that queue name in the application context. - so I know which toe gets shot off if I don't have a race condition 😉

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
Message 28 of 48
(3,476 Views)

wiebe@CARYA wrote:

@James_W wrote:

Queue holds a buffer of 5 mins of data - at 200MB/s this would be a 60GB buffer, 


Yes, if you enqueue bytes.

 

If you enqueue strings, it's an 8 bytes pointer + a minimum string size word of 2 bytes per element.

 

So it's 60GX10 = 600 GB.

 

For all empty strings.


🤒 I'm going home now. I messed up that one bad ☠️
🤔 I'm already at home due to Covid regs. That doesn't work 😂

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
Message 29 of 48
(3,474 Views)

Show the string display format!  I can't see that it really is an empty string!

 

And fix the math:)

 

For those playing along (regardless of if they actually press the dang Kudos button,) James' picture of the help file DOES show a link to a queue Overflow and Underflow shipping example.  

 

James,  I believe you on the undocumented implementation BUT, since it has never been documented...it is subject to change without comment in the release notes.  So verify the behavior by modifying a copy of that shipping example.  Post results.

 

Yeah, homework for you! Plenty of time there with COVID 

 


"Should be" isn't "Is" -Jay
Message 30 of 48
(3,463 Views)