<?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>complich8's journal &#187; Beyond Nerddom</title>
	<atom:link href="http://www.complich8.net/archives/category/beyond-nerddom/feed" rel="self" type="application/rss+xml" />
	<link>http://www.complich8.net</link>
	<description>complacence is the enemy</description>
	<lastBuildDate>Thu, 22 Jul 2010 08:28:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>radio streams for an alarm clock function</title>
		<link>http://www.complich8.net/archives/405</link>
		<comments>http://www.complich8.net/archives/405#comments</comments>
		<pubDate>Mon, 24 Mar 2008 04:48:22 +0000</pubDate>
		<dc:creator>complich8</dc:creator>
				<category><![CDATA[Beyond Nerddom]]></category>
		<category><![CDATA[life and times]]></category>

		<guid isPermaLink="false">http://www.complich8.net/archives/405</guid>
		<description><![CDATA[So a long time ago, I realized that I wake up better with music helping me along. But the last year or so I&#8217;ve been using my cell phone as an alarm clock (&#8217;cause it&#8217;s always on a charged battery and has good clock synch). Yesterday I tried the music thing again, using an at-job [...]]]></description>
			<content:encoded><![CDATA[<p>So a long time ago, I realized that I wake up better with music helping me along.  But the last year or so I&#8217;ve been using my cell phone as an alarm clock (&#8217;cause it&#8217;s always on a charged battery and has good clock synch).</p>
<p>Yesterday I tried the music thing again, using an at-job ( at(1p) in the man pages) and mpg123, and it worked great.  But pre-selecting a track is sorta lame, so I thought &#8220;maybe I can do a shuffle thing, using my old radio scripts&#8221; &#8212; until I realized that that&#8217;d require both work and more metadata-parsing, which I don&#8217;t feel like doing &#8217;cause I need to wake up in 7 hours.  So I thought &#8220;radio stream!&#8221;</p>
<p>So I grabbed a PLS from one of the most salient radio stations I could think of, and tossed mpg123 at it.  Of course, it didn&#8217;t work.  So I tried tossing the stream url itself at it, and it didn&#8217;t work because the stream&#8217;s aac+.  Bleh.</p>
<p>Then I tried mplayer &#8230; &#8217;cause mplayer&#8217;s natively command-line.  And it worked from the console, so I thought things would be good.  Then I put it in a test at-job, and it didn&#8217;t fire off, because while mplayer&#8217;s natively a console app it&#8217;s also natively interactive.  So that was out, unless I launched it in screen&#8230; but that would just get complicated.</p>
<p>Then I remembered.  mpg123 is a very unixy tool (as opposed to linuxy).  So I built mpg321, and tried with that.  SUCCESS!</p>
<p>So there you have it: if you want to listen to radio streams from at-jobs, remember mpg321!</p>
<p>And in 7 hours and 5 minutes, my at job will go off after an initial alarm clock ring, and I&#8217;ll drag myself up and go fight traffic down to my new job!  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.complich8.net/archives/405/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>mpm-worker versus mpm-prefork, and mod_php versus fastcgi</title>
		<link>http://www.complich8.net/archives/404</link>
		<comments>http://www.complich8.net/archives/404#comments</comments>
		<pubDate>Sat, 22 Mar 2008 17:18:43 +0000</pubDate>
		<dc:creator>complich8</dc:creator>
				<category><![CDATA[Beyond Nerddom]]></category>
		<category><![CDATA[technobabble]]></category>

		<guid isPermaLink="false">http://www.complich8.net/archives/404</guid>
		<description><![CDATA[*Caution: nothing but geek-content here* So Apache 2.2 has a couple of &#8220;stable&#8221; mpm&#8217;s, namely prefork and worker. Prefork is the old tried-and-true method, where the server spawns $StartServers httpd processes, and on-demand starts additional up to $MaxClients. Each subprocess handles $MaxRequestsPerChild requests, then dies and is replaced as needed. Worker, on the other hand, [...]]]></description>
			<content:encoded><![CDATA[<div style="color: red;"><strong>*Caution: nothing but geek-content here*</strong></div>
<p>So Apache 2.2 has a couple of &#8220;stable&#8221; mpm&#8217;s, namely prefork and worker.  </p>
<p>Prefork is the old tried-and-true method, where the server spawns $StartServers httpd processes, and on-demand starts additional up to $MaxClients.  Each subprocess handles $MaxRequestsPerChild requests, then dies and is replaced as needed.  </p>
<p>Worker, on the other hand, starts $StartServers httpd processes, and on each process runs up to $ThreadsPerChild.  Each thread serves requests (the same as processes on prefork), and when any given process&#8217;s child threads hit $MaxRequestsPerChild, the process kills its idle threads, unpools its working threads and waits for them to finish, then dies.</p>
<p>Sounds cool, right?  Threads are lighter than processes, so having 5 processes running 20 threads each sounds better than having 100 processes.  I got caught up in that and decided to try it on a large-ish site (namely gotwoot, and the 20-odd other sites hosted on that box). </p>
<p>Well, it turns out Worker isn&#8217;t as stable as I was hoping.  At least for me&#8230; one of the sites we host is a huge sender of fairly large files and file streams.  When apache processes under mpm-worker try to die, they wait until all the threads are done sending&#8230; but if the children are sending for hours, it&#8217;s going to take hours for these otherwise-defunct processes to die.  If we were talking about just one process taking that long to die, it wouldn&#8217;t be a big deal because it wouldn&#8217;t interact with anything else.  But somehow in that interaction mode, various modules start behaving badly.</p>
<p>So I was running mod_php (only using threadsafe modules) on mpm-worker, and every couple of days I&#8217;d see random problems.  Sometimes it was zero-byte replies from php, other times it was php segfaulting, still other times it was apache itself dropping empty page replies.</p>
<p>I got sick of that, so I switched over to mpm-prefork and php on fastcgi.  Things seem to be better now&#8230; it gives me user-mode php, and because of that APC maintains a per-site cache.  It&#8217;s running fcgi processes on demand, which is also cool &#8217;cause if a site doesn&#8217;t get traffic, it doesn&#8217;t keep a running php process.</p>
<p>Overall, my system load is a bit lower and things just &#8220;<em>feel</em>&#8221; more stable with prefork+fcgi.  In the next couple days I should actually _see_ whether it&#8217;s more stable or not&#8230; but either way, I guess there&#8217;s value in feelings too :p.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.complich8.net/archives/404/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Fighting syn floods with iptables</title>
		<link>http://www.complich8.net/archives/402</link>
		<comments>http://www.complich8.net/archives/402#comments</comments>
		<pubDate>Sun, 09 Mar 2008 11:46:08 +0000</pubDate>
		<dc:creator>complich8</dc:creator>
				<category><![CDATA[Beyond Nerddom]]></category>
		<category><![CDATA[life and times]]></category>
		<category><![CDATA[technobabble]]></category>

		<guid isPermaLink="false">http://www.complich8.net/archives/402</guid>
		<description><![CDATA[The tracker I admin seems to be undergoing a bit of a syn flood, and the tcp_syncookies tools weren&#8217;t helping. My ip_conntrack table was filling at 65536 connections, and the tracker just wasn&#8217;t talking to anyone as a result. Lots of packets falling out, lots of full tables. Not sure if it&#8217;s intentional or if [...]]]></description>
			<content:encoded><![CDATA[<p>The tracker I admin seems to be undergoing a bit of a syn flood, and the tcp_syncookies tools weren&#8217;t helping.  My ip_conntrack table was filling at 65536 connections, and the tracker just wasn&#8217;t talking to anyone as a result.  Lots of packets falling out, lots of full tables.  Not sure if it&#8217;s intentional or if it&#8217;s just a bunch of clients behaving badly&#8230; big fan of Hanlon&#8217;s Razor there though&#8230;</p>
<p>Detection: looked in /proc/net/ip_conntrack.  Noticed that the connections listed were mostly SYN_SENT from some src, and &#8220;UNREPLIED&#8221; status.  Many source ip&#8217;s.  Verified that the tracker was functional (by temporarily firewalling off all inbound syn traffic to it except my own ip addy).  Saw lots of packets getting dropped.</p>
<p>Mitigation attempt 1: tuned /proc/sys/net/ip_conntrack_max and /proc/sys/net/ipv4/netfilter/{many settings} in /etc/sysctl.conf, turning up maxes and turning down timeouts.  This should more aggressively expire lost tcp connections.  Also added a rule: <code>iptables -t raw -A OUTPUT -p tcp --sport $TRACKER_PORT -j NOTRACK</code> in an attempt to further lower the conntrack burden.  Result: I no longer kept getting as many conntrack &#8220;table full&#8221; errors, but the tracker was still not talking to anyone.</p>
<p>Mitigation attempt 2: added two more firewall rules:<br />
<code>iptables -I INPUT 1 -p tcp --dport $TRACKER_PORT --syn -m hashlimit --hashlimit 10/min --hashlimit-burst 15 --hashlimit-name torrenthash --hashlimit-htable-size 2048 --hashlimit-htable-max 65536 --hashlimit-mode srcip -j ACCEPT</code><br />
followed by<br />
<code>iptables -I INPUT 2 -p tcp --dport $TRACKER_PORT --syn -j DROP</code>.<br />
Result: the tracker appears to be talking again &#8230; I can see the web interface on it, and get peers on torrents hosted there without the help of DHT.  It&#8217;s good times.</p>
<p>I imagine this technique could be used for quite a bit more than just protecting a tracker, so I suppose it&#8217;d be great to have it written down somewhere <img src='http://www.complich8.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.complich8.net/archives/402/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox X-forwarding weirdness&#8230;</title>
		<link>http://www.complich8.net/archives/388</link>
		<comments>http://www.complich8.net/archives/388#comments</comments>
		<pubDate>Fri, 28 Dec 2007 20:19:34 +0000</pubDate>
		<dc:creator>complich8</dc:creator>
				<category><![CDATA[Beyond Nerddom]]></category>
		<category><![CDATA[technobabble]]></category>

		<guid isPermaLink="false">http://www.complich8.net/archives/388</guid>
		<description><![CDATA[Ok, so check it out. This is like &#8230; the single strangest thing I&#8217;ve run into in the wide world of linux. So, you start a local firefox session, then ssh to a machine with a -X (enabling x11 forwarding). Then on the remote machine, you run firefox. You get &#8230; another locally-running firefox. So [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so check it out.  This is like &#8230; the single strangest thing I&#8217;ve run into in the wide world of linux.</p>
<p>So, you start a local firefox session, then ssh to a machine with a -X (enabling x11 forwarding).  Then on the remote machine, you run firefox.  You get &#8230; another locally-running firefox.</p>
<p>So you close both locally-running firefox sessions (and any others you might have) and invoke firefox on the remote machine.  Now you get an X11-forwarded firefox running on the remote box (the expected behavior).  And then you run firefox on the local machine, and you get &#8230;. another remotely-running firefox window.</p>
<p>Apparently, Xorg doesn&#8217;t differentiate between remotely-running windows and locally-running ones, and firefox catches any requests for a new X window named firefox, and instead of letting another copy be run, just makes a new window on the same firefox instance.</p>
<p>A little googling shows that the environment variable MOZ_NO_REMOTE controls this behavior &#8212; set it to 1 and firefox doesn&#8217;t lurk under the surface intercepting other instances that try to run.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.complich8.net/archives/388/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>distro blues</title>
		<link>http://www.complich8.net/archives/385</link>
		<comments>http://www.complich8.net/archives/385#comments</comments>
		<pubDate>Thu, 29 Nov 2007 03:48:27 +0000</pubDate>
		<dc:creator>complich8</dc:creator>
				<category><![CDATA[Beyond Nerddom]]></category>
		<category><![CDATA[life and times]]></category>
		<category><![CDATA[technobabble]]></category>

		<guid isPermaLink="false">http://www.complich8.net/archives/385</guid>
		<description><![CDATA[Ahh, the geekery. I wonder how many people this has happened to&#8230; So basically, for the last couple years I lived almost exclusively in gentoo for all my linux needs. Sounds good, right? A single distro, albeit a source-based one. I got used to a lot of gentoo-isms. I had my hands in RHEL a [...]]]></description>
			<content:encoded><![CDATA[<p>Ahh, the geekery.  I wonder how many people this has happened to&#8230;</p>
<p>So basically, for the last couple years I lived almost exclusively in gentoo for all my linux needs.  Sounds good, right?  A single distro, albeit a source-based one.  I got used to a lot of gentoo-isms.  I had my hands in RHEL a bit, I poked a bsd or two a bit, but gentoo was definitely my area of expertise, and my home.</p>
<p>Now I&#8217;m not so sure.</p>
<p>See, at work, I run an ubuntu box for my desktop.  I&#8217;m the only one there on ubuntu, so I&#8217;m kinda the odd-man out in that regard (the other sysadmins are on fedora).  We&#8217;ve also got servers that are fedora, so it&#8217;d make sense to be there&#8230; but <em>no~oo</em>, I <em>had</em> to install ubuntu instead.</p>
<p>Regardless, the majority of the server functions at work are solaris boxes.  So I&#8217;m simultaneously getting more comfortable with Ubuntu, getting more comfortable with Fedora, and learning a shitlot about Solaris.</p>
<p>Which is confusing.</p>
<p>See, Gentoo&#8217;s got /etc/conf.d.  Everything that&#8217;s distro-specific is controlled out of there.  Things like &#8230; default behaviors, network configs, what xdm tool should be called (eg: gdm, kdm, xdm), what options to pass iptables and where to save it, what options to pass in init scripts, etc.  It gives a lot of flexibility in a single place, and it&#8217;s very clean.</p>
<p>But nobody else does that.  At all.  </p>
<p>Ubuntu&#8217;s got it&#8217;s configs strewn all over /etc.  Fedora and RHEL shove a lot of, but not all of, their stuff in /etc/sysconfig.  Solaris &#8230; hell, I still don&#8217;t have any idea for half of that stuff &#8230; if it&#8217;s not in SMF, it&#8217;s probably somewhere in /etc, or maybe /var/sadm, or possibly in some random db2 file or something.</p>
<p>But it gets worse.  Mainly because of package managers.  I am finding myself typing &#8220;aptitude search&#8221; when I want to find a package on fedora or gentoo, and typing &#8220;eix&#8221; when I want to find things in ubuntu.  I have to remind myself &#8220;oh wait, this is ${DISTRO}, not ${OTHERDISTRO}&#8221; all the time.  This is only exacerbated by the fact that I&#8217;ve been building a new fileserver at home, and out of my distros of choice (ubuntu and gentoo), only gentoo&#8217;s install cd worked cleanly on the new hardware.  On the bright side, at least solaris doesn&#8217;t have a sane auto-updating package manager to work with at all, so there&#8217;s one less thing to think about.</p>
<p>So yeah, that&#8217;s my life these days :p</p>
]]></content:encoded>
			<wfw:commentRss>http://www.complich8.net/archives/385/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
