Azure / Azure/azure-functions-host

Host startup error when retrieving latest Extension Bundles version info throws

Open
#9,434 0 comments 0 reactions 0 assignees View on GitHub
supportability
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

When we try to retrieve the bundle version index, we check if the request was successful. In case it wasn't, we log an error and return null, to let the caller decide.

https://github.com/Azure/azure-functions-host/blob/0058f8befdb9bb9da5cb9ac183896590a02f2cbf/src/WebJobs.Script/ExtensionBundle/ExtensionBundleManager.cs#L225-L236

However, the request can fail in a less graceful way, for example throwing an exception, breaking the flow and the startup operation. One example could be a VNET integrated app with a firewall that abruptly ends the connection:

```csharp
System.Net.Http.HttpRequestException : The SSL connection could not be established, see inner exception. --->
System.IO.IOException : Authentication failed because the remote party has closed the transport stream.
at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer,Int32 readBytes,AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslStream.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslStream.ThrowIfExceptional()
at System.Net.Security.SslStream.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result)
at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
at System.Net.Security.SslStream.<>c.b__65_1(IAsyncResult iar)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar,Func`2 endFunction,Action`1 endAction,Task`1 promise,Boolean requiresSynchronization)
at async System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream,SslClientAuthenticationOptions sslOptions,CancellationToken cancellationToken)
at async System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request,Boolean allowHttp2,CancellationToken cancellationToken)
at async System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request,CancellationToken cancellationToken)
at async System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request,CancellationToken cancellationToken)
at async System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request,Boolean doRequestAuth,CancellationToken cancellationToken)
at async System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
at async System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask,HttpRequestMessage request,CancellationTokenSource cts,Boolean disposeCts)
at async Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleManager.GetLatestMatchingBundleVersionAsync(??) at /src/azure-functions-host/src/WebJobs.Script/ExtensionBundle/ExtensionBundleManager.cs : 234
at async Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleManager.GetBundle(HttpClient httpClient) at /src/azure-functions-host/src/WebJobs.Script/ExtensionBundle/ExtensionBundleManager.cs : 107
at async Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleManager.GetExtensionBundlePath(??) at /src/azure-functions-host/src/WebJobs.Script/ExtensionBundle/ExtensionBundleManager.cs : 83
at async Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleManager.GetExtensionBundleBinPathAsync() at /src/azure-functions-host/src/WebJobs.Script/ExtensionBundle/ExtensionBundleManager.cs : 294
at async Microsoft.Azure.WebJobs.Script.DependencyInjection.ScriptStartupTypeLocator.GetExtensionsStartupTypesAsync() at /src/azure-functions-host/src/WebJobs.Script/DependencyInjection/ScriptStartupTypeLocator.cs : 108
```

Related to https://github.com/Azure/azure-functions-host/issues/9364

Contributor guide

Open the contributing guide

Research direction

Start in src/WebJobs.Script/ExtensionBundle/ExtensionBundleManager.cs, especially GetLatestMatchingBundleVersionAsync around lines 225-236, and trace its callers through GetBundle and ScriptStartupTypeLocator. Confirm how request exceptions currently propagate; done means a failed bundle-version request is handled like an unsuccessful response so host startup can continue and the caller can decide what to do.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.