Application settings occasionally not accessible
See original GitHub issueHello,
every once in a while we are experiencing a problem getting the application settings. Everything runs nice, but sometimes returned value is null.
First we tried getting the value using the configuration manager:
string apiKey = System.Configuration.ConfigurationManager.AppSettings["AzureSearchServiceApiKey"];
then we thought configuration manager might be the problem and changed to cloud configuration manager:
string apiKey = CloudConfigurationManager.GetSetting("AzureSearchServiceApiKey");
and still experiencing the same issue.
For example today from midnight till 9 AM value was returned successfully 46 times and 4 times null was returned.
Our problem seems similar to https://github.com/Azure/azure-webjobs-sdk-script/issues/1481 but npiasecki fixed it by fixing the memory leak. I don’t think we have a memory leak, but who knows 😃
Any idea how to fix or investigate this issue would be appreciated.
Thanks.
Tin
P.S. if anyone wants to take a look function app is the one with statisticprocess in name on the same account with sa-v4-reference and last errors occurred (UTC): June 5th 22:03:59.322 June 6th 00:33:46.085 June 6th 05:47:23.887 June 6th 05:47:24.157
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:31 (12 by maintainers)
Top GitHub Comments
We have another CRI. Here is the Scenario (from the logs) Function had service bus trigger and when under load i.e multiple executions with in a short span of time sometimes, reading AppSettings returns null.
Moving it to triaged as we have multiple customer reports. We need to spend sometime to create a repro.
Hi @thusnjak
It turns out it wasn’t the memory leak, but I forgot to reopen the issue. I noticed the same thing with AppSettings in Azure Functions, all I could figure out is that the host starts running your function before the configuration wizardry gets merged somehow, or runs your function after the environment has been torn down. I worked around it by using environment variables instead.
I ended up using a helper class I wrote to work around the issue. Basically I look in AppSettings, and if it’s not there I try the environment variable instead. The environment variable always seems to be there.