Resolve race conditions in attach API call Upstream-commit: caa78da1c6f1337d3b1e638e2e77dd840734f6ed Component: engine