Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wes6t-0008Ey-ED for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Apr 2014 20:25:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wes6s-0005NN-Tk for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Apr 2014 20:25:06 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wes6q-0005L2-IF for pgsql-hackers@postgresql.org; Mon, 28 Apr 2014 20:25:04 +0000 Received: from mout.kundenserver.de ([212.227.17.10]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wes6n-0002r4-6R for pgsql-hackers@postgresql.org; Mon, 28 Apr 2014 20:25:03 +0000 Received: from [192.168.42.222] ([195.166.117.126]) by mrelayeu.kundenserver.de (node=mreue105) with ESMTP (Nemesis) id 0MNLsv-1WYWJO30bx-006sH1; Mon, 28 Apr 2014 22:25:00 +0200 Message-ID: <535EB91B.1040908@2ndquadrant.com> Date: Mon, 28 Apr 2014 22:24:59 +0200 From: Petr Jelinek User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Robert Haas CC: PostgreSQL-development Subject: Re: shm_mq inconsistent behavior of SHM_MQ_DETACHED References: <535674B4.2040706@2ndquadrant.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:g2vLpVLs/NCv3kP4vs2PDh2o0HgFbM6jZfI14pK4P38 5N5cdlIZvWvtk7ibA5nDs1qthQ7wqogl1Di1Y1JL5twS1fagdQ 2TaVQLUL9T3MGzOUqntJb2V8MO/KhkdRw2aTgPI+vszZWj4Gtz w6gz6NpUSgf8qsI84qEBBRRggrPHU0c0N6uz1++OMsAJQJ1tBl B71VNG6693AH/R5Jh7izRAGP0r2MsC+4gFkSvgPss1J+Rgcrey CG6Rtf9t5yTgV7MP01Y8C8R/SXo1a65buGUwhQyEt9tDt50iTU OUAkp80d4Bz0PkkQvr9sVjmTouGiHnzSPe920h3IVWU7dxPaV8 X6fkmVKG5cfjpbSRb+DcRJTk7n9YHQMDeM6BcXFgm X-Pg-Spam-Score: -1.9 (-) 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 On 28/04/14 15:36, Robert Haas wrote: > On Tue, Apr 22, 2014 at 9:55 AM, Petr Jelinek wrote: >> >> But if I do first receive after detach like in this sequence: >> P1 -> set_sender >> P1 -> attach >> P2 -> set_receiver >> P2 -> attach >> P1 -> send >> P1 -> send >> P1 -> detach >> P2 -> receive >> >> I get SHM_MQ_DETACHED on the receiver even though there are messages in the >> ring buffer. > > That's a bug. > > I'm thinking that the problem is really revolves around > shm_mq_wait_internal(). It returns true if the queue is attached but > not detached, and false if either the detach has already happened, or > if we establish via the background worker handle that it will never > come. But in the case of receiving, we want to treat > attached-then-detached as a success case, not a failure case. > > Can you see if the attached patch fixes it? > Yes, the patch fixes it for me. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers