LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Datasocket Generic error 42 on window minimize

Solved!
Go to solution
I am using LabVIEW Datasocket connections on LabVIEW 2009 to write to a Kepware OPC server.  I am writing 64 tags.  It works as expected with local as well as remote OPC server.  The loop that writes each value is able to run and properly update values with a 10ms wait inside the loop.  I only run in to problems when I minimize or restore the front panel, the block diagram and/or the probe window.  I receive error 42:  Generic error from Datasocket Open.vi.  This seems unrelated to DCOM issues that seem to be the usual cause of this error.  I have tried this with local and remote OPC servers, and I have the same result.  Adjusting the loop rate helps, but 1 second seems to be as fast as it will run without throwing errors on minimize.  With a 1 second wait, it takes more than a minute to update the 64 tags, which is unacceptable for my project.  It's easy enough to just not minimize the windows while it is running, but this shouldn't be a problem.  I've also noticed that many times when trying to restore a minimized window while the program is running, I have to click the window in the taskbar several times before it restores.  I am running this on a Dual Core 2.8GHz system with 4GB RAM, so system performance shouldn't be an issue.  Any ideas or suggestions or additional troubleshooting steps are welcome.  Thanks.
0 Kudos
Message 1 of 9
(5,587 Views)
0 Kudos
Message 2 of 9
(5,576 Views)
That doesn't seem to apply.  I can write just fine until I minimize a window.  When I minimize, it throws an error.  As best I can tell, it's a bug.  It's also possible I'm doing something wrong.  I'll reply with a screen shot of the code in the next few minutes.  Unfortunately, the code isn't easy for others to test since it requires Kepware OPC server and the proper tags.
Message Edited by ejensen on 06-11-2010 08:40 AM
0 Kudos
Message 3 of 9
(5,568 Views)

See the image below for the Datasocket loop.

 

DSLoop.PNG

0 Kudos
Message 4 of 9
(5,562 Views)

ejensen wrote:

See the image below for the Datasocket loop.

 

DSLoop.PNG


 

Two idea that may help but I can't guarentee.

 

1) Do the open once and close once after and just repeat the DS writes.

 

2) Under Start >>> Setting >>> Control Panel >>> System got to the Advanced Tab and choose Performance Settings then click the Advanced tab there. In the Process scheduling click the "Background services" button.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 9
(5,557 Views)

Thanks for the suggestions.  I tried setting to background services, but it didn't help.  I also switched the computer to best performance so minimize and restore are no longer animated.  Watching CPU and RAM, it don't know that this is a resource issue.  After a bit more experimenting, it only seems to throw errors when I click the minimize button.  When I right click in the taskbar and click minimize, I have never seen the error.  When I click the minimize button, it happens almost every time.

 

Your suggestion to open/close once and write multiple times sounded good until I went to implement it.  For OPC, I have to open a connection to the specific tag that I want to write to.  There may be a way to open a connection to the server then specify the tags one at a time, but I'm not aware of it.

0 Kudos
Message 6 of 9
(5,551 Views)
Solution
Accepted by topic author ejensen

ejensen wrote:

Thanks for the suggestions.  I tried setting to background services, but it didn't help.  I also switched the computer to best performance so minimize and restore are no longer animated.  Watching CPU and RAM, it don't know that this is a resource issue.  After a bit more experimenting, it only seems to throw errors when I click the minimize button.  When I right click in the taskbar and click minimize, I have never seen the error.  When I click the minimize button, it happens almost every time.

 

Your suggestion to open/close once and write multiple times sounded good until I went to implement it.  For OPC, I have to open a connection to the specific tag that I want to write to.  There may be a way to open a connection to the server then specify the tags one at a time, but I'm not aware of it.


My bad!

 

I missed the fact you were looping through multiples.

 

So change my suggestion too

 

Move the Open into a For loop taht executes only once and use an output tunnel on that For loop to create an array of references. One reference for each DS connection. Use that Array of conncetion refs INSTEAD of the name array to control you mainf For Loop. Similary to close them.

 

Now please excuse the following

 

One Loop to open them all.

One Loop to read them.

One Loop to close them all,

The Data sockets bind us.

 

Groans welcome.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 9
(5,545 Views)
That seems to have resolved the problem.  I no longer throw errors when minimizing, and the system seems much more responsive.  Thanks for your suggestions.
0 Kudos
Message 8 of 9
(5,516 Views)

Thanks for the update. looking back I have to guess that it was the Opening that was impacted by the screen minimizing, so by doing the open once and re-suing the same references, we were not invoking the Open functions and therfore no delays.

 

Makes sense to me!

 

Thanks,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 9
(5,508 Views)