[PATCH] Check stale write events in ngx_epoll_module

agentzh agentzh at gmail.com
Tue Nov 8 00:40:29 UTC 2011

On Tue, Nov 8, 2011 at 1:51 AM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> Patch looks fine for me.  Could you please provide some details
> about user-visible effects observed if the problem occurs?

We've noticed this when using the ngx_postgres module to connect to a
PostgreSQL database via libpq over a no-so-good network.

The libpq library's documentation requires a write event to occur
before calling PQconnectPoll when PGRES_POLLING_WRITING was last
returned. So when a stale write event triggers the PQconnectPoll call,
libpq will simply complain about it and return an error. This is a
limitation in libpq to do non-blocking I/O and we have to work around
on the Nginx side.


More information about the nginx-devel mailing list