LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reentrant web method VIs

The only mention I've found anywhere about using multiple web method instances is in this post:

 

"If the web method VI is marked reentrant, than multiple requests can be handled concurrently (and your application logic should account for that fact).  If the web method is not marked reentrant, than only one request at a time can call the VI and subsequent request threads will block waiting to be able to call your VI." darenw, talking about web services in 8.6.

 

This makes plenty of sense and is what I expect. However, I find this not to be the case [using 2010 SP1]. My example is very simple:

 

Make the web method VI consist only of a "Wait (ms)" function set to wait for 10000 ms [10 s]. Check the "reentrant execution" box in the VI Properties dialog. Add the web method VI to a RESTful Web Service build spec and build and deploy. Then type the URL for the web method into two browser windows and send both queries at close to the same time. The first window will take 10s waiting for a response before finishing, as expected. The second window will take 20s--apparently the second instance of the web method VI does not start running until the first instance is completed.

 

Not only does this conflict the the quote above, but it's a poor behavior for web services in general [and it's fatal to my application in particular]. [To be complete I should add that running the web method VI in multiple parallel instances in the same container VI results in a 10s run as expected].

 

Is this a bug or what?

 

[this is an appendage to this ongoing discussion but is distinct enough from the original topic that I decided it should get its own--I apologize for the clutter if that was the wrong decision]

0 Kudos
Message 1 of 11
(3,919 Views)

I was able to reproduce the same issue that you're talking about in LV 2010 as well as 2010 SP1 with a re-entrant VI.  I'm in the process of trying the same thing using LV 8.6 and 2009 to see if I can re-create the problem there as well.  I'll let you know what I find and if it is, in fact, an issue with just LV 2010.

 

Regards,
Austin S.

National Instruments
Academic Field Engineer
0 Kudos
Message 2 of 11
(3,885 Views)

I reproduced the issue on 2009 and 8.6 as well.  Have you actually tried running this web method VI in 8.6?  If you did and were able to make it work correctly, the next step is to figure out if any settings/ configurations were changed between versions.  If you haven't tried it on 8.6, then we'll try to figure out if it's a setting in LV causing this or a web server setting of some sort.

Regards,
Austin S.

National Instruments
Academic Field Engineer
0 Kudos
Message 3 of 11
(3,863 Views)

Austin: I appreciate the help!

 

I don't have access to 8.6. It's hard to understand how this could be an intentional feature unless LabVIEW believes that web services users will only be serving single clients.

 

0 Kudos
Message 4 of 11
(3,859 Views)

I just noticed something else, perhaps this is why this behavior has gone unnoticed:

 

When I run instances of the web method VI on two different computers, they run as reentrant VI's just fine. Two browsers in the same computer? Not so much. This should at the very least give a clue as to what's going on. It also means that the behavior isn't going to affect very many users very often.

0 Kudos
Message 5 of 11
(3,834 Views)

Thanks for the additional info.  That'll help us try to narrow this down.  That's good to hear that it does actually work in different browser windows, though.

Regards,
Austin S.

National Instruments
Academic Field Engineer
0 Kudos
Message 6 of 11
(3,826 Views)

Just to be clear:

 

It DOES work on two different computers.

It DOESN'T work in two browser windows on the same computer.

 

 

0 Kudos
Message 7 of 11
(3,823 Views)

That's what I meant, but I worded that poorly.  Thanks for the clarification.

Regards,
Austin S.

National Instruments
Academic Field Engineer
0 Kudos
Message 8 of 11
(3,820 Views)

Just some more clarification

 

I did a similar test to pltrogon using LabVIEW 2010 SP1 on Windows Server 2008 R2 with a VI which waits 10 seconds and then returns the current time (hour/minutes/seconds). This web service VI is set to be re-entrant with the 'preallocate clone for each instant' option. It turns out the browser you use makes the difference, as seen from the time stamps returned:

 

  • Internet Explorer 9 executes the requests in parallel so multiple instances run at the same time. Five concurrent requests cause no difficulties.
  • Firefox 5 executes the requests in series. That is, it sends the second request as soon as the response to the first one has arrived.

 

That's why getting the page on two different computers shows the expected re-entrant execution.

 

As a check, if I set the VI to be not re-entrant, only one instance of the VI runs at the time, as seen from the times returned in the browser window.

 

My conclusion:

LabVIEW (2010 SP 1) is doing what is expected, you just have to use a client which sends multiple requests to the same page at the same time, and doesn't let the second request wait until the first request is finished.

Message 9 of 11
(3,781 Views)

Any progress on this? I had forgotten about this issue, and now on our big deployment night, people are only streaming data at (data rate)/(number of clients active), regardless of browser [firefox, ie, chrome]. I should note that this situation is different than the one biggeveen addressed because we're dealing with multiple clients sending single requests. I am not observing reentrant behavior even though I should.

0 Kudos
Message 10 of 11
(3,719 Views)