Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b9wDx-0006hT-Em for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jun 2016 15:13:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b9wDx-00020n-1F for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jun 2016 15:13:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b9wCb-0008QR-3j for pgsql-hackers@postgresql.org; Mon, 06 Jun 2016 15:12:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b9wCQ-0003L5-3K for pgsql-hackers@postgresql.org; Mon, 06 Jun 2016 15:12:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u56FCEwj017505; Mon, 6 Jun 2016 11:12:14 -0400 From: Tom Lane To: Kyotaro HORIGUCHI cc: alvherre@2ndquadrant.com, pgsql-hackers@postgresql.org Subject: Re: Parallel pg_dump's error reporting doesn't work worth squat In-reply-to: <20160606.190721.223349768.horiguchi.kyotaro@lab.ntt.co.jp> References: <20160602161711.GA239156@alvherre.pgsql> <20160603.173055.230675706.horiguchi.kyotaro@lab.ntt.co.jp> <11515.1464961470@sss.pgh.pa.us> <20160606.190721.223349768.horiguchi.kyotaro@lab.ntt.co.jp> Comments: In-reply-to Kyotaro HORIGUCHI message dated "Mon, 06 Jun 2016 19:07:21 +0900" Date: Mon, 06 Jun 2016 11:12:14 -0400 Message-ID: <17504.1465225934@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Kyotaro HORIGUCHI writes: > At Fri, 03 Jun 2016 09:44:30 -0400, Tom Lane wrote in <11515.1464961470@sss.pgh.pa.us> >> I think that this one: >>> If the target thread is allocating memory from the heap, the heap >>> lock will not be released. >> is potentially a hazard, which is why I made sure to use write_stderr >> later on in the console interrupt handler. Your original suggestion >> to use write_msg would end up going through fprintf, which might well >> use malloc internally. (It's possible that Windows' version of write() >> could too, I suppose, but that's probably as low-level as we are >> going to get.) > I have to admit that I forgot about the possible malloc's, and > PQcancel() can be blocked from the same reason. Uh, what? PQcancel is very carefully coded so that it's safe to use in a signal handler. If it's doing mallocs someplace, that would be surprising. > If the issue to be settled here is the unwanted error messages, > we could set a flag to instruct write_msg to sit silent. Anyway > the workers should have been dead that time so discarding any > error messages don't matter. > What do you think about this? This is really ugly and I'm unconvinced that it fixes anything. write_msg is hardly the only place in a worker thread that might be doing malloc's; moreover, preventing workers from entering it after we start a shutdown does nothing for workers that might be in it already. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers