<?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>Untitled &#187; gotcha</title>
	<atom:link href="http://ammonlauritzen.com/blog/tag/gotcha/feed/" rel="self" type="application/rss+xml" />
	<link>http://ammonlauritzen.com/blog</link>
	<description>and still for good reason.</description>
	<lastBuildDate>Wed, 05 May 2010 18:43:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>xtrabackup innodb_file_per_table gotcha</title>
		<link>http://ammonlauritzen.com/blog/2009/08/18/xtrabackup-innodb_file_per_table-gotcha/</link>
		<comments>http://ammonlauritzen.com/blog/2009/08/18/xtrabackup-innodb_file_per_table-gotcha/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 17:55:03 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[innodb]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[xtrabackup]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/?p=540</guid>
		<description><![CDATA[Several months ago, I&#8217;d switched to using Percona&#8217;s xtrabackup &#038; innobackupex for all of my mysql backup needs. I had successfully used these backups to restore and replicate databases across several systems. It is good stuff.
Last week, I needed to set up new replication of an 80gb database. This should have been routine by now, [...]]]></description>
			<content:encoded><![CDATA[<p>Several months ago, I&#8217;d switched to using Percona&#8217;s xtrabackup &#038; innobackupex for all of my mysql backup needs. I had successfully used these backups to restore and replicate databases across several systems. It is good stuff.</p>
<p>Last week, I needed to set up new replication of an 80gb database. This should have been routine by now, but when I attempted to prepare the backup this time, it whined and complained and failed. I was kind of frazzled by the time I gave up on the issue and declared it a fluke of one sort or another.</p>
<p>Last night, I tried again from Sunday&#8217;s full backup, and it happened again:</p>
<pre>
ammon@amy:/var/lib/2009-08-16_04-02-17$ sudo xtrabackup --prepare --target-dir=.
xtrabackup  Ver 0.8.1rc Rev 78 for 5.0.83 unknown-linux-gnu (x86_64)
xtrabackup: cd to .
xtrabackup: This target seems to be not prepared yet.
xtrabackup: xtrabackup_logfile detected: size=75546624, start_lsn=(86 1293090752)
xtrabackup: Temporary instance for recovery is set as followings.
xtrabackup:   innodb_data_home_dir = ./
xtrabackup:   innodb_data_file_path = ibdata1:512M:autoextend
xtrabackup:   innodb_log_group_home_dir = ./
xtrabackup:   innodb_log_files_in_group = 1
xtrabackup:   innodb_log_file_size = 75546624
xtrabackup: Starting InnoDB instance for recovery.
xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
InnoDB: Log scan progressed past the checkpoint lsn 86 1293090752
090818  2:54:34  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
090818  2:54:34  InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: File name .//tmp/#sql6e1e_8cce1_0.ibd
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
</pre>
<p>I gave up after poking a few things.</p>
<p>This morning&#8217;s fresh look turned up <a href='http://bugs.mysql.com/bug.php?id=41609'>this bug report</a>.</p>
<pre>
ammon@amy:/var/lib/2009-08-16_04-02-17$ sudo <b>mkdir tmp</b>
ammon@amy:/var/lib/2009-08-16_04-02-17$ sudo xtrabackup --prepare --target-dir=.
xtrabackup  Ver 0.8.1rc Rev 78 for 5.0.83 unknown-linux-gnu (x86_64)
xtrabackup: cd to .
xtrabackup: This target seems to be not prepared yet.
090818 12:27:41  InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
xtrabackup: Warning: cannot open ./xtrabackup_logfile. will try to find.
xtrabackup: 'ib_logfile0' seems to be 'xtrabackup_logfile'. will retry.
xtrabackup: xtrabackup_logfile detected: size=84983808, start_lsn=(86 1293090752)
xtrabackup: Temporary instance for recovery is set as followings.
xtrabackup:   innodb_data_home_dir = ./
xtrabackup:   innodb_data_file_path = ibdata1:512M:autoextend
xtrabackup:   innodb_log_group_home_dir = ./
xtrabackup:   innodb_log_files_in_group = 1
xtrabackup:   innodb_log_file_size = 84983808
xtrabackup: Starting InnoDB instance for recovery.
xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
InnoDB: Log scan progressed past the checkpoint lsn 86 1293090752
090818 12:27:41  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Doing recovery: scanned up to log sequence number 86 1298333184 (6 %)
InnoDB: Doing recovery: scanned up to log sequence number 86 1303576064 (13 %)
InnoDB: Doing recovery: scanned up to log sequence number 86 1308818944 (20 %)
InnoDB: Doing recovery: scanned up to log sequence number 86 1314061824 (27 %)
InnoDB: Doing recovery: scanned up to log sequence number 86 1319304704 (34 %)
090818 12:27:44  InnoDB: Starting an apply batch of log records to the database...
<i>... snip ...</i>
</pre>
<p>That&#8217;s right. There&#8217;s a bug in innodb restoration that interprets location of /tmp (configurable in my.cnf) to be relative in stead of absolute.</p>
<p>So, if you have problems while trying to restore from an xtrabackup/ibbackup snapshot (or if you&#8217;re trying to recover innodb after a crash), just creating the offending tmp directory appears to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2009/08/18/xtrabackup-innodb_file_per_table-gotcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php signals while selecting</title>
		<link>http://ammonlauritzen.com/blog/2008/10/27/php-signals-while-selecting/</link>
		<comments>http://ammonlauritzen.com/blog/2008/10/27/php-signals-while-selecting/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 20:26:38 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[posix signals]]></category>
		<category><![CDATA[sockets]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/?p=399</guid>
		<description><![CDATA[So a fairly longstanding gripe of mine has been that PHP fails to execute registered signal handlers when it receives a signal in the middle of a blocking select call. Today, I finally bumped into a situation where I couldn&#8217;t just change the spec to avoid the situation&#8230; and I&#8217;ve finally figured out how to [...]]]></description>
			<content:encoded><![CDATA[<p>So a fairly longstanding gripe of mine has been that PHP fails to execute registered signal handlers when it receives a signal in the middle of a blocking select call. Today, I finally bumped into a situation where I couldn&#8217;t just change the spec to avoid the situation&#8230; and I&#8217;ve finally figured out how to make it work.</p>
<p>The bug has been reported <a href='http://bugs.php.net/44614'>here</a>, where it was ignored for a few months before being shot down and ignored some more as per php dev team regulations.</p>
<p>Sample code given by the reporter of the bug is markedly similar to the situations I&#8217;ve encountered the problem:</p>
<pre class="brush: php;">
pcntl_signal(SIGINT, &quot;sig_handler&quot;);
$sock = socket_create_listen($port);
$read_socks = array($sock);
$n = NULL;
$foo = socket_select($read_socks, $n, $n, NULL);
</pre>
<p>By filling in his blanks, my first test case looks something like this:</p>
<pre class="brush: php;">
&lt;?
function sig_handler($signo) {
        echo &quot;received sig #$signo\\\n&quot;;
}
pcntl_signal( SIGINT, &quot;sig_handler&quot; );

$socket = socket_create_listen( 1234 );
$r = array( $socket );
$n = NULL;
while( true ) {
        $foo = socket_select( $r, $n, $n, NULL );
        echo &quot;select returned '$foo'\\\n&quot;;
}
?&gt;
</pre>
<p>When executing the script and pressing ^C (which sends SIGINT), the following occurs:</p>
<pre class="brush: plain;">
ammon@morbo:~$ php sigtest.php
PHP Warning:  socket_select(): unable to select [4]: Interrupted system call in /home/ammon/sigtest.php on line 13
select returned ''
</pre>
<p>Ok, so the warning is to be expected, and we can easily squelch that.</p>
<p>The real problem is that the signal handler never runs.</p>
<p>However&#8230; for the first time in my life, a response to a php bug report proves enlightening. The dev who answered this ticket provides his sample code and says he can&#8217;t duplicate the bug. Upon looking at the differences between their code, only one difference stands out:</p>
<pre class="brush: php;">
declare(ticks=1);
</pre>
<p>The <a href='http://php.net/declare'>declare(ticks)</a> directive is deprecated as of php 5.3 and will not be with us in php 6.0. Ticks are an unreliable, unpredictable, and generally bad thing in php. I&#8217;ve neither successfully used them nor seen a successful and justified use.</p>
<p>That being said&#8230; turning the tick on but not telling it to do anything appears to address the problem of discarded interrupts:</p>
<pre class="brush: php;">
&lt;?
declare(ticks=1);

function sig_handler($signo) {
        echo &quot;received sig #$signo\\\n&quot;;
}
pcntl_signal( SIGINT, &quot;sig_handler&quot; );

$socket = socket_create_listen( 1234 );
$r = array( $socket );
$n = NULL;
while( true ) {
        $foo = @socket_select( $r, $n, $n, NULL );
        echo &quot;select returned '$foo'\\\n&quot;;
}
?&gt;
</pre>
<p>And execution:</p>
<pre class="brush: plain;">
ammon@morbo:~$ php sigtest.php
received sig #2
select returned ''
</pre>
<p>Which is precisely the desired behavior.</p>
<p>I don&#8217;t know what the performance hit for turning ticks on is, I haven&#8217;t had time to research this. But I can confirm that by declaring ticks globally, it does work in an OO environment as well:</p>
<pre class="brush: php;">
&lt;?
declare(ticks=1);

class signal_tester {
    function __construct() {
        pcntl_signal( SIGINT, array(&amp;$this,&quot;sig_handler&quot;) );
        $this-&gt;start();
    }

    function sig_handler($signo) {
        echo &quot;received sig #$signo\\\n&quot;;
    }

    function start() {
        $socket = socket_create_listen( 1234 );
        $r = array( $socket );
        $n = NULL;
        while( true ) {
            $foo = @socket_select( $r, $n, $n, NULL );
            echo &quot;select returned '$foo'\\\n&quot;;
        }
    }
}

$test = new signal_tester();
?&gt;
</pre>
<p>Executing and hitting ^C:</p>
<pre class="brush: plain;">
ammon@morbo:~$ php sigtest.php
received sig #2
select returned ''
</pre>
<p>After a few minutes of largely unscientific testing, it appears that turning ticks on globally costs a whopping 4 bytes of ram and causes the script to occasionally consume more cpu than the top process I used to monitor it. So&#8230; at first glance the cost is pretty negligible and all I can say is that if you ever need to handle signals (SIGTERM, SIGHUP, etc&#8230;) from within a blocking select call in php, it looks like declare ticks is the only option for now.</p>
<p>I did the initial tests in 5.1.6, but can confirm the same behavior in 5.2.5. I don&#8217;t know how the behavior is going to be in 5.3, since I don&#8217;t run alpha releases on my servers but my gut likes to think that it will continue to work the same for now&#8230; and will hopefully not break until 6.0 (when everything else will explode for a few years). Shrug.</p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2008/10/27/php-signals-while-selecting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>shared key gotchas</title>
		<link>http://ammonlauritzen.com/blog/2008/03/25/shared-key-gotchas/</link>
		<comments>http://ammonlauritzen.com/blog/2008/03/25/shared-key-gotchas/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 22:40:49 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/2008/03/25/shared-key-gotchas/</guid>
		<description><![CDATA[This is something that has kept coming back to bite me recently.
When you are setting up public-key authentication on OpenSSH, you must be very careful of file ownerships and permissions. In many stock unix setups, this isn&#8217;t a problem. But in any environment where you are relying on a lot of group access to files, [...]]]></description>
			<content:encoded><![CDATA[<p>This is something that has kept coming back to bite me recently.</p>
<p>When you are setting up public-key authentication on OpenSSH, you must be very careful of file ownerships and permissions. In many stock unix setups, this isn&#8217;t a problem. But in any environment where you are relying on a lot of group access to files, it is easy to slip up and earn yourself a system that will silently fail to authenticate (unless you turn on debug level verbosity).</p>
<ol>
<li>The private key must be readable only by the user initiating the connection.</li>
<li>The authorized_hosts file must be writable only by the account accepting the connection.</li>
</ol>
<p>Sounds simple enough, ne?</p>
<p>The real trick is that group write permission anywhere up the directory tree can render these precautions meaningless. Who cares if I can&#8217;t see into .ssh in your home directory if I can manipulate your home dir itself?</p>
<ol start='3'>
<li>$HOME and $HOME/.ssh must be locked down on the destination host.</li>
</ol>
<p>A general good rule of thumb for permissions might be something like this:</p>
<pre>
ammon@farnsworth:~$ <b>chmod 755 .</b>
ammon@farnsworth:~$ <b>chmod 700 .ssh</b>
ammon@farnsworth:~$ <b>chmod 600 .ssh/authorized_keys</b>
</pre>
<p>Obviously, this gets kind of tricksy if you want to do something like allow SCP file transfers to the Apache user on a system&#8230; and their home dir is /var/www&#8230; and your web developers have group write access to this dir.</p>
<p>In situations like that, you have two options. First, you could disable the permissions checks (by turning off StrictModes in the sshd_config), but that&#8217;s not advisable. Second, you could make a separate home dir for the apache user with the restrictions in a place where they won&#8217;t interfere with anyone&#8217;s work.</p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2008/03/25/shared-key-gotchas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>svn whitespace blues</title>
		<link>http://ammonlauritzen.com/blog/2008/03/18/svn-whitespace-blues/</link>
		<comments>http://ammonlauritzen.com/blog/2008/03/18/svn-whitespace-blues/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 06:57:13 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[diff]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/2008/03/18/svn-whitespace-blues/</guid>
		<description><![CDATA[For the longest time, I have been suffering with problems of changes whitespace rendering SVN diffs useless.
Sometimes it&#8217;s the spaces vs tabs issue. Sometimes it&#8217;s file line endings (silly Windows-only editors and their CRLF). And sometimes it&#8217;s just people adjusting whitespace arbitrarily on lines (like adding spaces around parens or leaving spaces at the end [...]]]></description>
			<content:encoded><![CDATA[<p>For the longest time, I have been suffering with problems of changes whitespace rendering SVN diffs useless.</p>
<p>Sometimes it&#8217;s the spaces vs tabs issue. Sometimes it&#8217;s file line endings (silly Windows-only editors and their CRLF). And sometimes it&#8217;s just people adjusting whitespace arbitrarily on lines (like adding spaces around parens or leaving spaces at the end of lines, etc&#8230;).</p>
<p>Regardless of the individual manifestation, it&#8217;s a silly problem, but one that causes more than its share of tears among developers everywhere.</p>
<p>Perhaps the easiest and smartest solution is to browbeat your co-developers into compliance. Force people to use editors that preserve line endings, force them to strip trailing whitespace and conform to a universal standard of indentation, etc&#8230; but it&#8217;s not always the nicest or most reliable solution. People will make mistakes, even if it&#8217;s only once a month&#8230; going over that diff might cost you an hour to figure out what had actually changed.</p>
<p>There are a few other solutions out there. They&#8217;re not new, and they&#8217;re not for everyone&#8230; but they can be phenomenally helpful at times. I&#8217;ll go over the two simplest ones.</p>
<h3>dos2unix</h3>
<p>Ever gotten a diff that reads like this?</p>
<pre style='border: thin solid black; padding: 0.25em'><code>ammon@binky:~/test$ <b>svn diff one</b>
Index: one
===================================================================
--- one (revision 2)
+++ one (working copy)
@@ -1,11 +1,11 @@
-One is the loneliest number that you'll ever do
-Two can be as bad as one
-It's the loneliest number since the number one
-
-No is the saddest experience you'll ever know
-Yes, it's the saddest experience you'll ever know
-`Cause one is the loneliest number that you'll ever do
-One is the loneliest number, worse than two
-
-It's just no good anymore since she went away
-Now I spend my time just making rhymes of yesterday
+One is the loneliest number that you'll ever do
+Two can be as bad as one
+It's the loneliest number since the number one
+
+No is the saddest experience you'll ever know
+Yes, it's the saddest experience you'll ever know
+'cause one is the loneliest number that you'll ever do
+One is the loneliest number, worse than two
+
+It's just no good anymore since she went away
+Now I spend my time just making rhymes of yesterday
</code></pre>
<p>This is what happens when something changes the line endings of a file. In this case, the original file was created with LF endings and was then edited slightly by an application that converted them to CRLF.</p>
<p>Now&#8230; if this were a 1000 line perl script in stead of an 11 line lyrics snippet&#8230; it would be soulcrushingly difficult to find the one actual change in the file.</p>
<p>Most unix distros have at their disposal the dos2unix / unix2dos utilities. On Red Hat, you can <code>yum install dos2unix</code> to get them. On Debian/Ubuntu, you can <code>apt-get install tofrodos</code>. I don&#8217;t have any other unices lying around at present to check on, but you can always just get the source at <a href='http://www.thefreecountry.com/tofrodos/index.shtml'>http://www.thefreecountry.com/tofrodos</a>.</p>
<pre style='border: thin solid black; padding: 0.25em'><code>ammon@binky:~/test$ <b>dos2unix one</b>
ammon@binky:~/test$ <b>svn diff one</b>
Index: one
===================================================================
--- one (revision 2)
+++ one (working copy)
@@ -4,7 +4,7 @@

 No is the saddest experience you'll ever know
 Yes, it's the saddest experience you'll ever know
-`Cause one is the loneliest number that you'll ever do
+`cause one is the loneliest number that you'll ever do
 One is the loneliest number, worse than two

 It's just no good anymore since she went away
</code></pre>
<p>Much easier to figure out what has changed this way.</p>
<p>For extra credit, look into the <a href='http://svnbook.red-bean.com/en/1.4/svn.advanced.props.file-portability.html#svn.advanced.props.special.eol-style'>svn:eol-style</a> property. Set this on files as you commit them &#8211; or just use <a href='http://svnbook.red-bean.com/en/1.4/svn.advanced.props.html#svn.advanced.props.auto'>autoprops</a> to do the dirty work for you&#8230;</p>
<h3>diff-cmd</h3>
<p>Of course, some times it&#8217;s not line endings. Sometimes the problem is random meaningless whitespace changes. Maybe somebody used an editor that auto-indents with spaces when the file was already indented with tabs, etc&#8230;</p>
<p>Subversion allows you to specify an alternate command to use to generate your diffs (in stead of relying on svn&#8217;s internal diff generation). </p>
<pre style='border: thin solid black; padding: 0.25em'><code>ammon@binky:~/test$ <b>svn diff ----diff-cmd /usr/bin/diff -x -w one</b>
Index: one
===================================================================
7c7
< `Cause one is the loneliest number that you'll ever do
---
> `cause one is the loneliest number that you'll ever do
</code></pre>
<p>But what if (for some bizarre reason) you don&#8217;t care about the case of letters?</p>
<pre style='border: thin solid black; padding: 0.25em'><code>ammon@binky:~/test$ <b>svn diff ----diff-cmd /usr/bin/diff -x -iw one</b>
Index: one
===================================================================
</code></pre>
<p>If you always want to use your <a href='http://svnbook.red-bean.com/en/1.4/svn.advanced.externaldifftools.html#svn.advanced.externaldifftools.diff'>custom diff utility</a> you can set it in your runtime config to save yourself the hassle of having to type it manually each time.</p>
<p>For those using TortoiseSVN, you can always just specify graphical diff/merge utils to use in stead of Tortoise&#8217;s builtin ones. Personally, I&#8217;m a big fan of <a href='http://winmerge.org/'>WinMerge</a>, but there are several other good ones out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2008/03/18/svn-whitespace-blues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ioerror on https under ie7</title>
		<link>http://ammonlauritzen.com/blog/2007/08/23/ioerror-on-https-under-ie7/</link>
		<comments>http://ammonlauritzen.com/blog/2007/08/23/ioerror-on-https-under-ie7/#comments</comments>
		<pubDate>Thu, 23 Aug 2007 17:24:33 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[ie7]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sessions]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/2007/08/23/ioerror-on-https-under-ie7/</guid>
		<description><![CDATA[Last week week, I noticed a strange problem with a project I am working on. The SWF worked fine on XP, Linux, Vista, and OSX. It worked under Firefox, Opera, and Safari. It&#8230; loaded under IE7, and then just sort of sat there and pretended that the web services it was trying to call were [...]]]></description>
			<content:encoded><![CDATA[<p>Last week week, I noticed a strange problem with a project I am working on. The SWF worked fine on XP, Linux, Vista, and OSX. It worked under Firefox, Opera, and Safari. It&#8230; loaded under IE7, and then just sort of sat there and pretended that the web services it was trying to call were broken. After poking things for a bit, I sent an email to the <a href='http://chattyfig.figleaf.com/mailman/listinfo/flashcoders'>Flashcoders</a> mailing list:</p>
<blockquote style='font-style: normal'><p>
I have a swf that is being loaded off of an https server. As it fires up, it attempts to call a simple authentication service that lives on the same host. This works fine under Firefox, Opera, and Safari.</p>
<p>However, under IE, it throws an exception:</p>
<p>[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://host/path/script.php?username=allaryin&#038;passwd=hash"]</p>
<p>Obviously, if I just load the url directly into IE, it loads fine. This problem only occurs when flash tries to load the url for me.</p>
<p>When I monitor the query with <a href='http://www.xk72.com/charles/'>Charles</a>, it shows that the request is being made correctly and that the information I am expecting is successfully being returned. However, Flash is apparently ignoring the response.</p>
<p>This behavior has been observed on different machines, running both XP and Vista.</p>
<p>Thoughts?
</p></blockquote>
<p>A few days after sending this email, I&#8217;d received no response other than an IM from a friend on the list who didn&#8217;t know the answer either. So&#8230; I resumed consultation of the Google. I dug through ML archives. I read IRC logs. Eventually, I stumbled across mention of a blog post back in 2005 that had addressed a similar problem under IE6. Unfortunately, the site hosting this old blog has ceased to exist/function. So, I found it on the Internet Archive:</p>
<p><a href='http://web.archive.org/web/20070521185428/http://www.gmrweb.net/2005/08/18/flash-remoting-https-internet-explorer/'>http://web.archive.org/web/20070521185428/http://www.gmrweb.net/2005/08/18/flash-remoting-https-internet-explorer/</a></p>
<p>The post mentions a few potential solutions to the problem such as doing some http header management in Apache. I tried the suggested changes (in the PHP, I didn&#8217;t have the access/desire to tweak Apache at the time):</p>
<pre class="brush: php;">
header(&quot;Expires: &quot; . date(&quot;D, d M Y H:i:s&quot;, 0) . &quot; GMT&quot;);
header(&quot;Last-Modified: &quot; . gmdate(&quot;D, d M Y H:i:s&quot;) . &quot; GMT&quot;);
header(&quot;Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0&quot;);
</pre>
<p>This didn&#8217;t have any effect on my particular problem. Charles showed that the requested headers were being sent correctly, but Flash + IE7 + HTTPS still failed to talk to my web service.</p>
<p>So, I poked around the net some more without coming up with any helpful solutions to the problem. Returning to the archived blog post, I read the comments and saw another solution proposed. Someone said that simply sending an empty pragma header seemed to help in cases where IE was having difficulty dealing with PHP sessions over HTTPS. Specifically, the pragma header needed to be flushed after the session had started.</p>
<p>And we <u>were</u> using a session variable&#8230;</p>
<pre class="brush: php;">
session_start();
header(&quot;Pragma: &quot;);
</pre>
<p>And it works now.</p>
<p>So&#8230; yeah. Hooray for obscure comments on wayback machine archived blog posts addressing a similar problem <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2007/08/23/ioerror-on-https-under-ie7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>opera is schizophrenic</title>
		<link>http://ammonlauritzen.com/blog/2007/01/05/opera-is-schizophrenic/</link>
		<comments>http://ammonlauritzen.com/blog/2007/01/05/opera-is-schizophrenic/#comments</comments>
		<pubDate>Fri, 05 Jan 2007 23:26:19 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[opera]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/2007/01/05/opera-is-schizophrenic/</guid>
		<description><![CDATA[Today I&#8217;ve discovered an interesting bug.
Big application we&#8217;re working on over here (a Flex/AS3 rewrite and feature upgrade for the CMYK Books layout application) works fine in every browser we&#8217;ve thrown at it. With one interesting caveat.
It doesn&#8217;t play nice with Opera 9 (haven&#8217;t tried older versions, come to think of it&#8230;).
The application loads just [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ve discovered an interesting bug.</p>
<p>Big application we&#8217;re working on over here (a Flex/AS3 rewrite and feature upgrade for the <a href='http://www.cmykbooks.com'>CMYK Books</a> layout application) works fine in every browser we&#8217;ve thrown at it. With one interesting caveat.</p>
<p>It doesn&#8217;t play nice with Opera 9 (haven&#8217;t tried older versions, come to think of it&#8230;).</p>
<p>The application loads just fine. If you point your browser directly at the SWF file, it does everything it&#8217;s supposed to.</p>
<p>But, if you load the SWF from within an HTML page (ie, the normal way), it starts to be problematic. Specifically, it starts sending bogus HTTP headers. These headers confuse the web services (since IIS detects that the&#8217;re being sent an ill-formed request and refuses to pass it on for soap parsage). What you wind up with is a page that loads normally and takes you to a login form that doesn&#8217;t do anything when you click the button.</p>
<p>Specifically, what happens is the application sends two <i>Referer</i> headers. One containing the URL of the HTML file and one containing the URL of the SWF. If the SWF isn&#8217;t loaded from within an HTML file, it only sends the one referrer (the SWF&#8217;s location), and IIS recognizes the valid request and everything works.</p>
<p>So&#8230; how to fix it? Not entirely sure yet. None of the options that I&#8217;ve been able to see/change seem to have any effect. But this is a pretty big strike against Opera IMO. I&#8217;m a fan of the application, it&#8217;s always been good to me when I&#8217;ve used it. I&#8217;m excited to play with it on my Wii (if I ever get one&#8230; mumble). But for it to do such an odd thing&#8230; confuses me.</p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2007/01/05/opera-is-schizophrenic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>flash audio timeline confusion</title>
		<link>http://ammonlauritzen.com/blog/2006/12/12/flash-audio-timeline-confusion/</link>
		<comments>http://ammonlauritzen.com/blog/2006/12/12/flash-audio-timeline-confusion/#comments</comments>
		<pubDate>Tue, 12 Dec 2006 21:57:51 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[as2]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[gotcha]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/2006/12/12/flash-audio-timeline-confusion/</guid>
		<description><![CDATA[Audio synchronization in Flash has always been something of a black art. It&#8217;s a lot better these days, but there are still some interesting glitches floating around.
I&#8217;ve currently got a doozy of an issue in a project that I thought I was done with over a month ago  
There are two and a half [...]]]></description>
			<content:encoded><![CDATA[<p>Audio synchronization in Flash has always been something of a black art. It&#8217;s a lot better these days, but there are still some interesting glitches floating around.</p>
<p>I&#8217;ve currently got a doozy of an issue in <a href='http://redbullsoapboxusa.com/game.aspx'>a project</a> that I thought I was done with over a month ago <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>There are two and a half ways to manipulate sound in Flash.</p>
<ol>
<li>You can just drop audio tracks onto the timeline and hope for the best.</li>
<li>You can instantiate Sound objects in, attach the audio tracks, and play them.</li>
<li>A hybrid method where sounds are loaded onto the timeline but are then manipulated with a Sound object.</li>
</ol>
<p>In 90% of cases, my game uses the second method. In the other 10%, I used the third. I have a simple flag (stored at _global.audio) that is set to true if people want sound playing and false otherwise. Any of my sound handling code monitors changes in the flag and sets volume on the appropriate sound objects accordingly. Nothing too fancy.</p>
<p>However, we&#8217;ve found an interesting fringe case when trying to control timeline sounds via actionscript. To duplicate the problem:</p>
<ul>
<li>Take one stage with a 2 frame timeline and one movie clip.</li>
<li>On the movie clip, load a sound onto the timeline.</li>
<li>Put the clip onto frame 2 of the stage, leaving frame 1 empty.</li>
<li>Put a stop() action on the second frame of the main timeline.</li>
</ul>
<p>This works as intended &#8211; ie, the sound plays exctly once.</p>
<ul>
<li>Now, add some code to the movie clip&#8217;s timeline to control the volume:
<pre class="brush: as3;">
var snd:Sound = new Sound(this);
snd.setVolume( 0 );
</pre>
</li>
</ul>
<p>This also works as intended &#8211; ie, the sound does not play at all.</p>
<ul>
<li>Replace the stop() action on the main timeline with a gotoAndStop(1) call.</li>
</ul>
<p>Now if you play the swf&#8230; the sound will happen&#8230; even though we&#8217;re explicitly telling it not to &#8211; and you&#8217;re jumping to a state where the movie clip containing the sound should not be loaded.</p>
<p>I suspect that what is happening is that when you leave the portion of the timeline where the Sound object exists, there is a bit of confusion in the VM. In stead of discarding the movie clip in its entirety as makes sense, it&#8217;s discarding the sound object first. The timeline then continues playing the audio where it left off (after being muted for only one frame).</p>
<p>So&#8230; if you want reliable control over your audio assets, the solution might then be to put your Sound object responsible for playing them in a location where it won&#8217;t be destroyed when the timeline updates. Unfortunately, that doesn&#8217;t seem to work either. I&#8217;ve tried locating my Sound object in _global or _root, but that doesn&#8217;t solve the problem either.</p>
<p>What appears to happen is that sounds on the timeline are attached to the stage when their individual timelines disappear. Telling my Sound object to listen to the stage in stead of to the movie clip works.</p>
<p>I&#8217;m investigating this more&#8230; maybe&#8230; but shrug. More likely, I will simply find a way to stop using sounds on the timeline at all in this one problem spot in the game. <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2006/12/12/flash-audio-timeline-confusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>no groups file?</title>
		<link>http://ammonlauritzen.com/blog/2006/11/20/no-groups-file/</link>
		<comments>http://ammonlauritzen.com/blog/2006/11/20/no-groups-file/#comments</comments>
		<pubDate>Mon, 20 Nov 2006 20:23:49 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/2006/11/20/no-groups-file/</guid>
		<description><![CDATA[Ok. I just finished upgrading a web server from Apache 2.0 to 2.2. I&#8217;ve been running 2.2 on other machines for months now and have never had a problem with the upgrade process until today.
I have a Trac install on the server that&#8217;s protected with generic http auth:

AuthType basic
AuthName &#34;Repository Name&#34;
AuthUserFile &#34;/dir/to/htpasswd&#34;
Require valid-user

This sort of [...]]]></description>
			<content:encoded><![CDATA[<p>Ok. I just finished upgrading a web server from <a href='http://httpd.apache.org/docs/2.2/new_features_2_2.html'>Apache 2.0 to 2.2</a>. I&#8217;ve been running 2.2 on other machines for months now and have never had a problem with the upgrade process until today.</p>
<p>I have a <a href='http://trac.edgewall.org/'>Trac</a> install on the server that&#8217;s protected with generic http auth:</p>
<pre class="brush: plain;">
AuthType basic
AuthName &quot;Repository Name&quot;
AuthUserFile &quot;/dir/to/htpasswd&quot;
Require valid-user
</pre>
<p>This sort of config has worked for forever. It worked fine under 2.0. It works fine under 2.2. This is not the problem.</p>
<p>When they changed the version number to 2.2 they renamed a whole bunch of the auth modules. They also split a bunch of the behaviors out into multiple separate modules.</p>
<p>So, in order to get the behavior I got by including just mod_auth, I now had to include several different mods. No problem there. The docs tell you this. No problem there.</p>
<p>Thus, my config got a section that looked like this:</p>
<pre class="brush: plain;">
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_host_module modules/mod_authz_host.so
</pre>
<p>Mod_auth_basic for the fundamental behaviors. Mod_authn_file to allow me to read from an htpasswd file. Mod_authz_host because they renamed mod_access (the &#8220;allow from xxx.yyy.zzz.com&#8221; type directives).</p>
<p>That got apache loading and understanding all of my config file. Then I tried to go to the trac install and blam. 500 internal nastiness error of kabloomitude.</p>
<p>Apache log file said:</p>
<pre class="brush: plain;">
[Mon Nov 20 11:47:12 2006] [crit] [client my.ip.address] configuration error:  couldn't check access.  No groups file?: /projects, referer: http://hostname/
</pre>
<p>Yeah. I was pretty sure I never mentioned anything about auth groups. Checking the entire config file proved me right. 30 minutes of quality time with Google proved entirely unhelpful. Just a bunch of cries for help that were either unanswered or eventually resolved for reasons unrelated to my problem.</p>
<p>I did discover that including <b>mod_authn_default</b> at least prevents the 500&#8217;s &#8211; just turning them into auth denied errors.</p>
<p><i>Turns out in my case that in order to actually auth against usernames you must include <b>mod_authz_user</b> now.</i> This wasn&#8217;t mentioned in any of the docs I dug through.</p>
<p>So what was happening?</p>
<p>The &#8220;no groups file?&#8221; error message provided is erroneous. It&#8217;s generated as part of some fallthrough code in Apache itself that happens when no existing auth mechanism is able to assume responsibility.</p>
<p>It requested the password and then had nothing to do with it &#8211; it didn&#8217;t know how to &#8220;Require valid-user&#8221; or something so it just bombed through, hoping another mod would answer&#8230; which of course didn&#8217;t happen since I didn&#8217;t specify a second authentication method for these url&#8217;s.</p>
<p>Moral of the story?</p>
<p>Starting from scratch with Apache config files is painful. Avoid it if possible. If upgrading versions, grab the default config file and merge your changes into it in stead of dropping your file in place and hoping it works as is.</p>
<p>I would have done this but I was working on a Windows server (yeah, I know, but some people in the .NET group are scared of progress &#8211; more on this particular saga later) and the windows apache installer doesn&#8217;t apparently generate a default config file if it detects one already in place. On unix, I always compile critical server applications by hand, so I always have the defaults to work from.</p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2006/11/20/no-groups-file/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>xpath</title>
		<link>http://ammonlauritzen.com/blog/2006/05/09/xpath/</link>
		<comments>http://ammonlauritzen.com/blog/2006/05/09/xpath/#comments</comments>
		<pubDate>Tue, 09 May 2006 19:50:51 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[as2]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[xpath]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Yargh!
I&#8217;m currently involved in some very heavy manipulation of XML data in a Flash application. For such purposes, I am compelled to use XPath. It&#8217;s a decent enough language. Ok, I lied. It&#8217;s good. Saves mounds of time that would otherwise be spent iterating over xml tree structures and searching for elements.
When using XPath in [...]]]></description>
			<content:encoded><![CDATA[<p>Yargh!</p>
<p>I&#8217;m currently involved in some very heavy manipulation of XML data in a Flash application. For such purposes, I am compelled to use <a href='http://www.w3.org/TR/xpath'>XPath</a>. It&#8217;s a decent enough language. Ok, I lied. It&#8217;s good. Saves mounds of time that would otherwise be spent iterating over xml tree structures and searching for elements.</p>
<p>When using XPath in Flash, one has two options. First, <strike>Macromedia</strike> Adobe has a first party implementation. Apparently it&#8217;s not that wonderful and nobody who knows better uses it. Second, there&#8217;s the <a href='http://www.xfactorstudio.com/'>XFactor Studio</a> API. This is what I use. It&#8217;s what a lot of people use. It is nice. It has never failed me before.</p>
<p>Until today.</p>
<p>I have a very simple favor to ask of the library. I want to select all of a node&#8217;s siblings. Now, granted, I am doing some searching to determine which node&#8217;s siblings I need here, but it&#8217;s really basic.</p>
<p>The XML doc I&#8217;m working with looks something like this:</p>
<pre class="brush: xml;">
&lt;configurator&gt;
    &lt;group&gt;
        &lt;products&gt;
            &lt;p&gt;1&lt;/p&gt;
            &lt;p&gt;2&lt;/p&gt;
        &lt;/products&gt;
        &lt;choice id=&quot;a&quot;/&gt;
        &lt;choice id=&quot;b&quot;/&gt;
    &lt;/group&gt;
    &lt;group&gt;
        &lt;products&gt;
            &lt;p&gt;3&lt;/p&gt;
        &lt;/products&gt;
        &lt;choice id=&quot;c&quot;/&gt;
        &lt;choice id=&quot;d&quot;/&gt;
    &lt;/group&gt;
&lt;/configurator&gt;
</pre>
<p>What I want is all &lt;choice&gt;&#8217;s in the same &lt;group&gt; as a &lt;product&gt; with a given &lt;p&gt;. Sound simple enough? Well, it is. The XPath statement to do this might look something like this:</p>
<blockquote><p>
<b><code>//group[products/p='3']/choice</code></b><br />
or<br />
<b><code>//group/choice[../products/p='3']</code></b>
</p></blockquote>
<p>Both search paths are equally valid and return the same results when I try them out on <a href='http://www.activsoftware.com/xml/xpath/xpath.cfm'>other xpath implementations</a>.</p>
<p>The XFactor version returns nothing. I know the lib works, and I know I&#8217;m using it correctly since my program continues to function up to this point (and I&#8217;m making 4 or 5 selections before this point).</p>
<p>So, I&#8217;m mildly peeved here. I&#8217;ve tried breaking it up into a pair of sequential queries (first select the appropriate group, then select the choices within that group), but that doesn&#8217;t do anything either.</p>
<p>So far, this problem has cost me 2 hours this morning and it doesn&#8217;t look to be clearing up any time soon. Sigh.</p>
<h3>update</h3>
<p>After another hour, I have determined that the XFactor XPath implementation is broken when it comes to searching based on text node values. Chris (coworker) swears up and down that it isn&#8217;t broken, so he&#8217;s trying to prove me wrong now <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>In the mean time, I have implemented an ugly brute-force solution to the problem. So, in stead of:</p>
<pre class="brush: as3;">
var path:String = &quot;//group/choice[../products/p='&quot;+pid+&quot;']&quot;;
var list:Array = XPath.selectNodes( configurator.firstChild, path );
</pre>
<p>I have had to settle for something like this:</p>
<pre class="brush: as3;">
// grab all products
var path:String = &quot;//group/products&quot;;
var pNodes:Array = XPath.selectNodes( configurator.firstChild, path );
var gNode:XMLNode = null;

// iterate over products until we find the one we want, YICK
for( var k = 0; k &amp;lt; pNodes.length; k++ ) {
	// look at all &amp;lt;p&amp;gt; children
	var tmp:Array = pNodes[k].childNodes;
	for( var j = 0; j &amp;lt; tmp.length; j++ ) {
		if( tmp[j].firstChild.nodeValue == pid ) {
			// parent.parent <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />
			gNode = tmp[j].parentNode.parentNode;
			break;
		}
	}
	if( gNode != null ) break;
}

// grab the appropriate wad of choices, finally
var list:Array = XPath.selectNodes( gNode, &quot;//choice&quot; );
</pre>
<h3>update</h3>
<p>After about 20 minutes of headscratching, Chris seems to have given up as well <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Interestingly enough&#8230; the first party api doesn&#8217;t do it either:</p>
<pre class="brush: as3;">
var path:String = &quot;//group/choice[../products/p='&quot;+pid+&quot;']&quot;;
var list:Array = mx.xpath.XPathAPI.selectNodeList( configurator.firstChild, path );
</pre>
<p>So&#8230; I&#8217;m very curious if anybody actually does these kinds of searches in Flash? They&#8217;re valid according to the W3C spec and they work in Java&#8230; for a language like Flash (which is currently handcuffed to XML as its only reasonable means of communication with the outside world) to have a broken XPath implementation is&#8230; not good. Sigh.</p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2006/05/09/xpath/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>hot router blues</title>
		<link>http://ammonlauritzen.com/blog/2006/01/24/hot_router_blues/</link>
		<comments>http://ammonlauritzen.com/blog/2006/01/24/hot_router_blues/#comments</comments>
		<pubDate>Wed, 25 Jan 2006 04:25:46 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[personal]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[wifi]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I&#8217;m not quite sure when it began, but this problem has been plaguing us for months now. My home network seems to have acquired a sudden and violent allergy to downloading torrents of all shapes and sizes.
We have a total of four computers currently on the network, and in regular use. Of them, Rincewind (the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not quite sure when it began, but this problem has been plaguing us for months now. My home network seems to have acquired a sudden and violent allergy to downloading <a href='http://www.bittorrent.com/FAQ.html'>torrents</a> of all shapes and sizes.</p>
<p>We have a total of four computers currently on the network, and in regular use. Of them, <a href='http://en.wikipedia.org/wiki/Rincewind'>Rincewind</a> (the old server turned secondary windows desktop) and <a href='http://en.wikipedia.org/wiki/Samuel_Vimes'>Vimes</a> (&#8220;my&#8221; laptop that Penny monopolizes) generally shun the torrents, letting <a href='http://en.wikipedia.org/wiki/Hedwig_%28Harry_Potter%29'>Hedwig</a> (linux server) and <a href='http://en.wikipedia.org/wiki/By_the_Sword'>Tarma</a> (windows <a href='http://www.microsoft.com/windowsxp/mediacenter/default.mspx'>media center</a> type bedroom computer) handle all the dirty work. Which is fine by them, since they&#8217;re the machines with the big processors, big ram, and big hard drives (though Rincewind does have a gig of ram and 300gb drive of his own now, shrug).</p>
<p>Traditionally, I have <u>always</u> preferred the command line python scripts to bulky gui applications. So&#8230; Hedwig has had a long and only slightly besmirched career as our primary download and redistrobution center.</p>
<p>When Hedwig moved home from the office after I quit my last job, I expected some slowdown &#8211; after all, we only have a 5 mbit downstream and 512 kbit upstream. The results of my first batch of downloads led me to believe that the torrent itself was somehow bugged &#8211; they were all healthy files with 10 or more seeds and 100 or more general users, yet even after a few hours running, I couldn&#8217;t manage to eke out more than 5kbps per torrent.</p>
<p>I let this slide for a while in the face of a new problem. One particular studio whose shows I was interested in watching was having problems with their single-episode torrents and recommended people to just use the batch torrents in stead. This is usually fine by me, but in this case, the batches were 25 episodes huge (~4.5gb) and I only needed one file out of the mix.</p>
<p>So, I hunted around for a client that would allow me to selectively download individual files from batch torrents, and was pleased to find <a href='http://www.bitcomet.com/'>BitComet</a>. I installed it on Tarma and fired it up.</p>
<p>Instantly, I noticed a huge difference. BitComet was actually able to utilize my bandwidth and get me transfers at the rates my connection would actually support. It was great. But, I was still running the mud from home and didn&#8217;t want to lock out players, so I throttled things way back &#8211; leaving plenty of bandwidth open for no less than 10 users to do their bidding w/o any problems.</p>
<p>Yet&#8230; even with a dedicated portion of the pipe, users suddenly began to complain about inability to log in to the game. Once an active socket was opened, there were no problems, but people were generally incapable of opening said sockets&#8230;</p>
<p>About the same time, Penny started complaining from the couch that the laptop was having problems browsing web pages. I noticed that I too began to have problems opening up outgoing connections from any of our machines. I throttled the torrents waay back &#8211; leaving 3/4 of our bandwidth unused. And still, the problem did not go away.</p>
<p>I quit BitComet. The problem did not go away. I rebooted Tarma. No such luck there either.</p>
<p>Finally, I gave our router a violent kick to the head and rebooted it forcibly. The network was immediately cleansed and back to normal.</p>
<p>This problem has repeated itself numerous times since that first event. It became so reliable &#8211; if I so much as looked at BitComet, my network would sieze up &#8211; that I stopped downloading files all together until the mud had left the building. And then, I got into the habit of stopping torrents during the day so I could work, and then turning them back on when I went to sleep. I had assumed that BitComet was somehow opening up so many connections that it managed to exhaust the router&#8217;s capacity to handle them all.</p>
<p>Until today. <i>[Cue dramatic music and lighting]</i></p>
<p>The answer (I hope) to all of my woes and problems finally hit me. BitComet was not leaving stale connections around. It has been overheating the router. See&#8230; they&#8217;re both fairly new (&lt;1 year old) Linksys models, and this particular line of networking hardware is designed to stack together, so the router was sitting directly on top of the modem.</p>
<p>I figure the high number of different sockets created when added to the high amount of wan communication <b>and</b> the fact that Tarma is connected to the network via encrypted wifi (high amounts of radio energy plus extra computational power spent on every packet to maintain security) probably generated more heat than anything else I&#8217;ve done to this network.</p>
<p>Since, previously, my high traffic transactions had been mostly one-way communication (sending a file between two machines) and my torrents had been on Hedwig (who is plugged into the network via good old fashioned cat6 twisted pair)&#8230; yeah.</p>
<p>When I checked on my torrents this morning (<a href='http://www.mahou.org/Projects/Aquarion/'>Sousei no Aquarion</a> for Penny), I noticed that they were acting unusually sluggish. Like really really slow. So, since I needed to get onto the web anyways to work on things, I went in to physically reboot the router. It was almost painfully hot to the touch. The modem underneath it was also practically a puddle of molten plastic.</p>
<p>I smacked myself in the head and proceeded to fashion a cardboard stand for the router from the packaging of some Atari computer game or another. There is now at least an inch of airflow between the two devices and I&#8217;ve had torrents running all day w/o interrupting my work.</p>
<p>I can even post rants on here and stuff <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2006/01/24/hot_router_blues/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
