Re: BUG #18096: In edge-triggered epoll and kqueue, PQconsumeInput/PQisBusy are insufficient for correct async ops. - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #18096: In edge-triggered epoll and kqueue, PQconsumeInput/PQisBusy are insufficient for correct async ops.
Date
Msg-id 1876131.1694183591@sss.pgh.pa.us
Whole thread Raw
In response to BUG #18096: In edge-triggered epoll and kqueue, PQconsumeInput/PQisBusy are insufficient for correct async ops.  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #18096: In edge-triggered epoll and kqueue, PQconsumeInput/PQisBusy are insufficient for correct async ops.
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> When processing asynchronous commands, I call the `PQconsumeInput` and
> `PQisBusy` functions to check if data has arrived, as shown below, but this
> does not work correctly in edge trigger mode for epoll and kqueue.

You have not really provided any evidence of a bug.  The contract
for PQconsumeInput is that it will consume *some* input if any
is available, not that it will consume *all* available input.
(I don't think there is much reason to try to change that.  In the
first place, there might not be enough buffer space, and in the
second place, even if it did consume all input, more might arrive
immediately after it looks.)

Without a self-contained test case, it's hard to be sure what is going
wrong for you; but my guess is that this is a bug in the way you are
checking for more available input rather than something libpq did
wrong.

> However, the `pqReadData()` function will not call the `pqsecure_read()`
> function until the `errno` is set to `EAGAIN` or `EWOULDBLOCK`,

Uh ... what?

            regards, tom lane



pgsql-bugs by date:

Previous
From: Nikolay Samokhvalov
Date:
Subject: Re: BUG #18094: max max_connections cannot be set
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #18097: Immutable expression not allowed in generated at