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

Change multi-threading behavior of caches (AbstractTypeDicts). #549

Merged
merged 1 commit into from
May 13, 2019

Conversation

tkoolen
Copy link
Collaborator

@tkoolen tkoolen commented May 13, 2019

Fix #548.

This is a breaking change, although I doubt that a lot of people have
been relying on this behavior up to this point.

Previously, AbstractTypeDict subtypes such as StateCache,
DynamicsResultCache, and SegmentedVectorCache would use the thread
ID for the thread in which the value (e.g. MechanismState) was created as part
of the key. This was not needed for thread-safety (a misunderstanding on
my part), and led to some unexpected behavior (#548) as it wasn't
documented properly. I also now consider it to be a poor separation of
concerns: AbstractTypeDict should just be Dict-like, and Dict
doesn't do anything special in the presence of multiple threads.

See the following comments for more info on the past behavior and the
change:

Fix #548.

This is a breaking change, although I doubt that a lot of people have
been relying on this behavior up to this point.

Previously, `AbstractTypeDict` subtypes such as `StateCache`,
`DynamicsResultCache`, and `SegmentedVectorCache` would use the thread
ID for the thread in which the value (e.g. `MechanismState`) was created as part
of the key. This was not needed for thread-safety (a misunderstanding on
my part), and led to some unexpected behavior (#548) as it wasn't
documented properly. I also now consider it to be a poor separation of
concerns: `AbstractTypeDict` should just be `Dict`-like, and `Dict`
doesn't do anything special in the presence of multiple threads.

See the following comments for more info on the past behavior and the
change:

* #548 (comment)
* #548 (comment)
@codecov-io
Copy link

codecov-io commented May 13, 2019

Codecov Report

Merging #549 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #549   +/-   ##
=======================================
  Coverage   92.96%   92.96%           
=======================================
  Files          50       50           
  Lines        3013     3013           
=======================================
  Hits         2801     2801           
  Misses        212      212
Impacted Files Coverage Δ
src/caches.jl 76% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb23110...efa1a27. Read the comment docs.

@tkoolen tkoolen merged commit cc3453a into master May 13, 2019
@tkoolen tkoolen mentioned this pull request May 14, 2019
@tkoolen tkoolen deleted the tk/cache-threading branch May 27, 2019 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues using threading and StateCache's
2 participants