Azure / Azure/azure-functions-host

ScriptHostManager System.ObjectDisposedException

Open
#3,146 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

Seeing exceptions with the following stack trace:

```
System.ObjectDisposedException : Cannot access a disposed object.
at async Microsoft.Azure.WebJobs.JobHost.StartAsyncCore(CancellationToken cancellationToken)
at Microsoft.Azure.WebJobs.Script.ScriptHostManager.RunAndBlock(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Host\ScriptHostManager.cs : 184
```

These are coming from [here](https://github.com/Azure/azure-functions-host/blob/3d521142d3908a9e3601a3f91230d8209542498d/src/WebJobs.Script/Host/ScriptHostManager.cs#L184).

Seeing it in both v1 and v2. Run the below Kusto query to see some instances. Need to look at what is going on in the host when this happens.

FunctionsLogs
| where PreciseTimeStamp > ago(3d)
| where Level < 3
| where Details contains "System.ObjectDisposedException : Cannot access a disposed object." and Details contains "JobHost.StartAsyncCore"
| project PreciseTimeStamp, HostVersion, AppName, FunctionName, FunctionInvocationId, Summary, Details

Contributor guide

Open the contributing guide

Research direction

Start at src/WebJobs.Script/Host/ScriptHostManager.cs line 184 and review the JobHost.StartAsyncCore call in the reported stack trace. Run the supplied Kusto query against FunctionsLogs to find instances in both v1 and v2, then trace the host lifecycle around the disposal and startup paths. Done means identifying why the disposed object reaches StartAsyncCore and defining the corrective change.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.