firecracker icon indicating copy to clipboard operation
firecracker copied to clipboard

Design discussion: avoid global state?

Open andreeaflorescu opened this issue 6 years ago • 2 comments

A pain point with global state is that we cannot run unit tests in parallel (aka we run unit tests with RUST_TEST_THREADS=1) which also adds problems like we are out of memory because the state is not clean (also check #1138).

We should discuss if we should refactor Firecracker such that we don't have global state (METRICS, LOGGER, others?). This would also help in creating mock objects in tests.

andreeaflorescu avatar Jun 24 '19 14:06 andreeaflorescu

We could start by removing lazy_static! usages all across Firecracker (right now we have it in mmds, logger and net_util). For the net_util crate, I think #1238 is a good place for removing the lazily evaluated statics.

dianpopa avatar Sep 09 '19 08:09 dianpopa

The components with global state left are logger, metrics and version_map MMDS was tackled in this PR: https://github.com/firecracker-microvm/firecracker/pull/2920

alindima avatar Mar 15 '22 16:03 alindima