Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bom2l-0001aF-3P for pgsql-committers@arkaria.postgresql.org; Tue, 27 Sep 2016 06:39:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bom2k-0004n3-ME for pgsql-committers@arkaria.postgresql.org; Tue, 27 Sep 2016 06:39:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bom2X-0004Z6-Tu for pgsql-committers@postgresql.org; Tue, 27 Sep 2016 06:38:53 +0000 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bom2U-0001sP-7T for pgsql-committers@postgresql.org; Tue, 27 Sep 2016 06:38:53 +0000 Received: by mail-lf0-x22f.google.com with SMTP id b71so10635345lfg.0 for ; Mon, 26 Sep 2016 23:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=yEPtaPh88PMhKEPxsKvzFuD/GEXxvx/X6GICx6N31xY=; b=iixA67I1PY+BN2eIRWkWktbgs7o5egtfgbtAXFeh7uI2MQ7gX2y++3no0WTkn9zmHD fu0/eKaSXPeeaRMl0ApCH2wOsKvYJUbs2DwSxiKZW4NM4BpF0GTjRNOUKpimv/9ktk/D odmTWfASc3zmmaxLPZvN4ZChkP/r+ACysZsRVKz8X0dz7N7evST4Gj7XFU8Qm9Tsbfsd 6nFCnT7MpWxqWU+fxLChPgQQaPps4GKJWTigus4eFb38tTDkzppoPc0HCiV4nnqoQbz+ +nDhgzZxOU+CjfjJNIJYUfiworWk8uLsDfSQhabsig0XeqxUpBCPSF3258jWJIeafcKH s+dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=yEPtaPh88PMhKEPxsKvzFuD/GEXxvx/X6GICx6N31xY=; b=TSE3NcRj28zFL/rndc0deVM3z32PBqOglz2PVk6dK/fqKDINe3yb3QF4n524OvXXtg CHmKq3UOMVMwMeuqEyCG1vB/QcUZKp87rcDZ5Gmb6S6L6kKUEYfDRWtx5HXzBxYhPouj LVLbK3RARbgARGy9IIOyuZElEO9/qyULV9muCbOo/brLVZwp58T9kXYPC16xcslM2JOO 7qIGiUC5BqQDYI26NdnhWujUHdm7G5+npa+g7S1X+sSKxuA0w1SkcCQ8eqFAO0cvgQRB 6SmL5ybYWhIEmRVmUJKfWi7g20s2+ujK4dgJI8FUR4OMPYJhWC5RspMuQuNleySaGJJR e5pQ== X-Gm-Message-State: AA6/9Rl3Vsnq29IJsE8LaBWYUm8E2CbqxTRgvHHcfGO5f4SATtX8aR8nv2xpezAXnTHsaQ== X-Received: by 10.28.199.14 with SMTP id x14mr1376977wmf.106.1474958328978; Mon, 26 Sep 2016 23:38:48 -0700 (PDT) Received: from [192.168.1.111] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id a1sm879380wju.41.2016.09.26.23.38.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Sep 2016 23:38:48 -0700 (PDT) Subject: Re: pgsql: Refactor script execution state machine in pgbench. To: Tom Lane , Fabien COELHO References: <3089.1474920612@sss.pgh.pa.us> <23001.1474932337@sss.pgh.pa.us> Cc: Heikki Linnakangas , pgsql-committers@postgresql.org From: Heikki Linnakangas Message-ID: <57d482f5-f876-3377-c516-0d1e66cc78ee@iki.fi> Date: Tue, 27 Sep 2016 09:38:46 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.2.0 MIME-Version: 1.0 In-Reply-To: <23001.1474932337@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On 09/27/2016 02:25 AM, Tom Lane wrote: > Fabien COELHO writes: >> Could you catch the process to identify the infinite loop? > > I think the problem is here (pgbench.c lines 4550ff): > > bool ready; > ... > ready = FD_ISSET(sock, &input_mask); > > The result of FD_ISSET isn't a bool, it's an int. I can see in the > looping process that the backend connection has socket FD 8, and > I think what is happening is that FD_ISSET is returning 1<<8 and > that's getting truncated to zero to fit in a bool (char), so that > the code just below doesn't call doCustom and we never consume the > waiting result. Hah, good catch. It's quite a landmine that a macro named "is-something" doesn't return a boolean. I remember we had issues like this in some Postgres macros too, and added a "() != 0)" into the macro definition to fix. Of course, FD_ISSET is not in our control, and "bool" is a Postgres thing anyway, so can't do that here. > Will fix. Thanks! - Heikki -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers