-
Notifications
You must be signed in to change notification settings - Fork 442
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
HostID Truncation can cause collisions #2015
Comments
This is a dangerous change to make for v1 but we should fix it in v2. This would require some updates to the scale controller as I believe it has this logic duplicated. |
I've confirmed the scale controller will need an update, but it should be straightforward once we know what the new logic for generating the host ID is. |
We had to punt this due to higher priority issues and the need to coordinate the change across multiple components. Revisit again in V3. |
As a workaround for customers running into this issue, in Functions v2, you can set an explicit HostID in app settings, using a different ID for each environment. The app setting name to use is |
Had a customer issue last week, where this truncation caused collision between multiple function apps sharing the same storage account. @fabiocav, is this already planned for V3? |
Deferring this work as it would have scale controller dependencies and does not align with the timing. |
@paulbatum @fabiocav Per #1904 regarding the same detail on architecture center doc, we communicate that the Function App name length to be |
@mike-urnun-msft good catch. staying in the range of 1-32 will avoid this bug. |
Though there is no specific mention in this issue, I assume that the solution of explicitly setting the host ID via the 'AzureFunctionsWebHost:hostId' App Setting is still valid for v3 Function Apps? If so, does the host ID have to remain static, or can it change after every deployment? I ask because our CD pipeline updates App Settings through an ARM template, so if the host ID has to remain static we'd first need to query the App Settings to get the current value of 'AzureFunctionsWebHost:hostId' for the slot we are deploying to so that it can be set back with the same value. Also, does this only apply to a Function App with a slot, or does the value of 'AzureFunctionsWebHost:hostId' have to be unique across Function Apps? For example, if you have these two Function Apps with no slots...
...could both have the same truncated value of 'my-really-really-long-functionap'? |
Why is this not mentioned in the docs or warned upon creation? This has been known since 2017, but no obvious mention of it anywhere that I can find. ( I very well could be blind, so if so please correct me. ) |
+1 I just recently got hit with a case that appears to be, at least partially, caused by this limitation. |
Running a v4 function, we're still facing the |
This error message appeared for me, even though there was no conflict. It seems this gets triggered if there is any truncation. It does not seem to be preventing my apps from running, though. I think it may be more appropriate for this to appear as a warning when there is truncation, but no conflict detected. On a related note, why is the limit only 32 characters? That seems rather short when basing things on names assigned by humans. I guess this is really all a result of the fatal flaw in Azure where the name of a resource doubles as the ID of the resource. This decision has created a lot of inconveniences within Azure. |
Same problem here. Is that expected behavior, should we ignore message or some other action is required? |
Should it be |
According to the App settings reference for Azure Functions documentation, you can find I still face the |
This is so confusing. the behavior suggests it should be Here's what I did:
I repeated it a few times, and it always works this way, AzureFunctionsWebHost__hostId is recognized by Diagnostics, but AzureFunctionsWebHost__hostid is not. I'm not sure if it's only Diagnostics that's using hostId with capital I or is it Azure itself? Who could tell what's actually going on and what should be the name of the setting to make it both work properly and also be recognized by Diagnostics? |
@progmars that's a really interesting information that you've provided! I've just done a test with @mathewc can you confirm that both Many thanks |
Having a conflicting hostId due to the name being truncated also caused me this error:
Setting a unique (and shorter than 32 characters) hostid allowed the application to start. This is frustrating because, as noted above, the default app names generated by Visual Studio means that apps can't be successfully deployed to any slot without making this change. |
Pretty much the same as above. Seeing the job host started then immediately stopped again, leading to Finding the root cause was an absolute pain, because there is supposed to be an error logged about host id collisions, but there never was anything logged about it. It just shuts down and starts up again immediately in a loop, with short lived functions managing to complete a small amount of work before the host is killed again. |
I'll also point out that if the function host is going to be shut down it should be done before functions start to run, instead of cancelling them mid-run |
I also need clarification on the case for host ID. Documentation said all lower case, but then the App services diagnostic settings alert it as a risk, changing it to hostId the alert clears. |
We are deploying a Python Application using a custom Docker Container to Azure Functions. I can confirm with absolute certainty, that AzureFunctionsWebHost__hostId (uppercase I) caused our function to fail with logs similar to this comment (except mentioning python). As soon as we changed to AzureFunctionsWebHost__hostid (lower case i) our function app started working. With either hostId or hostid, we get the log message "Host id explicitly set in configuration. This is not a recommended configuration and may lead to unexpected behavior." as expected. However, with hostId, we never got a error logged that there was a hostId collision. However, a few log lines later, it says With hostId we do NOT get the diagnostics error. With hostid we do get the diagnostics error. This leads me to believe that the logic for the diagnostics error is incorrect (case insensitive when it needs to be case sensitive). |
Same issue with not being able to find the error. As a customer all I see in my logs is the function host restarting. Can we surface this error into the standard host trace output. |
Same here, no error in logs, our readiness probe pinging admin/host/ping just stopped responding after ~10 minutes and that caused AKS to restart the pod. An error, on a critical level, would be nice. |
100% agree - I seem to be able to get the function runtime in a real panic because of this coupled with a timer trigger. I understand that fixing the host Id is the right thing to do, but can we make this check happen before functions kick in. |
@fabiocav could we please bump this one up the list? @eamonoreilly fyi |
spent an entire week trying to track down the root cause for this problem. Very disappointed that nothing pops up in the logs about collisions. This is a known 6 year old issue, I expect more even if it's simply a log of potential reasons for the cause. |
This is a PITA and it's been 6 years now since the issue was identified. Any update on the ETA / Roadmap? |
We just got hit by this issue. Do you have any updates? |
I have started facing this issue suddenly since yesterday. We have V4 function apps deployed on windows elastic plan. I have function apps having name of length 43 characters & having ambiguity of name in the trail like abc-defg-abcdefghijklmnopqrstuv-v1-eus & abc-defg-abcdefghijklmnopqrstuv-v2-eus I was already having below app setting added to Function App configuration: I have tried adding below app settings:
Host ID collision error is removed from diagnose & solve problem screen but issue isn't resolved. Function apps still stops & starts intermittently). The only solution that worked for me was to deploy a different function app with truncated name (as we cannot rename the function app) |
Any chance it is a scaling/instance issue? I.e. you actually have multiple of the same hostid in use? |
@madmahii24 any response from microsoft support? Running into the same issue |
this is still in issue in 2024 |
@marcelaction MS support was not able to help. Only suggestion I got is to rename your function apps to have names lower than 32 chars. |
@jassent I don't think it is a scaling issue. |
Also just ran into this issue. It's taken 4 months for my team to even discover this issue. If this is not going to be fixed anytime soon, could at least an alert be displayed in the portal for this? This doesn't seem like it would be too hard to implement. |
Currently when generating a default host ID we use the host name (slot host name) and we truncate to 32 characters max (code here). This ensures that the generated ID conforms to the core SDK length restrictions (code here).
This truncation can of course open the possibility for naming collisions, particularly in the case of slots. In slot scenarios, if the site name is over 32 characters long and a slot is created that starts with the same 32 characters and is only disambiguated in later characters, both the production and the slot site will be using the same host ID. This can lead to issues. For example, TimerTrigger uses the host ID as a component of the blob lease path. In this case the timer function will only be able to run in one of the sites because they're competing for the same lock. Similarly, customers often have apps deployed to different regions using the same long naming path, varying only in later name components (e.g. region/environment), and can run into this.
More information on can be found in Host ID Collisions.
The text was updated successfully, but these errors were encountered: