From reviews-return-62497-apmail-mesos-reviews-archive=mesos.apache.org@mesos.apache.org Wed Jun 21 22:22:17 2017 Return-Path: X-Original-To: apmail-mesos-reviews-archive@minotaur.apache.org Delivered-To: apmail-mesos-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 82CA61AAF1 for ; Wed, 21 Jun 2017 22:22:17 +0000 (UTC) Received: (qmail 21563 invoked by uid 500); 21 Jun 2017 22:22:17 -0000 Delivered-To: apmail-mesos-reviews-archive@mesos.apache.org Received: (qmail 21530 invoked by uid 500); 21 Jun 2017 22:22:17 -0000 Mailing-List: contact reviews-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@mesos.apache.org Delivered-To: mailing list reviews@mesos.apache.org Received: (qmail 21514 invoked by uid 99); 21 Jun 2017 22:22:17 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jun 2017 22:22:17 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 994F2CEDD4; Wed, 21 Jun 2017 22:22:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.741 X-Spam-Level: *** X-Spam-Status: No, score=3.741 tagged_above=-999 required=6.31 tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=2, KAM_INFOUSMEBIZ=0.75, KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 3ZXQJdFzDGdW; Wed, 21 Jun 2017 22:22:15 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 077E85F36B; Wed, 21 Jun 2017 22:22:15 +0000 (UTC) Received: from reviews.apache.org (unknown [10.41.0.12]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A92D6E00A9; Wed, 21 Jun 2017 22:22:14 +0000 (UTC) Received: from reviews-vm2.apache.org (localhost [IPv6:::1]) by reviews.apache.org (ASF Mail Server at reviews-vm2.apache.org) with ESMTP id DB109C400EF; Wed, 21 Jun 2017 22:22:13 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============1732787202501698844==" MIME-Version: 1.0 Subject: Re: Review Request 60252: Fixed a bug that causes segfault in ProcessManager::finalize. From: Jiang Yan Xu To: Joseph Wu Cc: Jiang Yan Xu , mesos Date: Wed, 21 Jun 2017 22:22:12 -0000 Message-ID: <20170621222212.39411.39027@reviews-vm2.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: Jiang Yan Xu X-ReviewGroup: mesos X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/60252/ X-Sender: Jiang Yan Xu References: <20170621184240.39410.3938@reviews-vm2.apache.org> In-Reply-To: <20170621184240.39410.3938@reviews-vm2.apache.org> Reply-To: Jiang Yan Xu X-ReviewRequest-Repository: mesos --===============1732787202501698844== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On June 21, 2017, 11:42 a.m., Joseph Wu wrote: > > I agree this makes the finalization logic safer, but I don't see a way to add a `nullptr` to the `ProcessManager::processes` map. > > > > `ProcessManager::spawn` is the only location where the `processes` map is inserted, and this method CHECK-fails if you give it a `nullptr`. Two other locations use the map's `operator[]`, but those are guarded by a mutex so they will never empty-initialize a map entry. > > > > Can you note how you ran into a segfault here? It's more likely that the segfault was caused by a dereferencing a non-`nullptr` process that had already been deallocated (which would not be fixed by this review). The use case is something like this: https://github.com/apache/mesos/blob/65152413836b58d01ace3a40bdc9056f9a489c6b/3rdparty/libprocess/src/tests/process_tests.cpp#L691 Arguably I made an error in doing: ``` ProcessBase process; UPID pid = spawn(&process, true); ... terminate(process); wait(process); ``` And the process (in a test method) goes out of scope before libprocess finalize() so it segfaulted. Just felt it's not really necessary to fail (and it used to not) in this way? - Jiang Yan ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/60252/#review178522 ----------------------------------------------------------- On June 20, 2017, 4:16 p.m., Jiang Yan Xu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/60252/ > ----------------------------------------------------------- > > (Updated June 20, 2017, 4:16 p.m.) > > > Review request for mesos and Joseph Wu. > > > Repository: mesos > > > Description > ------- > > We don't need and shouldn't assume pointers in `processes` are > non-nullptr. > > > Diffs > ----- > > 3rdparty/libprocess/src/process.cpp 7ce6d2b13baa68906e091a95c0dd58ee1ca2bc7d > > > Diff: https://reviews.apache.org/r/60252/diff/1/ > > > Testing > ------- > > make check. > > > Thanks, > > Jiang Yan Xu > > --===============1732787202501698844==--