Azure / Azure/azure-functions-host
SyncTriggers Hash is only updated as part of background sync triggers
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
Currently it's possible to get into an inconsistent state between the platform synced triggers payload and what the host thinks that synced payload is (the calculated hash). This can happen because we're not calculating and updating the hash when `SetTriggers` is called as part of a direct call (not background).
https://github.com/Azure/azure-functions-host/blob/7a9977533600ba5201f65e834b1d90c8acfbfa73/src/WebJobs.Script.WebHost/Management/FunctionsSyncManager.cs#L134-L151
### Steps to repro
1. Customer has a payload deployed, let's say 1 function with a hash stored in the Storage Account: `hash1`
2. Host fails to index and starts with 0 functions loaded
3. A **manual** sync triggers operation is performed that's processed by this host and performs a `SetTriggers` call. The hash now should be `hash0`.
4. A new instance starts and properly loads the functions. Background sync triggers kicks in and compares both hashes: `hash1 == hash1` so no `SetTriggers` is performed since the stored hash **is not** `hash0`.
Contributor guide
Research direction
Start in src/WebJobs.Script.WebHost/Management/FunctionsSyncManager.cs around lines 134-151, tracing SetTriggers for direct and background sync calls. Reproduce the hash1/hash0 sequence described in the issue and verify that a direct SetTriggers updates the stored hash so a later background sync does not incorrectly treat the stale hash as current.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100