Upgrades Questions on upgrading to version 4.x.
Version 4.x > Upgrades > Error at SchedulingExecutor.ReInitCorruptedTasks() after upgrading View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
gabriel.gasse-number41media - 10/19/2012 5:04:32 PM
   
Error at SchedulingExecutor.ReInitCorruptedTasks() after upgrading
I'm in the process of upgrading a client's website from 3.1a to 6.0 (working on the 3.1a-->4.0 step at the moment). The update script runs fine, I updated the files just like I did with my previous client, only this time I get this error when I start the site.

[DataConnection.ExecuteQuery]: Query: UPDATE CMS_ScheduledTask SET [TaskName] = @TaskName, [TaskDisplayName] = @TaskDisplayName, [TaskAssemblyName] = @TaskAssemblyName, [TaskClass] = @TaskClass, [TaskInterval] = @TaskInterval, [TaskData] = @TaskData, [TaskLastRunTime] = @TaskLastRunTime, [TaskNextRunTime] = @TaskNextRunTime, [TaskProgress] = @TaskProgress, [TaskLastResult] = @TaskLastResult, [TaskEnabled] = @TaskEnabled, [TaskSiteID] = @TaskSiteID, [TaskDeleteAfterLastRun] = @TaskDeleteAfterLastRun, [TaskServerName] = @TaskServerName, [TaskGUID] = @TaskGUID, [TaskLastModified] = @TaskLastModified, [TaskExecutions] = @TaskExecutions WHERE [TaskID] = @TaskID: caused exception: Must declare the scalar variable "@TaskExecutions".

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: [DataConnection.ExecuteQuery]: Query: UPDATE CMS_ScheduledTask SET [TaskName] = @TaskName, [TaskDisplayName] = @TaskDisplayName, [TaskAssemblyName] = @TaskAssemblyName, [TaskClass] = @TaskClass, [TaskInterval] = @TaskInterval, [TaskData] = @TaskData, [TaskLastRunTime] = @TaskLastRunTime, [TaskNextRunTime] = @TaskNextRunTime, [TaskProgress] = @TaskProgress, [TaskLastResult] = @TaskLastResult, [TaskEnabled] = @TaskEnabled, [TaskSiteID] = @TaskSiteID, [TaskDeleteAfterLastRun] = @TaskDeleteAfterLastRun, [TaskServerName] = @TaskServerName, [TaskGUID] = @TaskGUID, [TaskLastModified] = @TaskLastModified, [TaskExecutions] = @TaskExecutions WHERE [TaskID] = @TaskID: caused exception: Must declare the scalar variable "@TaskExecutions".

Source Error:


Line 159:
Line 160: // Re-initialize tasks which were stopped by application end
Line 161: SchedulingExecutor.ReInitCorruptedTasks();
Line 162: ModuleCommands.NewsletterClearEmailsSendingStatus();
Line 163: EmailInfoProvider.ResetSendingStatus();

Source File: c:\prj\n41\MiaBc\App_Code\Global.asax.cs Line: 161

Stack Trace:


[Exception: [DataConnection.ExecuteQuery]: Query: UPDATE CMS_ScheduledTask SET [TaskName] = @TaskName, [TaskDisplayName] = @TaskDisplayName, [TaskAssemblyName] = @TaskAssemblyName, [TaskClass] = @TaskClass, [TaskInterval] = @TaskInterval, [TaskData] = @TaskData, [TaskLastRunTime] = @TaskLastRunTime, [TaskNextRunTime] = @TaskNextRunTime, [TaskProgress] = @TaskProgress, [TaskLastResult] = @TaskLastResult, [TaskEnabled] = @TaskEnabled, [TaskSiteID] = @TaskSiteID, [TaskDeleteAfterLastRun] = @TaskDeleteAfterLastRun, [TaskServerName] = @TaskServerName, [TaskGUID] = @TaskGUID, [TaskLastModified] = @TaskLastModified, [TaskExecutions] = @TaskExecutions WHERE [TaskID] = @TaskID: caused exception: Must declare the scalar variable "@TaskExecutions".]
CMS.DataProviderSQL.DataConnection.ExecuteQuery(String queryText, Object[,] queryParams, QueryTypeEnum queryType) +807
CMS.DataProviderSQL.DataConnection.CMS.IDataConnectionLibrary.IDataConnection.ExecuteQuery(String queryText, Object[,] queryParams, QueryTypeEnum queryType) +13
CMS.DataEngine.GeneralConnection.ExecuteQuery(String queryText, Object[,] parameters, QueryTypeEnum queryType, Boolean transaction) +171
CMS.DataEngine.GeneralConnection.RunQueryObject(Query query, Object[,] parameters) +325
CMS.DataEngine.GeneralConnection.RunQuery(String queryName, Object[,] parameters, String where, String orderBy, Int32 topN, String columns) +83
CMS.DataEngine.GeneralConnection.ExecuteQuery(String queryName, Object[,] parameters) +18
CMS.DataEngine.SimpleDataClass.Update() +120
CMS.DataEngine.AbstractInfo.Update() +444
CMS.Staging.SynchronizedInfo.Update() +26
CMS.Scheduler.TaskInfoProvider.SetTaskInfo(TaskInfo task) +33
CMS.Scheduler.SchedulingExecutor.ReInitCorruptedTasks() +303
Global.FirstRequestInitialization(Object sender, EventArgs e) in c:\prj\n41\MiaBc\App_Code\Global.asax.cs:161
Global.Application_BeginRequest(Object sender, EventArgs e) in c:\prj\n41\MiaBc\App_Code\Global.asax.cs:392
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

User avatar
Certified Developer v7
Certified  Developer v7
gabriel.gasse-number41media - 10/22/2012 6:07:57 PM
   
RE:Error at SchedulingExecutor.ReInitCorruptedTasks() after upgrading
I found that I can run that SQL:

UPDATE CMS_ScheduledTask
SET TaskNextRunTime = GETDATE()
WHERE TaskNextRunTime IS NULL AND TaskInterval NOT LIKE 'once%';

Having TaskNextRunTime defined let ReInitCorruptedTasks return without trying to fix any tasks. However, the problems comes back each time the site is restarted.

Any idea?

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 10/23/2012 6:39:22 AM
   
RE:Error at SchedulingExecutor.ReInitCorruptedTasks() after upgrading
Hi Gabriel,

It seems there is some inconsistency in your DB from some reason.
If I understand it well, the 3.1a instance was running fine and the problem appeared after you upgraded it to KCMS 4.0, right?

Best regards,
Martin Danko

User avatar
Certified Developer v7
Certified  Developer v7
gabriel.gasse-number41media - 10/23/2012 11:40:24 AM
   
RE:Error at SchedulingExecutor.ReInitCorruptedTasks() after upgrading
Yes that is correct.

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 10/24/2012 5:41:13 AM
   
RE:Error at SchedulingExecutor.ReInitCorruptedTasks() after upgrading
Hi Gabriel,

Could you please confirm that your MS SQL database server is using case insensitive (CI) collation?

Best regards,
Martin Danko

User avatar
Certified Developer v7
Certified  Developer v7
gabriel.gasse-number41media - 10/24/2012 12:16:39 PM
   
RE:Error at SchedulingExecutor.ReInitCorruptedTasks() after upgrading
Yes it is. It's using SQL_Latin1_General_CP1_CI_AS to be exact

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 10/25/2012 2:54:35 AM
   
RE:Error at SchedulingExecutor.ReInitCorruptedTasks() after upgrading
Hi Gabriel,

What you can do to run the web site is to comment the following code in ~\App_Code\Global.asax.cs file:
SchedulingExecutor.ReInitCorruptedTasks();

Run the web site, and then check the date time setting of your scheduled tasks.

Please check if following columns for your scheduled tasks contain valid DateTime values:
TaskNextRunTime
TaskLastRunTime

Optionally, you can install new fresh KCMS 4.0 instance (can be downloaded from kentico.com/downloads/kenticocms_4_0.exe) and try to import export package of your 3.1a web site, using standard Export and Import functionality.

Best regards,
Martin Danko

User avatar
Certified Developer v7
Certified  Developer v7
gabriel.gasse-number41media - 10/26/2012 11:02:42 AM
   
RE:Error at SchedulingExecutor.ReInitCorruptedTasks() after upgrading
I tried replacing those values with valid DateTime values. This helped the site start but whenever I stop IIS and restart it again, I had to fix TaskNextRunTime again.

I ended up using the import export functionality. However, I had many import errors when trying to import from from 3.1a. So, I upgraded my site to 4.0, and then fixed TaskNextRunTime so I could export the site. That worked.

Thx.