postgres icon indicating copy to clipboard operation
postgres copied to clipboard

Cannot set connection to nonblocking mode

Open PNixx opened this issue 4 years ago • 6 comments

I see a same error on v1.3.3. I set a pool 10 connection and receive error after 1-2 minutes:

pg_connection_busy(): Cannot set connection to nonblocking mode, /project/vendor/amphp/postgres/src/PgSqlHandle.php:109

When I used pool 5, I did not observe such a problem.

Similar issue: https://github.com/amphp/postgres/issues/13

PNixx avatar Apr 27 '21 08:04 PNixx

The connection may be going away, resulting in this call returning -1. Can you try reducing the idle timeout on your pool and see if that helps?

I added a check for a closed connection 34f748237f138da8d3b805de84e2767239635ed6, so you could also try with master and see if that eliminates the error, as it should close the connection, resulting in the connection being removed from the pool.

trowski avatar Apr 29 '21 15:04 trowski

Did not help. I see a same error:

pg_connection_busy(): Cannot set connection to nonblocking mode, /project/vendor/amphp/postgres/src/PgSqlHandle.php:117

PNixx avatar May 06 '21 10:05 PNixx

I haven't been able to reproduce this. Any tips?

trowski avatar Aug 24 '21 22:08 trowski

Try connection with pgbouncer.

PNixx avatar Sep 02 '21 12:09 PNixx

I try similar errors with version 1.4.1:

pg_connection_busy(): Cannot set connection to nonblocking mode, /project/vendor/amphp/postgres/src/PgSqlHandle.php:122

PNixx avatar Sep 02 '21 12:09 PNixx

I think I have found the reason for this error. I use pgbouncer with pool 20, my php worker pool 20 and other app with pool 20. When the php worker is running at full capacity, I get this error. Because an other app uses connections too.

PNixx avatar Sep 16 '21 07:09 PNixx

Sounds like this issue was due to something external to this library, so I'm closing this issue.

trowski avatar Jan 07 '23 15:01 trowski