<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Debugging sleeping connections with MySQL</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/</link>
	<description>Everything about MySQL Performance</description>
	<pubDate>Fri, 29 Aug 2008 23:22:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Tom Pittlik</title>
		<link>http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-184670</link>
		<dc:creator>Tom Pittlik</dc:creator>
		<pubDate>Mon, 05 Nov 2007 00:58:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-184670</guid>
		<description>I get this once in a blue moon - instead of tracking down what's causing the problem (since it's so rare) i made a simple cronjob that checks if dbconnect() fails for mysql_errno() reason 1040 (too many connections). If it does i run shell_exec("httpd restart") and the sleeping connections are gone.</description>
		<content:encoded><![CDATA[<p>I get this once in a blue moon - instead of tracking down what&#8217;s causing the problem (since it&#8217;s so rare) i made a simple cronjob that checks if dbconnect() fails for mysql_errno() reason 1040 (too many connections). If it does i run shell_exec(&#8221;httpd restart&#8221;) and the sleeping connections are gone.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-57819</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Thu, 22 Feb 2007 09:32:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-57819</guid>
		<description>Guruprasad,

I'd check if these connections are associated with open file descriptors.   If they are it is likely these are persistent connections which may be reused. If not it is likely  these connections are still closing by kernel, sometimes it takes longer time for some reason.</description>
		<content:encoded><![CDATA[<p>Guruprasad,</p>
<p>I&#8217;d check if these connections are associated with open file descriptors.   If they are it is likely these are persistent connections which may be reused. If not it is likely  these connections are still closing by kernel, sometimes it takes longer time for some reason.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guruprasad</title>
		<link>http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-57523</link>
		<dc:creator>Guruprasad</dc:creator>
		<pubDate>Thu, 22 Feb 2007 01:24:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-57523</guid>
		<description>Just in case if some one is tryin this on BSD box,
netstat -ntp might not work, u can use lsof instead like,

lsof -i -P &#124; grep  OR </description>
		<content:encoded><![CDATA[<p>Just in case if some one is tryin this on BSD box,<br />
netstat -ntp might not work, u can use lsof instead like,</p>
<p>lsof -i -P | grep  OR</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guruprasad</title>
		<link>http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-57520</link>
		<dc:creator>Guruprasad</dc:creator>
		<pubDate>Thu, 22 Feb 2007 01:19:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-57520</guid>
		<description>Hi,
I notice that my apache process is in accept call, i do notice that there are 3 connections to MySQL:3306 and show process list on MySQL indicates they are in sleep state.
Is there a way to findout if these connections will be reused by this apache child process at all?
Or are these connections more like resource leak?

-
Thanks,
Gp</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I notice that my apache process is in accept call, i do notice that there are 3 connections to MySQL:3306 and show process list on MySQL indicates they are in sleep state.<br />
Is there a way to findout if these connections will be reused by this apache child process at all?<br />
Or are these connections more like resource leak?</p>
<p>-<br />
Thanks,<br />
Gp</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-55581</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Mon, 19 Feb 2007 14:58:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-55581</guid>
		<description>Sure. Paste GDB backtrace or you can create forum topic and discuss it where.

Basically it is waiting on flock() if this is PHP I'd expect it to be session - PHP locks session file for whole script execution duration which may cause problems with a lot of requests from single agent. 

It may be something in your own code as well.   you can use "lsof" to find out what is file #24 in this process</description>
		<content:encoded><![CDATA[<p>Sure. Paste GDB backtrace or you can create forum topic and discuss it where.</p>
<p>Basically it is waiting on flock() if this is PHP I&#8217;d expect it to be session - PHP locks session file for whole script execution duration which may cause problems with a lot of requests from single agent. </p>
<p>It may be something in your own code as well.   you can use &#8220;lsof&#8221; to find out what is file #24 in this process</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous Coward</title>
		<link>http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-55577</link>
		<dc:creator>Anonymous Coward</dc:creator>
		<pubDate>Mon, 19 Feb 2007 14:53:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-55577</guid>
		<description>Me again...

Can you please give more detail on using strace/gdb?
i have few mysql that sleep for over 1000 and..
netstat on port gives me

# netstat -ntp &#124; grep :51646
tcp        0      0 127.0.0.1:51646         127.0.0.1:3306          ESTABLISHED 32034/apache2
tcp        0      0 127.0.0.1:3306          127.0.0.1:51646         ESTABLISHED 8512/mysqld

strace on pid gives me

# strace -p 32034
Process 32034 attached - interrupt to quit
flock(24, LOCK_EX

gdb shows me that it loads some libraries and that's about it
application wasn't written by me and im no php/mysql guru, just a part-time sysadmin that wants to solve this problem as usually in 1-2 days mysql conn. limit gets touched and i have to restart apache to fix it</description>
		<content:encoded><![CDATA[<p>Me again&#8230;</p>
<p>Can you please give more detail on using strace/gdb?<br />
i have few mysql that sleep for over 1000 and..<br />
netstat on port gives me</p>
<p># netstat -ntp | grep :51646<br />
tcp        0      0 127.0.0.1:51646         127.0.0.1:3306          ESTABLISHED 32034/apache2<br />
tcp        0      0 127.0.0.1:3306          127.0.0.1:51646         ESTABLISHED 8512/mysqld</p>
<p>strace on pid gives me</p>
<p># strace -p 32034<br />
Process 32034 attached - interrupt to quit<br />
flock(24, LOCK_EX</p>
<p>gdb shows me that it loads some libraries and that&#8217;s about it<br />
application wasn&#8217;t written by me and im no php/mysql guru, just a part-time sysadmin that wants to solve this problem as usually in 1-2 days mysql conn. limit gets touched and i have to restart apache to fix it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-55545</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Mon, 19 Feb 2007 12:42:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-55545</guid>
		<description>Ok. Good you've figured that you :)</description>
		<content:encoded><![CDATA[<p>Ok. Good you&#8217;ve figured that you <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous Coward</title>
		<link>http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-55538</link>
		<dc:creator>Anonymous Coward</dc:creator>
		<pubDate>Mon, 19 Feb 2007 12:34:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-55538</guid>
		<description>ok i feel kinda stupid now... it was listening in both socket and tcp so the webapp prefered the socket, ill try to change it and see what's causing the sleep processes

Thanks for info and keep up the good work</description>
		<content:encoded><![CDATA[<p>ok i feel kinda stupid now&#8230; it was listening in both socket and tcp so the webapp prefered the socket, ill try to change it and see what&#8217;s causing the sleep processes</p>
<p>Thanks for info and keep up the good work</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous Coward</title>
		<link>http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-55534</link>
		<dc:creator>Anonymous Coward</dc:creator>
		<pubDate>Mon, 19 Feb 2007 12:25:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-55534</guid>
		<description>nope, im connecting via tcp

mysqld    22241  mysql   11u  IPv4 337587343       TCP *:mysql (LISTEN)

Even so in phpmyadmin or even in cli i see only localhost with no port...</description>
		<content:encoded><![CDATA[<p>nope, im connecting via tcp</p>
<p>mysqld    22241  mysql   11u  IPv4 337587343       TCP *:mysql (LISTEN)</p>
<p>Even so in phpmyadmin or even in cli i see only localhost with no port&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-55529</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Mon, 19 Feb 2007 12:12:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/02/08/debugging-sleeping-connections-with-mysql/#comment-55529</guid>
		<description>Well, in this case you're connecting from the same host via unix socket.  In this case such information is unavailable.

If you need to debug something you can use 127.0.0.1 so connection will happen via TCP/IP</description>
		<content:encoded><![CDATA[<p>Well, in this case you&#8217;re connecting from the same host via unix socket.  In this case such information is unavailable.</p>
<p>If you need to debug something you can use 127.0.0.1 so connection will happen via TCP/IP</p>
]]></content:encoded>
	</item>
</channel>
</rss>
