lumberyard icon indicating copy to clipboard operation
lumberyard copied to clipboard

Statistics collection and thread safety fixes for AZ::IO::DedicatedCache

Open dkondrashkin opened this issue 5 years ago • 1 comments

More fixes for problems addressed by https://github.com/aws/lumberyard/pull/494

While previous pull request fixed most of the issues the one remained:

  • DedicatedCache::DestroyDedicatedCache() call can happen right between DedicatedCache::CollectStatistics() call and any code that makes use of statistics collected (e.g. System.cpp @ 1745 or Device.cpp @ 96). This leads to accessing invalid memory through string views stored in statistics values and, particularly, to crashes on consoles.

The solution proposed (apart form guarding internal data members with locks) is to postpone removal of m_cachedStatNames entries until the very beginning of the next DedicatedCache::CollectStatistics() call.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

dkondrashkin avatar Aug 05 '20 14:08 dkondrashkin

Thanks for submitting these additional fixes @dkondrashkin, we're looking over the change and will update this PR with status changes or questions.

AMZN-alexpete avatar Aug 05 '20 17:08 AMZN-alexpete