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

Possible exception on configuration reload - Collection was modified; enumeration operation may not execute. #704

Closed
mzakrzewski opened this issue Jun 25, 2021 · 2 comments
Assignees
Labels
Component/Configuration Issues related to Configuration providers ReleaseLine/2.x Identified as a feature/fix for the 2.x release line ReleaseLine/3.x Identified as a feature/fix for the 3.x release line Type/bug Something isn't working

Comments

@mzakrzewski
Copy link
Contributor

Describe the bug

I'm currently researching an invalid operation exception in an application when binding configuration. I haven't conclusively narrowed it down but my research so far raises concern for how the ConfigServerConfigurationProvider is implemented. This application is using env variables, cloud foundry configuration and config server configuration providers.

Based on changes made in the framework configuration providers (i.e. dotnet/extensions#1202), and seeing that the AddConfigServerClientSettings method in ConfigServerConfigurationProvider is directly changing the Data dictionary, I believe there is the potential that a configuration reload() could result in an InvalidOperationException.

To my knowledge, we're not calling Reload() on configuration when this is being encountered, but I thought it best to let you know that there may be an issue with how this is implemented: https://github.com/SteeltoeOSS/Steeltoe/blob/main/src/Configuration/src/ConfigServerBase/ConfigServerConfigurationProvider.cs#L422

Expected behavior

I would expect a call to reload configuration would not throw an invalid operation exception because a collection has been modified.

Environment (please complete the following information):

  • Steeltoe Version: 3.0.2
  • Platform: Cloud Foundry
  • OS: Linux
  • .NET Version: .net core 3.1.13
  • Any other library versions to note: N/A
@mzakrzewski mzakrzewski added the Type/bug Something isn't working label Jun 25, 2021
@TimHess
Copy link
Member

TimHess commented Jun 25, 2021

Quick investigation reveals that the potential for this kind of issue was removed in #185 but then reintroduced by #270 ... looks like a bug to me, @mzakrzewski do you want to submit a PR?

Note: this should be fixed in the 2.x branch first and later merged to main (3.x)

@TimHess TimHess added Component/Configuration Issues related to Configuration providers ReleaseLine/2.x Identified as a feature/fix for the 2.x release line ReleaseLine/3.x Identified as a feature/fix for the 3.x release line labels Jun 25, 2021
@mzakrzewski
Copy link
Contributor Author

Yep, I'll submit a PR; hopefully this week. Thanks.

mzakrzewski pushed a commit to mzakrzewski/Steeltoe that referenced this issue Jun 30, 2021
mzakrzewski pushed a commit to mzakrzewski/Steeltoe that referenced this issue Jun 30, 2021
TimHess pushed a commit that referenced this issue Jul 1, 2021
* Changed config-server config provider to allow configuration binding during a reload without throwing an exception (#704)

Co-authored-by: Matt Zak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component/Configuration Issues related to Configuration providers ReleaseLine/2.x Identified as a feature/fix for the 2.x release line ReleaseLine/3.x Identified as a feature/fix for the 3.x release line Type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants