Why is SQL not being updated?


Badge +4

After months of work we finally got our first workflow into production around January.  Since then it's been used by the business owners with little issue.  Suddenly, though, we're being told of an error that they now realize has been randomly happening since our initial deployment and our team is struggling to figure out what the cause is.

 

Background:

 

- The K2 database and our own K2ApplicationData database reside on the same server.  We technically have two servers, though, and K2 actually connects via a listener that load balances between the two.

 

- Our process sends an email with a link to a form that allows the customer to complete their task.  When the task is completed by the user, we use a SmartObject to update a table entry in the K2ApplicationData database.  If the task is not completed by the user within 30 days the task is automatically completed and we use the same SmartObject to update a table entry in the K2ApplicationData database.  These table entries simply update a Status field, setting the value from "In Process" to either "Accepted" or "Expired".  

 

- Because of the above functionality, when a task is complete the table entry in the K2ApplicationData database must be set to either "Accepted" or "Expired".  A completed task or task older than 30 days that still shows as "In Process" means we have an issue.

 

Our issue is that a small percentage of tasks have been completed however their entry in the K2ApplicationData database is still set to "In Process".  

 

Why?  How can this happen?  The K2 and K2ApplicationData database are on the same server, so if one is down then both are down, right?  This means we can't update the task in K2, setting it to complete, but not access the K2ApplicationData database.  Even if we could wouldn't there be some "cannot connect" error somewhere?  No errors have been found in the logs, the error profiles or presented to the user.  I've talked with our DBA and he says an UPDATE command sent to the K2ApplicationData database cannot silently fail.  

 

Due to the nature of the workflow the update to the K2ApplicationData database must complete before K2 considers the task complete, and looking at the logs of all these tasks that step completed without error.  

 

Any ideas?  Could it be related to how we have our SQL environment setup?

 

Thanks


2 replies

Userlevel 5
Badge +18

If this same Smartobject and update method is called using the Smartobject Service Tester tool, does it update that column successfully?


 


How is your SQL service instance compare to a working environment?  Staging/Development/QA?


 


10811i0CE3D76A060B83BE.png


 

Badge +4

tin, 

 

Our setup is pretty much the same across all environments, minus the changes in server names.  If we use the Service Tester everything gets updated properly.  In fact, even using the workflow itself everything gets updated properly except in these rare situations.  

 

That said, we believe we fixed the issue.  We put in a ticket on what we thought was an unrelated issue to K2 and they gave us this link:  http://help.k2.com/kb001572  This was to fix a recurring issue we have when our active database server fails-over to the secondary; anytime this happened we'd get an error with the SCSSOKey.  After more investigation into both issues I realized that the strange issue I described in this post ONLY happened during the brief period when the SCSSOKey error was present.  All workflows that completed during this time had this behavior, and this behavior was never seen at any other time.  So, it appears somehow (I'm still not entirely sure how) when the database fails-over to the secondary some of the data is lost.  Our DBA's assure me that data is replicated between the two, but it looks like there's a small crack somewhere the data falls into and gets lost.

 

Anyway, using the article K2 sent us we created a script that would run when the database server fails-over.  We no longer have the SCSSOKey error in this situation, so hopefully this other issue is also resolved.

 

Thanks!

Reply