DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Request and Wait for Reply with long timeout

Solved!
Go to solution
Hi everyone,

my labview project has several DQMH modules. One of these has a request and wait for reply event with a long timeout. i want to know what do you mean when you saiy:

"5. If the Request and Wait for Reply event is going to wait for a long time, make sure the code handling the request is registered to the stop module event and is able to abort the MHL case if the stop module event is received before the waiting period is over."

here

https://delacor.com/dqmh-documentation/dqmh-best-practices/#:~:text=WhenaDQMHModulehas,therequestwil....

how can i make sure that the code handling the request is registered to the stop module event and is able to abort the MHL case if the stop module event is received before the waiting period is over?

thank you

Michele
0 Kudos
Message 1 of 7
(1,968 Views)

In this case I use a request only and as reply I send a broadcast. In this way the calling process isn't blocked. All you have to do is to register for the broadcasts and wait for it. 

Message 2 of 7
(1,957 Views)

Hi Ludwig,

 

if i need to control how long it takes to do the task (the time between the request event and the broadcast event), i think that i need to develop a timer and integrate it into the main vi to do it, correct?

 

what is the meaning of:

 

"5. If the Request and Wait for Reply event is going to wait for a long time, make sure the code handling the request is registered to the stop module event and is able to abort the MHL case if the stop module event is received before the waiting period is over."

 

how do i implement it in the code?

 

thank you for the reply

0 Kudos
Message 3 of 7
(1,944 Views)

@Michele__ wrote:

if i need to control how long it takes to do the task (the time between the request event and the broadcast event), i think that i need to develop a timer and integrate it into the main vi to do it, correct?

I would implement a tick count vi at the target module when the request is called. When the task is done you can calculate the time difference and send it back with the broadcast.

 


@Michele__ wrote:

what is the meaning of:

 

"5. If the Request and Wait for Reply event is going to wait for a long time, make sure the code handling the request is registered to the stop module event and is able to abort the MHL case if the stop module event is received before the waiting period is over."

 

how do i implement it in the code?


The message handling loop (MHL) of each module handles any requests as well as the stop request. If you call request and wait for reply and it takes a long time for the reply, then the MHL can't handle any other requests and is blocked. In the worst case, this could mean that the entire framework no longer works because no internal requests can be handled. Normally each DQMH module has a timeout of 5 seconds to avoid such traps. 

0 Kudos
Message 4 of 7
(1,930 Views)
Solution
Accepted by Michele__

Hi Michele,

I'm not sure my solution is the right one because I never had a use case where I had to implement it.

Anyway, I would try to implement #5 of the document like this. Code is crapy, but the idea is to destroy the notifier if you receive the stop module event of the module calling the request.  

 

2022-03-11_17-07-42.png

 

To be tested, obviously.

 


Olivier Jourdan

Wovalab founder | DQMH Consortium board member | LinkedIn |

Stop writing your LabVIEW code documentation, use Antidoc!
Message 5 of 7
(1,905 Views)

Interesting solution Olivier, but the MHL will still be stuck processing the request?

 

When Fab says "make sure the code handling the request", is she referring to the calling code or the case in the MHL that owns the request? 

 

It would make sense to me that the MHL ensures it doesn't take too long to carry out the request, and it completes (or aborts with error) the task within the timeout specified in the Request VI.

Christopher Farmer

Certified LabVIEW Architect and LabVIEW Champion
DQMH Trusted Advisor
https://wiredinsoftware.com.au

Message 6 of 7
(1,880 Views)

You're right, Chris. I read them the #5 too fast. You obviously need to handle the thing in the MHL that actually handles the request if you want the module to stop.

In my solution, I handle one part of the rare corner case where you would like to stop a module that waits for a reply that takes a long time to respond without stoping the module that handles the event. It could happen when you clone a module to address a specific task for a limited amount of time on a particular occasion.

 

As I said, I didn't come across this kind of use case so far, and it's a thing to think about for more than 5 minutes.

 

If I go back to the original question, I would probably try to implement the same kind of mechanism to know if a stop module has been sent and try to stop the code before completion in the MHL case that handles the request.

 

I'm curious to know if developers have come across this use case in an actual situation and how they are dealing with it.

 


Olivier Jourdan

Wovalab founder | DQMH Consortium board member | LinkedIn |

Stop writing your LabVIEW code documentation, use Antidoc!
0 Kudos
Message 7 of 7
(1,856 Views)