Azure / Azure/azure-functions-core-tools

func command times out on Linux

Open
#2,929 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
4d 20h
Merged PRs (30d)
14

Description

Hi, I'm trying to use the func command to generate a new Azure Function template, and this command fails. Even asking for a list of templates times out. The error trace is below. I am performing these commands from within the venv (as specified in the documentation).

```
$ func templates list -l python --debug
System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
---> System.TimeoutException: The operation was canceled.
---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
---> System.IO.IOException: Unable to read data from the transport connection: Operation canceled.
---> System.Net.Sockets.SocketException (125): Operation canceled
--- End of inner exception stack trace ---
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](TIOAdapter adapter)
at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](TIOAdapter adapter, Memory`1 buffer)
at System.Net.Http.HttpConnection.FillAsync(Boolean async)
at System.Net.Http.HttpConnection.CopyToContentLengthAsync(Stream destination, Boolean async, UInt64 length, Int32 bufferSize, CancellationToken cancellationToken)
at System.Net.Http.HttpConnection.ContentLengthReadStream.CompleteCopyToAsync(Task copyTask, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnection.ContentLengthReadStream.CompleteCopyToAsync(Task copyTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionResponseContent.SerializeToStreamAsync(Stream stream, TransportContext context, CancellationToken cancellationToken)
at System.Net.Http.HttpContent.LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStream tempBuffer)
at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleManager.TryDownloadZipFileAsync(Uri zipUri, String filePath, HttpClient httpClient) in D:\a\1\s\src\WebJobs.Script\ExtensionBundle\ExtensionBundleManager.cs:line 200
at Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleManager.DownloadExtensionBundleAsync(String version, HttpClient httpClient) in D:\a\1\s\src\WebJobs.Script\ExtensionBundle\ExtensionBundleManager.cs:line 171
at Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleManager.GetBundle(HttpClient httpClient) in D:\a\1\s\src\WebJobs.Script\ExtensionBundle\ExtensionBundleManager.cs:line 110
at Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleManager.GetExtensionBundlePath() in D:\a\1\s\src\WebJobs.Script\ExtensionBundle\ExtensionBundleManager.cs:line 79
at Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleContentProvider.GetFileContent(String path) in D:\a\1\s\src\WebJobs.Script\ExtensionBundle\ExtensionBundleContentProvider.cs:line 38
at Microsoft.Azure.WebJobs.Script.ExtensionBundle.ExtensionBundleContentProvider.GetTemplates() in D:\a\1\s\src\WebJobs.Script\ExtensionBundle\ExtensionBundleContentProvider.cs:line 24
at Azure.Functions.Cli.Common.TemplatesManager.GetTemplates() in D:\a\1\s\src\Azure.Functions.Cli\Common\TemplatesManager.cs:line 40
at Azure.Functions.Cli.Actions.LocalActions.ListTemplatesAction.RunAsync() in D:\a\1\s\src\Azure.Functions.Cli\Actions\LocalActions\ListTemplatesAction.cs:line 36
at Azure.Functions.Cli.ConsoleApp.RunAsync[T](String[] args, IContainer container) in D:\a\1\s\src\Azure.Functions.Cli\ConsoleApp.cs:line 64
```

System info:
```
$ uname -a
Linux dev-Precision-Tower-5810 5.11.0-44-generic #48~20.04.2-Ubuntu SMP Tue Dec 14 15:36:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ az --version
azure-cli 2.32.0

core 2.32.0
telemetry 1.0.6

Dependencies:
msal 1.16.0
azure-mgmt-resource 20.0.0

Python location '/opt/az/bin/python3'
Extensions directory '/home/dev/.azure/cliextensions'

Python (Linux) 3.6.10 (default, Dec 31 2021, 08:09:22)
[GCC 9.3.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy

$ func --version
4.0.3971

$ ping google.com
PING google.com (142.250.191.206) 56(84) bytes of data.
64 bytes from ord38s31-in-f14.1e100.net (142.250.191.206): icmp_seq=1 ttl=54 time=29.2 ms
64 bytes from ord38s31-in-f14.1e100.net (142.250.191.206): icmp_seq=2 ttl=54 time=47.2 ms
64 bytes from ord38s31-in-f14.1e100.net (142.250.191.206): icmp_seq=3 ttl=54 time=30.4 ms
^C
--- google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms

```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `func templates list -l python --debug` on Linux, then trace the mentioned `ListTemplatesAction.cs`, `TemplatesManager.cs`, and extension-bundle download path. Compare the request behavior with the reported 100-second timeout and determine a scoped fix; done means template listing and new-template generation complete without timing out.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
cli, cloud
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.