Fix "write on backend 0 failed with error :"Success"" error.
authorTatsuo Ishii <ishii@postgresql.org>
Wed, 4 Jul 2018 06:25:35 +0000 (15:25 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Wed, 4 Jul 2018 06:26:16 +0000 (15:26 +0900)
While writing to a socket, sometimes write() returns 0. Before we
treated this as an error, but it seems this could happen in the field
and is better to be treated as normal. So if write() returns 0, then
retry write() instead of raise an error.

Per bug #403.

pool_stream.c

index 701b1d12edd481e1d9770fdf37282730e838916b..5d98af564df9cf959b286931d2afd291aff61495 100644 (file)
@@ -451,7 +451,7 @@ int pool_flush_it(POOL_CONNECTION *cp)
                  sts = write(cp->fd, cp->wbuf + offset, wlen);
                }
 
-               if (sts > 0)
+               if (sts >= 0)
                {
                        wlen -= sts;