From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Cc: | Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>, pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: Refactor script execution state machine in pgbench. |
Date: | 2016-09-27 06:38:46 |
Message-ID: | 57d482f5-f876-3377-c516-0d1e66cc78ee@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
On 09/27/2016 02:25 AM, Tom Lane wrote:
> Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> 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 "(<macro>) != 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
From | Date | Subject | |
---|---|---|---|
Next Message | Fabien COELHO | 2016-09-27 06:39:56 | Re: pgsql: Refactor script execution state machine in pgbench. |
Previous Message | Fabien COELHO | 2016-09-27 06:38:24 | Re: pgsql: Refactor script execution state machine in pgbench. |