amphp / postgres

Async Postgres client for PHP based on Amp.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot set connection to nonblocking mode

PNixx opened this issue · 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: #13

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 34f7482, 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.

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

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

Try connection with pgbouncer.

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

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.

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