09-28-2011 02:59 AM
I confirm that:
I can be wrong but as I wrote in one of the previous messages, I think the problem is the following:
sometimes when I call CNVStartProcess() the variables (that have been properly created, as shown in Distributed System Manager) are deleted. The process is not deleted.
Could you suggest me a way to deeply debug what happens when I call CNVStartProcess()?
09-28-2011 02:18 PM
Vix,
It could be that there is a hang in the shared variable engine. We can determine this if not only do the variables in your buf-Test process disappear, but if all variables disappear. You can manually create a process and variables in the Distributed Systems Manager, then restart the system and run through the code again. Check before and after starting the process to see if not only do your buf-Test variables exist, but also to see if your manually created variables exist. If the all variables do not display when expanding the process tree, then we know that the shared variable engine likely hung and we can begin debugging that.
09-29-2011 01:41 AM
I did what you suggested me, but the Shared Variable Engine isn't hung. Only buf-Test variables are deleted when I call CNVProcessStart().
Other variables aren't deleted and are updated regularly.
09-29-2011 05:24 AM
When the program doesn't run, if I try to stop the variable engine through Administrative tools >> Services I have the error 1067 "Termine imprevisto del processo" (in Italian).
After having restarted the Variable Engine, the first time CNVCreateBufferedWriter() fails with error -6382 "Socket has been disconnected by its peer", then (from the second time) with the usual "Could not complete operation in specified time".
I want to clarify that I work with Win 7 64-bit with a user without administrative rights.
Moreover I notice a strange behavior: during application development using CVI, it happens that after having changed some lines of code and having rebuilt the application, it CNVCreateBufferedWriter fails, and I must re-start my PC.
This morning I've already restarted 7 times!!!!!!!!
This problem is really urgent. I can't develop an application in this situation.
09-29-2011 03:57 PM
In NetVar_ReserveHandle you check if the process exists, then stop and delete this process if it does exist. Then you create a new process. I am concerned that during startup this may not happen as explicitly as expected. The shared variable engine may not be fully ready to delete the process, then when it is ready it deletes the process, but your application has moved on. Could you try double checking if the process exists by successfully browsing to it before you delete it. Alternatively, you could avoid deleting the process and reuse the process and variables instead.
It would also be interesting to see if this is limited to only buffered writers. What about buffered subscribers, or non buffered operations?
Do you have access to admin privileges that you could check to see if it shows the same behavior?
What happens if you put a delay into the code at the beginning. I understand this may not be ideal for you application, but it would be interesting for troubleshooting purposes to see if the behavior changes if a delay of 5-10 seconds is placed at the beginning.
09-30-2011 02:24 AM - edited 09-30-2011 02:25 AM
In NetVar_ReserveHandle you check if the process exists, then stop and delete this process if it does exist. Then you create a new process. I am concerned that during startup this may not happen as explicitly as expected.
The problem is not during startup: it's exactly the opposite!!!! One of the best ways to have the application working is to launch it as soon as possible after the system startup.
The shared variable engine may not be fully ready to delete the process, then when it is ready it deletes the process, but your application has moved on. Could you try double checking if the process exists by successfully browsing to it before you delete it.
This workaround doesn't work.
Alternatively, you could avoid deleting the process and reuse the process and variables instead.
If I don't delete the process, CNVVariableExists() returns that variable exist, but I can't see it in Distributed System Manager!!!! So this doesn't work.
It would also be interesting to see if this is limited to only buffered writers. What about buffered subscribers, or non buffered operations?
They work, because the NVBuffering example (that has a non-buffered writer and a buffered subscriber) works as expected.
Do you have access to admin privileges that you could check to see if it shows the same behavior?
Unfortunately I don't.
What happens if you put a delay into the code at the beginning. I understand this may not be ideal for you application, but it would be interesting for troubleshooting purposes to see if the behavior changes if a delay of 5-10 seconds is placed at the beginning.
This doesn't make any difference.
Hope this helps.
09-30-2011 06:56 AM
... only to say that I made all the test in the previous message after the application has failed for the first time (and the Variable Engine probably has run into unexpected situation).
Then I modified my code and I don't delete the process if it already exists: I let you know if this modification will work.
10-04-2011 04:05 AM
I can confirm that not deleting the process if it already exists doesn't help solving this problem.
Let me know...
10-05-2011 11:06 AM
Hey Vix,
I wanted to post back and let you know that I did not forget about you. We are still looking into how we can debug this issue further. I should have some more details soon.
10-05-2011 06:00 PM - edited 10-05-2011 06:01 PM
Vix,
Let's make sure that the MXS service is started before you run your application. And while we are at it, we can test to see if the variable engine is running as well. Here is some code that will do it.
SC_HANDLE SCManager; SC_HANDLE SCHandle; BOOL isConnected; SERVICE_STATUS ServiceStatus; DWORD status = 0; do { SCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT); SCHandle = OpenService(SCManager, "mxssvr", SERVICE_QUERY_STATUS); isConnected = QueryServiceStatus(SCHandle, &ServiceStatus); status = GetLastError(); }while(ServiceStatus.dwCurrentState != SERVICE_RUNNING); do { SCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT); SCHandle = OpenService(SCManager, "NITaggerService", SERVICE_QUERY_STATUS); isConnected = QueryServiceStatus(SCHandle, &ServiceStatus); status = GetLastError(); }while(ServiceStatus.dwCurrentState != SERVICE_RUNNING);
Here I am using QueryServiceStatus and other service Win API functions.