On 31-Mar-2003 Mike William wrote: > After a routine restart of our MySQL 3.23 server today, we began getting > the following PHP error message during times of moderately high database > server load: > > Warning: MySQL Connection Failed: Can't create a new thread (errno 11). > If > you are not out of > available memory, you can consult the manual for a possible OS-dependent > bug in > /www/data/functions/common/auth.inc on line 33 > > Line 33 of the that file is a call to mysql_pconnect(). However, if I > comment out that line temporarily, the error message simply moves to > another line in another file that is also a call to mysql_pconnect(). If > I > comment out all of my mysql_pconnect()'s then the error goes away, > although > obviously this breaks my entire website. > > I am definitely not out of memory. top says: > > 02:38:23 up 45 days, 9:23, 3 users, load average: 0.04, 0.13, 0.16 > 211 processes: 208 sleeping, 1 running, 2 zombie, 0 stopped > CPU states: 18.5% user, 3.6% system, 0.0% nice, 77.9% idle > Mem: 2069204K total, 1724224K used, 344980K free, 52840K buffers > Swap: 0K total, 0K used, 0K free, 1486132K cached > > Also, the maximum number of OS threads set in my kernel is 14336. I > can't > see any evidence that MySQL is trying to exceed this value (see the > thread > status variables I pasted below). > > On a possibly related note, I have discovered the following fact. If I > restart MySQL, the error message goes away temporarily. Then, as my site > runs for a while, the number of open persistent connections to the > database > slowly increases from 0 up to 250. When it hits 250 or 251, the error > message suddenly returns. I do not understand the significance of the > number 250, although I have noticed that when I run a SHOW STATUS, the > value of max_used_connections rises from an initial value of 0 (when the > server starts) up to 251 (at which point the error message starts), and > furthermore this rise takes place at about the same rate as the rise in > the > number of persistent connections. I don't know whether this is important > or not, although I am intrigued by the fact that this problem only > happens > when max_used_connections and the number of open persistent connections > hits the 251 "ceiling." > > Here are some select variables from SHOW STATUS as they appear once the > server hits the wall and starts giving off this error message: > >| Max_used_connections | 251 | >| Connections | 60980 | >| Threads_cached | 5 | >| Threads_created | 4303 | >| Threads_connected | 86 | >| Threads_running | 1 | > > If anyone has any ideas, please let me know. Thanks! >
Your pconnects are probably sleeping too long. in /etc/my.cnf: [mysqld] set-variable = wait_timeout=10 That'll get the connections to die off after 10 seconds. If that doesn't take care of it, check your PHP version. Early (~ 2001) PHP4 had some buggy pconnect problems. Last resort: Don't use pconnect unless you really --and I mean *really* need it. mysql_connect() is fast enough for just about everything. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]