azure-webjobs-sdk icon indicating copy to clipboard operation
azure-webjobs-sdk copied to clipboard

Missing cache for WebJobsOptionsFactory

Open liliankasem opened this issue 2 years ago • 1 comments

The options cache is not being passed into WebJobsOptionsFactory, so every time we go through language worker setup we end up creating multiple instances of the options.

Expected behaviour

  • Start the function host
  • Host reads the worker.config file and creates options at the parent scope
  • JobHost process starts up
  • Host reads the worker.config file and creates options at the child scope
  • Make a change that causes use to read the worker config
  • Host uses existing options instance

Overall, only two instances of worker options should be created, and future uses of options should use the cache.

Actual behaviour

  • Start the function host
  • Host reads the worker.config file and creates options at the parent scope
  • JobHost process starts up
  • Host reads the worker.config file and creates options at the child scope
  • Make a change that causes use to read the worker config
  • Host creates a new options instance instead of using the cache

Three instances of worker options are created, when instead we should be using the cache

WebJobsOptionsFactory

Steps to reproduce

  1. Add breakpoint at LanguageWorkerOptionsSetup.cs
  2. This breakpoint is being hit 3 times.
  3. Adding this object to watch and creating an object ID shows us 2 objects are same and 1 is different

liliankasem avatar Jun 16 '22 19:06 liliankasem

@liliankasem can we please add information about the expected vs actual behavior here so others know how to validate this issue? Thanks!

fabiocav avatar Jun 29 '22 20:06 fabiocav