<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Carl Pelletier blog &#187; debug</title>
	<atom:link href="http://carlpelletier.ca/tag/debug/feed/" rel="self" type="application/rss+xml" />
	<link>http://carlpelletier.ca</link>
	<description>Une immertion dans mon esprit, un peu de tout et moins que rien...</description>
	<lastBuildDate>Fri, 20 Nov 2009 19:55:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Connaitre qui à ouvert un process..</title>
		<link>http://carlpelletier.ca/2009/01/19/connaitre-qui-a-ouvert-un-process/</link>
		<comments>http://carlpelletier.ca/2009/01/19/connaitre-qui-a-ouvert-un-process/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 17:40:32 +0000</pubDate>
		<dc:creator>carlpelletier</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[technologie]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[pid]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://carlpelletier.wordpress.com/?p=61</guid>
		<description><![CDATA[Récemment j&#8217;ai travailler à corriger un bug que j&#8217;avais avec Ferret Ce petit utilitaire sur unix est trop puissant: lsof. Lsof nous permet de savoir quel application à ouvert un fichier (pid). Voici l&#8217;exemple que j&#8217;utilise J&#8217;ai eu un connection timeout dans mon postgres. Je veux savoir la liste des process psql database_name; gm_core=# SELECT * [...]]]></description>
			<content:encoded><![CDATA[<p>Récemment j&#8217;ai travailler à corriger un bug que j&#8217;avais avec <a href="http://www.davebalmain.com/">Ferret</a></p>

<p>Ce petit utilitaire sur unix est trop puissant: lsof. Lsof nous permet de savoir quel application à ouvert un fichier (pid). Voici l&#8217;exemple que j&#8217;utilise</p>

<p>J&#8217;ai eu un connection timeout dans mon postgres. Je veux savoir la liste des process</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">psql database_name;</div></div>

<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gm_core<span style="color: #66cc66;">=</span># <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> pg_stat_activity;<br />
<span style="color: #66cc66;">-</span><span style="color: #66cc66;">&#91;</span> RECORD <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">-+</span><span style="color: #808080; font-style: italic;">--------------------------------</span><br />
datid &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">79357</span><br />
datname &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">|</span> gm_core<br />
procpid &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">23621</span><br />
usesysid &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">19710</span><br />
usename &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">|</span> carlpelletier<br />
current_query <span style="color: #66cc66;">|</span><br />
waiting &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">|</span> f<br />
xact_start &nbsp; &nbsp;<span style="color: #66cc66;">|</span><br />
query_start &nbsp; <span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">2009</span><span style="color: #66cc66;">-</span>07<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">20</span> <span style="color: #cc66cc;">15</span>:<span style="color: #cc66cc;">19</span>:<span style="color: #cc66cc;">57.845857</span><span style="color: #66cc66;">-</span>04<br />
backend_start <span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">2009</span><span style="color: #66cc66;">-</span>07<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">20</span> <span style="color: #cc66cc;">15</span>:<span style="color: #cc66cc;">19</span>:<span style="color: #cc66cc;">46.448931</span><span style="color: #66cc66;">-</span>04<br />
client_addr &nbsp; <span style="color: #66cc66;">|</span><br />
client_port &nbsp; <span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">50838</span></div></div>

<p>On prend le client_port et on fait</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">lsof <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #000000;">50838</span><br />
ruby &nbsp; &nbsp; &nbsp;<span style="color: #000000;">31377</span> &nbsp; &nbsp;usrgm &nbsp; 11u &nbsp; &nbsp; IPv4 &nbsp; <span style="color: #000000;">53993738</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TCP 127.0.0.1:<span style="color: #000000;">50838</span>-<span style="color: #000000; font-weight: bold;">&amp;</span>gt;127.0.0.1:postgres <span style="color: #7a0874; font-weight: bold;">&#40;</span>ESTABLISHED<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
postmaste <span style="color: #000000;">31380</span> postgres &nbsp; &nbsp;8u &nbsp; &nbsp; IPv4 &nbsp; <span style="color: #000000;">53993743</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TCP 127.0.0.1:postgres-<span style="color: #000000; font-weight: bold;">&amp;</span>gt;127.0.0.1:<span style="color: #000000;">50838</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>ESTABLISHED<span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>

<p>Maintenant que nous avons le id du process, on peut voir le détails en faisant</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-auxwww</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #000000;">31377</span><br />
usrgm &nbsp; &nbsp;<span style="color: #000000;">31377</span> &nbsp;<span style="color: #000000;">1.0</span> &nbsp;<span style="color: #000000;">1.6</span> <span style="color: #000000;">148068</span> <span style="color: #000000;">139456</span> ? &nbsp; &nbsp; Ss &nbsp; Jun09 <span style="color: #000000;">633</span>:<span style="color: #000000;">43</span> ruby script<span style="color: #000000; font-weight: bold;">/</span>ferret_server <span style="color: #660033;">-e</span> production start<br />
carl &nbsp; &nbsp; <span style="color: #000000;">30731</span> &nbsp;<span style="color: #000000;">0.0</span> &nbsp;<span style="color: #000000;">0.0</span> &nbsp;<span style="color: #000000;">4080</span> &nbsp;<span style="color: #000000;">740</span> pts<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span> &nbsp; &nbsp;S+ &nbsp; <span style="color: #000000;">13</span>:<span style="color: #000000;">55</span> &nbsp; <span style="color: #000000;">0</span>:00 <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">--exclude</span>=<span style="color: #000000; font-weight: bold;">*</span>.svn<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #660033;">--color</span>=auto <span style="color: #000000;">31377</span></div></div>

<p>Dans le cas précédent, on peut voir que le problème de connection timeout est survenu à cause de Ferret_server. Il semble ne pas fermer les connections correctement. Est-ce vraiment Ferret ou ActiveRecord? La est la question!</p>

<p>Mon but est de démontré l&#8217;avantage de <em>lsof</em>. Je suis en train d&#8217;investiger sur le problèmes de ferret, mais je commence à trouver que c&#8217;est coder tout croche ce produit la. J&#8217;ai eu tellement de difficulté avec. Je pense aller vers Sphynx.</p>

<p>Merci à Mina Naguib pour sont aide et sont explication de la commande lsof.</p>
]]></content:encoded>
			<wfw:commentRss>http://carlpelletier.ca/2009/01/19/connaitre-qui-a-ouvert-un-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

