Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Functions in Container Using App Service Plan Sleeps over Time Without Ping #2470

Open
Pieeer1 opened this issue Apr 12, 2024 · 2 comments
Assignees

Comments

@Pieeer1
Copy link

Pieeer1 commented Apr 12, 2024

Purpose

When attempting to deploy a containerized azure function (.NET 8.0 Isolated) Using the base dockerfile provided, the application will run successfully on the cloud.

This Function app has 8 service bus listeners, which are pretty consistently receiving data.

After about a 2-5~ minute interval the app will go to "sleep" and require a visit to the function app site to wake it up. This takes about 30s to 90s and does not work 100% of the time.

This obviously is not great for a service bus listener or any workload. Sending a service bus message to any topic does not wake up the app. I have also verified that the (always on) checkbox is checked.

Workaround fix

The following simple timer trigger keeps the app running

    public class KeepAlive
    {
        private readonly ILogger _logger;

        public KeepAlive(ILoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger<KeepAlive>();
        }

        /// <summary>
        /// By Default Docker Container will stop after a few minutes of inactivity. This keeps the app alive
        /// </summary>
        [Function(nameof(KeepAlive))]
        public void Run([TimerTrigger("*/30 * * * * *")] TimerInfo myTimer)
        {
            _logger.LogInformation($"Running Keep Alive on Netsuite Listener");
        }
    }

Suggestion

This should not be a problem on service plans that are supposed to operate constantly. This either needs to be kept awake in the background or some documentation on this should be provided.

Details

Runtime: dotnet-isolated in docker container
.Net Version: 8.0
Service Plan: B1 (the app should not be sleeping)

@Pieeer1 Pieeer1 added the bug label Apr 12, 2024
@bhagyshricompany
Copy link

Thanka for reporting please provide the app name,region etc

@bhagyshricompany
Copy link

@fabiocav pls comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants