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

Move model and settings operations out of threaded code #11837

Merged
merged 1 commit into from
Mar 5, 2022

Conversation

AlanCoding
Copy link
Member

SUMMARY

We have some documentation on situations where we hit errors like those described here: tkem/cachetools#90

Most of our code is not thread-safe. We need to be careful to do as little as possible while we have this ThreadPoolExecutor active. Several of the kwargs can easily wind up referencing settings, and this is a known hazard. Easiest thing to do is build all of these type of params before doing any threads, and I can't see any argument against it.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
  • API

@AlanCoding AlanCoding force-pushed the thread_key_error branch 2 times, most recently from 1dcd780 to 64873d3 Compare March 4, 2022 14:51
This is to avoid references to settings in threads,
  this is known to create problems when caches expire
  this leads to KeyError in environments with heavy load
@AlanCoding AlanCoding marked this pull request as ready for review March 5, 2022 01:11
Copy link
Member

@shanemcd shanemcd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome

@AlanCoding AlanCoding merged commit e02e91a into ansible:devel Mar 5, 2022
@AlanCoding AlanCoding deleted the thread_key_error branch April 22, 2022 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants