U4-8448 - Background task runner missing a null check during shutdown

Created by Shannon Deminick 12 May 2016, 10:26:46 Updated by Stephan 12 May 2016, 10:55:49

Tags: Unscheduled

This is the first time I've seen this exception and it must just be a race condition - probably doesn't cause issues but it get's logged:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Umbraco.Web.Scheduling.BackgroundTaskRunner`1.Shutdown(Boolean force, Boolean wait) in X:\Projects\Umbraco\Umbraco_7.4\src\Umbraco.Web\Scheduling\BackgroundTaskRunner.cs:line 308
   at umbraco.content.<>c__DisplayClass2_0.<.ctor>b__0() in X:\Projects\Umbraco\Umbraco_7.4\src\Umbraco.Web\umbraco.presentation\content.cs:line 72
   at Umbraco.Core.MainDom.OnSignal(String source) in X:\Projects\Umbraco\Umbraco_7.4\src\Umbraco.Core\MainDom.cs:line 105

the problem is during Shutdown on the last line we do _runningTask.Wait(); // wait for whatever is running to end... however, _runningTask could actually be null here since we set it to null elsewhere so a null check is needed.

Comments

Shannon Deminick 12 May 2016, 10:27:15

Fixed in rev: f130e86c88210d49015827a2d2c2378346ce2d32


Shannon Deminick 12 May 2016, 10:27:28

@zpqrtbnk assigning to you


Stephan 12 May 2016, 10:55:44

Race condition indeed. Does not cause issue but better clean up.


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.5.0

Sprint: Sprint 15

Story Points:

Cycle: