Project: mesos
Issue MESOS-3996: libprocess: document when, why defer() is necessary
Current rules around this are pretty confusing and undocumented, as evidenced by some recent bugs in this area. Some example snippets in the mesos source code that were a result of this confusion and are indeed bugs: 1. https://github.com/apache/mesos/blob/master/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp#L754 {code} return doHttpGet(blobURL, None(), true, true, None()) .then([this, blobURLPath, digest, filePath]( const http::Response& response) -> Future { Try fd = os::open( filePath.value, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); {code}
Story points: 1