Refactor State to be 100% thread safe Upstream-commit: 25e443a3c7f55d5ccfb1f5a96c427bd50b978f4d Component: engine