Add lock around write operations in graph Upstream-commit: b380866f443141ee4b6973de22d72378b235194f Component: engine