amphp / postgres

Async Postgres client for PHP based on Amp.
MIT License
96 stars 20 forks source link

Possible allocation and deallocation of the same statement at the same time #38

Closed codercms closed 3 years ago

codercms commented 3 years ago

Hello! I'm inspired by your great work and ported this client from AmPHP to Swoole. I'm faced a strange behavior. There is no any synchronization between statement allocation and deallocation, and with high concurrency this may lead to the same statement is being allocated and deallocated at the same time.

I can't reproduce this behavior within tests, but in real workload, eg. ab -n1000 -c100 http://your-endpoint it can be reproduced.

If it will be helpful - I fixed this issue in my port PR.