NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Opening Database in ProcessSetup throws error

Hi all, 

 

 

I am having a strange issue regarding a database connection. My goal is to open the DB connection in the  ProcessSetup callback and to close it in the ProcessCleanup callback. I am using the LV database toolkit.

 

When I open the DB in ProcessSetup, I write the DB reference to FileGlobals.DatabaseRef. My first attempt at writing to the DB is then in a subsequence of the MainTest callback. When any DB VIs try to execute I get the error shown in the attached file "Error Message.png". 

 

Interestly, if I open the DB in the MainTest callback, everything works correctly.

 

Any ideas as to what could be causing this? I have set all executions to share FileGlobals in SequenceFileProperties. I have also traced the database reference and its value is set in ProcessSetup and is the same in the MainTest callback. I have attached images of the variable in three break points:

 

  1. Process Setup - "Process Setup after opening DB.png"
  2. Begining of Main Test subsequence  - "Main Test Subsequence begining.png"
  3. Before DB write in Main Test subsequence before first DB write  -  "Main Test SubSequence before DB write.png"

 

Thanks!

 

 

 

TS Version: 2014 SP1

LV Version: 2014 SP1

0 Kudos
Message 1 of 6
(4,220 Views)
0 Kudos
Message 2 of 6
(4,218 Views)

Maybe make sure the Reserve Loaded VIs Option is selected in the LabVIEW Adapter Configuration. Perhaps the reference is being closed before it is supposed to be. Does this error occur every time?

LabVIEW Adapter Configuration.png

Michael Bilyk
Former NI Software Engineer (IT)
0 Kudos
Message 3 of 6
(4,158 Views)

Hi AgentAstronaut,

 

Reserve loaded VI's is selected. The error does happen every time.

 

I was able to come up with a simple solution. I threw an IF statement at the begining of my main sequence, If(DatabaseRef <=0) (Open Database). This worked well in the development system, but on deployment its not working as intended. The first time I run the test socket it works, if I restart the socket I get the same Error #1... Bangs head on wall...

0 Kudos
Message 4 of 6
(4,138 Views)

Hi ademedeiros,

 

- What process model are you using?

- Are the module settings set to load and unload dynamically?

- By "restart," do you mean completing stopping execution and starting a new execution?  Or just running a new UUT?  I would want to be sure that ProcessSetup is actually called the second time.

- Are the VIs saved in the same version of LabVIEW?

Michael Keane
National Instruments
Message 5 of 6
(4,103 Views)

I would suggest adding code to the Setup seqeunce, like an assert, that validates that the handle is valid. It could be that the handle is not valid and is negative.

Scott Richardson
0 Kudos
Message 6 of 6
(4,083 Views)