<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[RRD stops updating; traced the problem to check_reload_status?]]></title><description><![CDATA[<p dir="auto">I've been having a problem on 2.0-RC1 where the RRD graphs will stop working correctly. The image files will update and show the correct timestamp, but all the data points after a certain point of time will be missing in all the categories. I determined that this always happens, 100% of the time, after clicking 'Save' on System &gt; Advanced. It will fix itself after clicking 'Save' on Status &gt; RRD Graphs &gt; Settings.</p>
<p dir="auto">The graphs stop showing data because, according to the timestamps in /var/db/rrd, none of the *.rrd files are being updated. Possibly related, this behavior is always accompanied by two instances of the '/bin/sh /var/db/rrd/updaterrd.sh' process running (normally, when it's working properly, there is only one).</p>
<p dir="auto">This bugged me, so I traced through the code to figure out what happens differently between the "breaking" and "fixing" actions. When saving settings on System &gt; Advanced, this happens:</p>
<ol>
<li>
<p dir="auto">/usr/local/www/system_advanced_admin.php calls <strong>/etc/inc/util.inc:send_event()</strong> with the message "service restart webgui"</p>
</li>
<li>
<p dir="auto">send_event() writes the message to <strong>/var/run/check_reload_status</strong>, which appears to be some sort of socket</p>
</li>
</ol>
<p dir="auto">This is where things get a bit hazy. I understand that <strong>/usr/local/sbin/check_reload_status</strong> runs as a daemon which constantly checks the socket, but I don't know the actual specifics of what it does internally. It's a binary and I don't know where I can find its source code. But I ran 'strings' on it and took an educated guess…</p>
<ol start="3">
<li>
<p dir="auto">check_reload_status seems to run <strong>/usr/local/bin/php /etc/rc.restart_webgui</strong></p>
</li>
<li>
<p dir="auto">rc.restart_webgui calls <strong>/etc/inc/rrd.inc:enable_rrd_graphing()</strong></p>
</li>
<li>
<p dir="auto">enable_rrd_graphing() writes a fresh copy of <strong>/var/db/rrd/updaterrd.sh</strong>, kills all running instances via <strong>/bin/pkill -f updaterrd.sh</strong>, and runs the new copy (<strong>/usr/bin/nice -n20 /bin/sh /var/db/rrd/updaterrd.sh</strong>) in the background</p>
</li>
<li>
<p dir="auto">updaterrd.sh runs in an infinite loop, updating the *.rrd files and sleeping.</p>
</li>
</ol>
<p dir="auto">When saving settings on the RRD Settings page, enable_rrd_graphing() is called directly, jumping into step 5 above. So somewhere in steps 1-4, two updaterrd.sh processes are somehow started.</p>
<p dir="auto">I <em>think</em> I've nailed it down to something in check_reload_status, for the following reason. Every time I run '/usr/local/bin/php /etc/rc.restart_webgui' through SSH, only one updaterrd.sh instance is started and the graphs update properly. Conversely, I whipped up the following script that (I think) pretty accurately distills what happens when clicking Save on System &gt; Advanced:</p>
<pre><code>
  $fd = @fsockopen('unix:///var/run/check_reload_status');
  if ($fd) {
    fwrite($fd, 'service restart webgui');
    echo fread($fd, 4096);
    fclose($fd);
  }

?&gt;
</code></pre>
<p dir="auto">The script echoes the string 'OK', but ps shows two updaterrd.sh instances running (and the *.rrd files stop updating).</p>
<p dir="auto">Now, the thing that baffles me is how two instances of updaterrd.sh can run at once. Unless there's another call hidden in a binary somewhere, the script is only stared in rrd.inc, and old versions are pkill'd away immediately before. Is it possible, somehow, that enable_rrd_graphing() is running twice, in two separate threads, which both pkill at the same exact instant, and <em>then</em> both spawn their own copy of updaterrd.sh?</p>
<p dir="auto">That's my crackpot theory, anyway. Anybody got anything better? ;)</p>
]]></description><link>https://forum.netgate.com/topic/32342/rrd-stops-updating-traced-the-problem-to-check_reload_status</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 04:39:13 GMT</lastBuildDate><atom:link href="https://forum.netgate.com/topic/32342.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 03 Apr 2011 19:34:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to RRD stops updating; traced the problem to check_reload_status? on Mon, 04 Apr 2011 08:31:58 GMT]]></title><description><![CDATA[<p dir="auto">Fixed it. https://rcs.pfsense.org/projects/pfsense/repos/mainline/commits/056df2d9f0af16083bb0f601cb519e87741f1013</p>
]]></description><link>https://forum.netgate.com/post/273432</link><guid isPermaLink="true">https://forum.netgate.com/post/273432</guid><dc:creator><![CDATA[eri--]]></dc:creator><pubDate>Mon, 04 Apr 2011 08:31:58 GMT</pubDate></item></channel></rss>