In our case the solution was lowering the mysql variable "wait_timeout" from 8 hours (the default, wtf!?) to 180 seconds. And it can still be lowered more if needed. This had to be done by the hosting company, as we do not have root access to our server.
All the other solutions I mentioned in the question were not working, like "pconnect = false" and "db->close".
"Threads_connected" are now always under 100 or 200, instead of the almost 1000 from before this fix.
My team wrestled with this problem for two days, and there's lots of people on the Web asking for solutions but without any (working) answers.
Cheers :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…