dpDisconnect() sometimes returns error (maybe due to still pending runs)
Search
dpDisconnect() sometimes returns error (maybe due to still pending runs)
I have script in a control manager that is basically calculating an overall status based on a list of status information form devices.
For that purpose I'm connecting to a list of DPEs and in the CB function I'm calculating the status.
This calculating is not always active, meaning that based on commands via other DPEs I'm executing a dpConnect() respectively a dpDisconnect().
Sometimes the dpDisconnect() returns an error and afterwards the CB is still reacting on the value changes and calculates the overall status.
I made some tests and it seems that the dpDisconnect() fails if there are still pending runs in the queue for the CB function.
Is there a way to check the number of pending runs for a given CB so I can execute the dpDisconnect() when it is ok?
For that purpose I'm connecting to a list of DPEs and in the CB function I'm calculating the status.
This calculating is not always active, meaning that based on commands via other DPEs I'm executing a dpConnect() respectively a dpDisconnect().
Sometimes the dpDisconnect() returns an error and afterwards the CB is still reacting on the value changes and calculates the overall status.
I made some tests and it seems that the dpDisconnect() fails if there are still pending runs in the queue for the CB function.
Is there a way to check the number of pending runs for a given CB so I can execute the dpDisconnect() when it is ok?
Re: dpDisconnect() sometimes returns error (maybe due to still pending runs)
just quickly checked the code. dpDisconnect does not fail depending on pending runs.
You probably called dpDisconnect when it was already disconnected before.
You probably called dpDisconnect when it was already disconnected before.
Re: dpDisconnect() sometimes returns error (maybe due to still pending runs)
I checked the code but the dpDisconnect gets only called once.
In the meanwhile I figured out that the disconnect does not fail directly when disconnecting while runs are pending but at the subsequent disconnect (of course after a successful connect).
Steps how I'm running into this problem:
1. dpConnect() -> OK
2. dpDisconnect while pending runs -> OK (CB function really does not react on value changes)
3. dpConnect() -> OK
4. dpDisconnect (with or without pending runs) -> returns error, CB function still reacts on value changes
I checked also the list of DPEs that are given to the dpConnect/Disconnect() and in all cases the list of DPEs is equal.
Is there a way to get more details why a dpDisconnect throws an error? I tried already getLasError() but it just tell that dpDisconnect returned with error.
In the meanwhile I figured out that the disconnect does not fail directly when disconnecting while runs are pending but at the subsequent disconnect (of course after a successful connect).
Steps how I'm running into this problem:
1. dpConnect() -> OK
2. dpDisconnect while pending runs -> OK (CB function really does not react on value changes)
3. dpConnect() -> OK
4. dpDisconnect (with or without pending runs) -> returns error, CB function still reacts on value changes
I checked also the list of DPEs that are given to the dpConnect/Disconnect() and in all cases the list of DPEs is equal.
Is there a way to get more details why a dpDisconnect throws an error? I tried already getLasError() but it just tell that dpDisconnect returned with error.
Re: dpDisconnect() sometimes returns error (maybe due to still pending runs)
I've tested it with the given procedure and I could reproduce the problem you have described.
Our developers will have a look at it.
In CTRL there is no possibility to get more information than using getLastError().
To avoid the problem you can maybe use a different approach.
You do the connect only once and it is active all the time. At the beginning of the work function you check if the calculation shall be made or not, e.g by reading a script global variable which is set by another connect which only gets this specific information.
Best Regards
Leopold Knipp
Senior Support Specialist
Our developers will have a look at it.
In CTRL there is no possibility to get more information than using getLastError().
To avoid the problem you can maybe use a different approach.
You do the connect only once and it is active all the time. At the beginning of the work function you check if the calculation shall be made or not, e.g by reading a script global variable which is set by another connect which only gets this specific information.
Best Regards
Leopold Knipp
Senior Support Specialist
Re: dpDisconnect() sometimes returns error (maybe due to still pending runs)
Thanks for the info, I'll wait for the outcome of your developers
Just one small detail: I'm currently using WinCC OA 3.13P17 on Windows Server 2008R2
Just one small detail: I'm currently using WinCC OA 3.13P17 on Windows Server 2008R2
Re: dpDisconnect() sometimes returns error (maybe due to still pending runs)
It might take some time until we get more information from the developers as this issue has only low priority.
As suggested in the last answer you should think about using a different approach, otherwise the calculation probably runs when it is not intended to do so.
Best Regards
Leopold Knipp
Senior Support Specialist
As suggested in the last answer you should think about using a different approach, otherwise the calculation probably runs when it is not intended to do so.
Best Regards
Leopold Knipp
Senior Support Specialist
Re: dpDisconnect() sometimes returns error (maybe due to still pending runs)
Hello, I have the same problem here.
I dpConnect then dpDisconnect and sometimes it works, sometimes it fails.
When it fails, my system is messed up.
Could we get a dpDisconnectAll function or something that can get ride of that problem easily?
Thanks
I dpConnect then dpDisconnect and sometimes it works, sometimes it fails.
When it fails, my system is messed up.
Could we get a dpDisconnectAll function or something that can get ride of that problem easily?
Thanks
-
- Posts: 634
- Joined: Mon Aug 02, 2010 10:37 am
Re: dpDisconnect() sometimes returns error (maybe due to still pending runs)
Perhaps you can work around it by using the function 'dpConnectUserData' with unique user data.
Re: dpDisconnect() sometimes returns error (maybe due to still pending runs)
A dpDisconnectAll() function will not help as the disconnect already fails.
If you want to clean up all connects close the panel or restart the script (if using a CTRL manager).
As suggested in a previous post you could keep the connect running all the time and decide in the work function if it needs to be processes or not.
Best Regards
Leopold Knipp
Senior Support Specialist
If you want to clean up all connects close the panel or restart the script (if using a CTRL manager).
As suggested in a previous post you could keep the connect running all the time and decide in the work function if it needs to be processes or not.
Best Regards
Leopold Knipp
Senior Support Specialist
-
- Posts: 21
- Joined: Wed Sep 21, 2016 12:26 pm
Re: dpDisconnect() sometimes returns error (maybe due to still pending runs)
Hi Leopold Knipp,
in your previous post you suggested
"To avoid the problem you can maybe use a different approach.
You do the connect only once and it is active all the time. At the beginning of the work function you check if the calculation shall be made or not, e.g by reading a script global variable which is set by another connect which only gets this specific information."
I'm trying to implement this into a redundent system, however during switchovers global variable values become unusable. Do you have any advice on how to handle this?
Thank you
in your previous post you suggested
"To avoid the problem you can maybe use a different approach.
You do the connect only once and it is active all the time. At the beginning of the work function you check if the calculation shall be made or not, e.g by reading a script global variable which is set by another connect which only gets this specific information."
I'm trying to implement this into a redundent system, however during switchovers global variable values become unusable. Do you have any advice on how to handle this?
Thank you