PHP-MySQLi connection randomly fails with “Cannot assign requested address”

前端 未结 5 1666

Since about 2 weeks I\'m dealing with one of the weirdest problems in LAMP stack. Long story short randomly connection to MySQL server is failing with error message:

<         


        
5条回答
  •  -上瘾入骨i
    2021-02-04 14:31

    We had the same problem. Although "tcp_fin_timeout" and "ip_local_port_range" solutions worked, the real problem was poorly writen PHP script, which just created new connection almost every second query it made to database. Rewriting script to connect just once solved all trouble. Please be aware that lowering "tcp_fin_timeout" value may be dangerous, as some code may depend on DB connection being still there after some time after connection. It's rather a dirty duct tape and bubble gum path than real solution.

提交回复
热议问题