Johnny - 2009-07-07

running 0.9.13b
trying to track down the source of numerous sleeping threads on mysql as viewed via mytop I found the source to be phpgraphy.
For some reason when the initial page is displayed  phpgraphy creates two threads in mysql and even when the webbrowser is closed these threads remain. Here's an example of the mytop display during very low traffic:
MySQL on localhost (5.0.60-log)                         up 9+03:25:57 [12:57:20]
Queries: 8.4M   qps:   11 Slow:     0.0         Se/In/Up/De(%):    00/00/00/00
             qps now:    2 Slow qps: 0.0  Threads:    4 (   1/   0) 00/00/00/00
Key Efficiency: 99.9%  Bps in/out:   0.0/  0.0   Now in/out:   8.4/ 1.3k

      Id      User         Host/IP         DB      Time    Cmd Query or State
      --      ----         -------         --      ----    --- ----------
  227029 tritontid       localhost tritontide      4215  Sleep
  227122 tritontid       localhost tritontide      5025  Sleep
  227120 tritontid       localhost tritontide      5038  Sleep
  226874 tritontid       localhost tritontide      6062  Sleep

all of those threads were created by opening phpgraphy and persist after the browser is closed. Note that one of them has been running for 6000+ seconds
I looked into what could be causing this and I see that phpgraphy is using mysql_pconnect to open database connections.
Here's why this is a problem , see note 1:
also see the top user contributed note here:

Using mysql_pconnect  call can cause the equivalent of a DOS on the server when high trafiic occurs for the site using phpgraphy    as all mysql threads get used by dead connections.

I hope you will consider not using mysql_pconnect in future releases.