FactorySQL calling stored procedured twice

We are having an intermittent issue with FactorySQL calling a stored procedure a second time before the results come back.

We are running version 4.2.12 and connecting to Microsoft SQL server 2008.

I have put debug code in trying to figure out what is causing FactorySQL to call it twice, but there seems to be no explanation.

I am hoping someone here can assist me.

Thank You.

Hi,

Are there any messages in the FactorySQL log (Help>Log Viewer)?

How is the group set up? What is the update rate, and is there a trigger? If so, how is it set up? Do you have any idea how long the stored procedure takes to run? The most likely situation is that the group is being triggered or running multiple times, not that a single execution is calling the stored procedure twice.

Regards,

It’s not happening all the time … but we put debug statements in our sql stored procedures to capture additional information. When it does happen … it is ALWAYS 1 minute later that the stored procedure is called again.

We have the logs set at 1000, but log viewer only seems to be keeping the last 24 hours of logs. So I don’t seem to have a log for when the issue actually happened. We were going to add debug logs also to see if that would help us retrieve additional information.

What is the impact to changing from say 1000 logs to 7 days and adding debug logs?

Right now when I open log viewer there is only 89 logs from today.

Hi,

First off, I really wouldn’t recommend changing the log settings at all. DEBUG can be very detrimental to performance, and changing it to a time limit instead of count limit can be bad as well.

Instead, can you give me details about how the group is set up (the second set of questions above)? It the group rate set to 1 minute? If so, and if there is a trigger involved, it’s possible that the group is not seeing the trigger reset in time, and so fires again.

Regards,

Ok … thanks for the information. I believe we are seeing a communications issues (Slow Network) with the PLC and FactorySQL every so often. The group settings are every 1 minute and that would explain why we are seeing the event triggered a 2nd time if the PLC does not reset the event trigger within that 1 minute. We are going to increase the group time to 2 minutes and see if our issue goes away.

Hi,

Also, you might take a look at Settings>Service Settings>OPC Update Rate %. When a group subscribes to values, it subscribes at a percentage of the group rate. I believe the default is 50%, but if yours is set to 100%, you could try setting it lower, like 33%. This means that if the group is set to 1 minute, the opc values will be subscribed at 20 seconds, increasing the chances that the value will come in before the next execution. If you’re having a problem with slow communication, though, this could actually have the opposite effect, as it could add more load.

If you set the group to “only execute once when trigger is active” (on Trigger tab), you should be able to prevent the two executions in a row. However, then you’re potentially opening up another problem: what if the event actually triggers twice in a row? This depends on what you’re tracking. If the events far apart, this isn’t really a problem.

Regards,