<?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>Nicolás Brailovsky &#187; Grumpy</title>
	<atom:link href="http://nicolasb.com.ar/category/grumpy/feed/" rel="self" type="application/rss+xml" />
	<link>http://nicolasb.com.ar</link>
	<description>A modern blog</description>
	<lastBuildDate>Tue, 20 Dec 2011 09:00:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Dell and Ubuntu CPU Scaling</title>
		<link>http://nicolasb.com.ar/2011/10/dell-and-ubuntu-cpu-scaling/</link>
		<comments>http://nicolasb.com.ar/2011/10/dell-and-ubuntu-cpu-scaling/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 10:00:37 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Grumpy]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=933</guid>
		<description><![CDATA[Hi, my name is Nicolás Brailovsky and you may remember me from movies like fixing keyboard problems in Ubuntu JJ, removing the annoying terminal warning, random complaints about dual screen in Buguntu and Ubuntu: sound still fubard. This time, I would like to add a new Ubuntu problem to the list of things which make [...]]]></description>
			<content:encoded><![CDATA[<table>
<tbody>
<tr>
<td><a href="http://nicolasb.com.ar/archivos/2010/08/troy.png"><img class="aligncenter size-full wp-image-1135" title="troy" src="http://nicolasb.com.ar/archivos/2010/08/troy.png" alt="" width="133" height="100" /></a></td>
<td>Hi, my name is Nicolás Brailovsky and you may remember me from movies like <a href="http://nicolasb.com.ar/2009/05/fixing-keyboard-problems-in-ubuntu-jj/">fixing keyboard problems in Ubuntu JJ</a>, <a href="http://nicolasb.com.ar/2009/08/ubuntu-annoying-terminal-warning/">removing the annoying terminal warning</a>, <a href="http://nicolasb.com.ar/2010/04/ubuntu-dual-screen-still-fubard/">random complaints about dual screen in Buguntu</a> and <a href="http://nicolasb.com.ar/2010/05/ubuntu-sound-still-fubard/">Ubuntu: sound still fubard</a>. This time, I would like to add a new Ubuntu problem to the list of things which make me want to jump off a cliff, though I must warn you that this is a very old article that got forgotten on the stack of posts to review, so it might be dated. Being an old post means that this problem may be fixed by now, but since I don&#8217;t have a Dell laptop anymore I cannot try it. Anyway, I&#8217;ll post it as a reference to anyone who may experience something similar.</td>
</tr>
</tbody>
</table>
<p>To be completely fair, this is a dual fuckup between Dell and Ubuntu: after an upgrade I started noticing that sometimes the CPU slows to a crawl, for no apparent reason. The only fix for this is a complete shutdown, as not even a reboot would make this problem go away. WTF?</p>
<p>A lot of time after I had given up on trying to solve this problem and decided that submitting to the gods seemingly random will was the best option, a coworker told me what this was about: apparently when you have a 3D GUI (say, a screensaver) and a double monitor the graphics card has to &#8220;work too much&#8221;, drawing too much power. When the power consumption reaches 90 watts, the power supply&#8217;s limit, the CPU enables something called CPU scaling, bringing the CPU clock speed to about the speed of a wristwatch. (No, really: &#8220;Even setting aside the negative performance effect of FSB downshifting in II above, the effective processing power is reduced to 1/8 of 798 Mhz = 100 MHz. This is a reduction to less than 5% of full capacity, from http://www.sigmirror.com/files/44490_iweoz/throttlegate.pdf).</p>
<p>Solution? None, thanks. Just shut it down and reboot.</p>
<p><a href="http://nicolasb.com.ar/archivos/2010/08/how_to_reboot_01.jpg"><img class="aligncenter size-medium wp-image-1136" title="how_to_reboot_01" src="http://nicolasb.com.ar/archivos/2010/08/how_to_reboot_01-300x219.jpg" alt="" width="300" height="219" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2011/10/dell-and-ubuntu-cpu-scaling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open Office, master documents and headless</title>
		<link>http://nicolasb.com.ar/2011/10/open-office-master-documents-and-headless/</link>
		<comments>http://nicolasb.com.ar/2011/10/open-office-master-documents-and-headless/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 10:00:14 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Grumpy]]></category>
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=1019</guid>
		<description><![CDATA[I have been writing some documentation lately (crazy, I know) and needed due to some bizarre business requirements all the documentation for the application was supposed to be in a single .doc file. That&#8217;s write, a single file for user manual, technical manual, administration manual and so on. And I had no LaTeX either (damn [...]]]></description>
			<content:encoded><![CDATA[<table>
<tbody>
<tr>
<td>I have been writing some documentation lately (crazy, I know) and needed due to some bizarre business requirements all the documentation for the application was supposed to be in a single .doc file. That&#8217;s write, a single file for user manual, technical manual, administration manual and so on. And I had no LaTeX either (damn those MS Office files, I hate them) so using multiple tex files and including them together wasn&#8217;t an option.</td>
<td><a href="http://nicolasb.com.ar/archivos/2010/08/headless.jpg"><img class="aligncenter size-medium wp-image-1115" title="headless" src="http://nicolasb.com.ar/archivos/2010/08/headless-225x300.jpg" alt="" width="225" height="300" /></a></td>
</tr>
</tbody>
</table>
<p>Choosing the least of all evils, I decided to use Open Office and master documents. With them you can create several different .doc files and then join them together in a single .odm file, which can then be exported to pdf (or .doc, if your boss says so). It&#8217;s a nice feature, but for such a simple thing as having multiple documents #included in a single one you would expect it to work better. From OO manual:</p>
<blockquote><p>Yes, master documents do work in OOoWriter. However, their use is full of traps for inexperienced users[...]</p></blockquote>
<p>Oh, thanks a lot OO.org (?). BTW, exporting an odm to pdf with a headless set == FAIL (i.e. don&#8217;t even try to use this if you intend to <a href="http://nicolasb.com.ar/2011/09/automagic-document-conversion-for-your-makefiles">autogenerate some documentation with your makefile</a>).</p>
<p><a href="http://nicolasb.com.ar/archivos/2009/10/grumpy-old-man.jpg"><img class="aligncenter size-medium wp-image-605" title="grumpy old man" src="http://nicolasb.com.ar/archivos/2009/10/grumpy-old-man-300x300.jpg" alt="" width="300" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2011/10/open-office-master-documents-and-headless/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I thought we had deprecated regedit</title>
		<link>http://nicolasb.com.ar/2011/02/i-thought-we-had-deprecated-regedit/</link>
		<comments>http://nicolasb.com.ar/2011/02/i-thought-we-had-deprecated-regedit/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 10:00:24 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Gnome]]></category>
		<category><![CDATA[Grumpy]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=980</guid>
		<description><![CDATA[Guys, I thought we had already agreed on this a long time ago. Windows registry sucks. It&#8217;s a pain in the ass. Why TF is regedit still used in Gnome? I&#8217;d switch to KDE, if only I wasn&#8217;t so lazy.]]></description>
			<content:encoded><![CDATA[<p>Guys, I thought we had already agreed on this <a href="http://www.codinghorror.com/blog/2007/08/was-the-windows-registry-a-good-idea.html">a long time ago</a>. Windows registry sucks. It&#8217;s a pain in the ass.</p>
<p>Why TF is <a href="https://help.ubuntu.com/community/RestoreNautilusLocationBar">regedit</a> still used in Gnome? I&#8217;d switch to KDE, if only I wasn&#8217;t so lazy.</p>
<p><a href="http://nicolasb.com.ar/archivos/2009/10/grumpy-old-man.jpg"><img class="aligncenter size-medium wp-image-605" title="grumpy old man" src="http://nicolasb.com.ar/archivos/2009/10/grumpy-old-man-300x300.jpg" alt="" width="300" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2011/02/i-thought-we-had-deprecated-regedit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>To log or not to log</title>
		<link>http://nicolasb.com.ar/2010/09/to-log-or-not-to-log/</link>
		<comments>http://nicolasb.com.ar/2010/09/to-log-or-not-to-log/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 10:00:30 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Grumpy]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=1109</guid>
		<description><![CDATA[Logging is nice, we all know that. It saves you from having to stay up all night checking when and why your applications fails. It servers to blame the support guys for not reading it. It&#8217;s useful to stress test your RAID. But logging where you shouldn&#8217;t is a pain in the ass waiting to [...]]]></description>
			<content:encoded><![CDATA[<p>Logging is nice, we all know that. It saves you from having to stay up all night checking when and why your applications fails. It servers to blame the support guys for not reading it. It&#8217;s useful to stress test your RAID.</p>
<p><a href="http://nicolasb.com.ar/archivos/2010/06/origami_log.jpg"><img class="aligncenter size-medium wp-image-1106" title="origami_log" src="http://nicolasb.com.ar/archivos/2010/06/origami_log-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>But logging where you shouldn&#8217;t is a pain in the ass waiting to happen.</p>
<p>When designing an application you should choose between domain level objects, wiring objects, library level objects, helper objects, etc. Your logging should be mostly in the wiring of your applications, not in the helper objects and very rarely in the domain level objects. These objects, when well designed, are supposed to be tested and to be run in a production environment with many different loggers. If you log in the middle of your business object you may end up writing logs through cout when you&#8217;re testing, or worse, when you&#8217;re supposed to be logging in syslog.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2010/09/to-log-or-not-to-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ Namespaces and g++</title>
		<link>http://nicolasb.com.ar/2010/08/c-namespaces-and-g/</link>
		<comments>http://nicolasb.com.ar/2010/08/c-namespaces-and-g/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 12:48:32 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Grumpy]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=699</guid>
		<description><![CDATA[Have you ever tried to leave open a C++ namespace after EOF (that is, openning a namespace in a headerfile but forgetting to close it). It&#8217;s a little bit like getting your balls caught by the door. The compiler will throw at you an incredible number of seemingly unrelated errors, all of which occur in [...]]]></description>
			<content:encoded><![CDATA[<table>
<tbody>
<tr>
<td>Have you ever tried to leave open a C++ namespace after EOF (that is, openning a namespace in a headerfile but forgetting to close it). It&#8217;s a little bit like getting your balls caught by the door. The compiler will throw at you an incredible number of seemingly unrelated errors, all of which occur in a different file than the offending header.</p>
<p>Reaching EOF on a C++ file without closing all its namespaces should be ilegal; or at least you should have better error reporting, because right now it&#8217;s almost impossible to know what&#8217;s the source of the error (for g++, that is).</td>
<td><a href="http://nicolasb.com.ar/archivos/2009/10/grumpy-old-man.jpg"><img class="aligncenter size-medium wp-image-605" title="grumpy old man" src="http://nicolasb.com.ar/archivos/2009/10/grumpy-old-man-300x300.jpg" alt="" width="300" height="300" /></a></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2010/08/c-namespaces-and-g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fuuuuuuuuuuuuuu (Opera)</title>
		<link>http://nicolasb.com.ar/2010/07/fuuuuuuuuuuuuuu-opera/</link>
		<comments>http://nicolasb.com.ar/2010/07/fuuuuuuuuuuuuuu-opera/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 15:24:43 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Grumpy]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=981</guid>
		<description><![CDATA[I hate ubuntu, but I hate windows the most. I hate firefox, but internet explorer makes me want to vomit. I don&#8217;t like gnome, but kde is uglier. But I love Opera. Well, loved it, I guess version 10.60 will be my last version. It&#8217;s been a loyal application which I&#8217;ve been using since its [...]]]></description>
			<content:encoded><![CDATA[<p>I hate ubuntu, but I hate windows the most. I hate firefox, but internet explorer makes me want to vomit. I don&#8217;t like gnome, but kde is uglier. But I love Opera. Well, loved it, I guess version 10.60 will be my last version.</p>
<p>It&#8217;s been a loyal application which I&#8217;ve been using since its 6.x version. Always fast, with all the functionality I needed (some more too) and none of the bloated BS needed to make FF be a usable (though ugly) browser. It had it&#8217;s ussual screw-ups, everyone does, but after I updated to version 10.60 it has become unusable.</p>
<p>Its new features include random crashe, making gmail work really slow (or not at all: the fucking scrollbar won&#8217;t work anymore, and keyboard shortcuts in google reader (j &amp; k, next &amp; prev) are foobar&#8217;d. Scrolling on a large webpage eats 100% cpu, the upgrade fucked up my nice dark theme (and changed it back to a hellish abomination which seems to be a time-traveller from 1998), and it has random stupid bugs. And I mean STUPID, like, double click a word and the popup menu won&#8217;t go away.<br />
<img src="http://www.monosinfinitos.com.ar/wp-content/uploads/2010/04/emo-parker-300x187.jpg" alt="" /><br />
<small>I tried to insert this image through WP image uploader, but it doesn&#8217;t work anymore in Opera</small><br />
Fuck. I always liked you Opera, but it seems it may be time to give chrome a chance.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2010/07/fuuuuuuuuuuuuuu-opera/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The truth about SNMP</title>
		<link>http://nicolasb.com.ar/2010/07/the-truth-about-snmp/</link>
		<comments>http://nicolasb.com.ar/2010/07/the-truth-about-snmp/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 12:50:06 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Grumpy]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=999</guid>
		<description><![CDATA[Seen @ http://wiki.wireshark.org/SNMP: After years thinking and reading RFCs and various other documents, today, I finally understood. &#8220;Simple&#8221; refers to &#8220;Network&#8221; not to &#8220;Management Protocol&#8221;! So it is a Management Protocol for Simple Networks not a Simple Protocol for Management of Networks&#8230; That explains why it&#8217;s called &#8220;Simple&#8221;. It was that Simple but it took [...]]]></description>
			<content:encoded><![CDATA[<p>Seen @ http://wiki.wireshark.org/SNMP:</p>
<blockquote><p>After years thinking and reading RFCs and various other documents, today, I finally understood. &#8220;Simple&#8221; refers to &#8220;Network&#8221; not to &#8220;Management Protocol&#8221;! So it is a Management Protocol for Simple Networks not a Simple Protocol for Management of Networks&#8230; That explains why it&#8217;s called &#8220;Simple&#8221;. It was that Simple but it took me years to understand it! &#8212; LuisOntanon</p></blockquote>
<p>Thank you Luis. That explains a lot.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2010/07/the-truth-about-snmp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Opera borks gmail</title>
		<link>http://nicolasb.com.ar/2010/07/opera-borks-gmail/</link>
		<comments>http://nicolasb.com.ar/2010/07/opera-borks-gmail/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 10:00:08 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Grumpy]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=930</guid>
		<description><![CDATA[Ubuntu sucks, but less than windows. Gmail sucks, but less than hotmail. Opera rocks, but it tends to fuck up gmail every once in a while. After a lot of research and having found no help on the interweb I traced the problem to having a lot of tabs open for a lot of time [...]]]></description>
			<content:encoded><![CDATA[<p>Ubuntu sucks, but less than windows. Gmail sucks, but less than hotmail. Opera rocks, but it tends to fuck up gmail every once in a while. After a lot of research and having found no help on the interweb I traced the problem to having a lot of tabs open for a lot of time (weeks, not hours).</p>
<p>In Firefox this shouldn&#8217;t be a problem as having a FF browser open for a week should hog all the memory on its host computer, forcing you to reboot. In Opera, being a little bit better behaved browser, this may actually be a problem.</p>
<p>Luckly the fix is simple: open a <a href="http://nicolasb.com.ar/category/vim/">Vim</a> editor or take out pencil and paper, make a list of all your open tabs, close opera and using your favourite console type &#8220;rm -rf ~/.opera/sessions&#8221; (i.e. delete the sessions folder in your .opera dir). Restart Opera and restore your tabs from your backup list. Problem should be gone.</p>
<p><a href="http://nicolasb.com.ar/archivos/2010/04/bork.jpg"><img class="aligncenter size-medium wp-image-937" title="bork" src="http://nicolasb.com.ar/archivos/2010/04/bork-239x300.jpg" alt="" width="239" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2010/07/opera-borks-gmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nooooooooooo</title>
		<link>http://nicolasb.com.ar/2010/06/nooooooooooo/</link>
		<comments>http://nicolasb.com.ar/2010/06/nooooooooooo/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 10:00:50 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[Grumpy]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=950</guid>
		<description><![CDATA[(gvim:13664): Gdk-CRITICAL **: gdk_window_get_user_data: assertion `GDK_IS_WINDOW (window)&#8217; failed Vim: capté una señal de muerte SEGV Vim: finalizado.]]></description>
			<content:encoded><![CDATA[<p>(gvim:13664): Gdk-CRITICAL **: gdk_window_get_user_data: assertion `GDK_IS_WINDOW (window)&#8217; failed<br />
Vim: capté una señal de muerte SEGV<br />
Vim: finalizado.</p>
<p><a href="http://nicolasb.com.ar/archivos/2010/05/VaderscreamsNOOOOOOOOO.jpg"><img class="aligncenter size-medium wp-image-949" title="VaderscreamsNOOOOOOOOO" src="http://nicolasb.com.ar/archivos/2010/05/VaderscreamsNOOOOOOOOO-190x300.jpg" alt="" width="190" height="300" /></a></p>
<p><a href="http://nicolasb.com.ar/archivos/2010/06/no.jpg"><img class="aligncenter size-medium wp-image-968" title="no" src="http://nicolasb.com.ar/archivos/2010/06/no-300x291.jpg" alt="" width="300" height="291" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2010/06/nooooooooooo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oh shit, the stack</title>
		<link>http://nicolasb.com.ar/2010/06/oh-shit-the-stack/</link>
		<comments>http://nicolasb.com.ar/2010/06/oh-shit-the-stack/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 10:00:49 +0000</pubDate>
		<dc:creator>nico</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Grumpy]]></category>

		<guid isPermaLink="false">http://nicolasb.com.ar/?p=857</guid>
		<description><![CDATA[* Post from the wayback machine. I wrote this a long time ago but it got way down the posts queue, don&#8217;t know why * I liked my vacations very much, thank you. Some people enjoyed vacations from me too. At work they even decided to keep this gem for my return. Upon my arrival [...]]]></description>
			<content:encoded><![CDATA[<p>* Post from the wayback machine. I wrote this a long time ago but it got way down the posts queue, don&#8217;t know why *</p>
<p>I liked my vacations very much, thank you. Some people enjoyed vacations from me too. At work they even decided to keep this gem for my return. Upon my arrival a nice coredump was waiting at my desk, so to speak. Check it out, isn&#8217;t it beautiful?</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="nu0">0</span> 0xff05d070 in inflate_fast <span class="br0">&#40;</span><span class="br0">&#41;</span> from /usr/lib/libz.<span class="me1">so</span></div>
</li>
<li class="li1">
<div class="de1"><span class="nu0">1</span> 0xff05a13c in inflate <span class="br0">&#40;</span><span class="br0">&#41;</span> from /usr/lib/libz.<span class="me1">so</span></div>
</li>
<li class="li1">
<div class="de1"><span class="nu0">2</span> 0&#215;00146224 in ZDecompress::<span class="me2">decompress</span> <span class="br0">&#40;</span>this=0xfbc7b300, sauce=@0xfbe7b740, dest=@0x27c910<span class="br0">&#41;</span> at Compressor.<span class="me1">h</span>:<span class="nu0">134</span></div>
</li>
<li class="li1">
<div class="de1"><span class="nu0">3</span> 0x00145e80 in HandleClient::<span class="me2">get_client_data</span> <span class="br0">&#40;</span>this=0x27c810, output_stream=0x27c910<span class="br0">&#41;</span> at IPC/DataReceiver.<span class="me1">cpp</span>:<span class="nu0">54</span></div>
</li>
</ol>
</div>
<p>Yeah, that&#8217;s getting killed inside zlib. Nice way to start the year, a bug in zlib. What led me to that conclusion? Easy, the same compressed file worked in Ubuntu. Must be a bug in zlib then!</p>
<p>The next step was getting zlib&#8217;s code and adding enough printf&#8217;s to know the problem was in the middle of the file, not at the beginning nor the end; indeed, most of the file could be correctly decoded, but then it just died. This looked more and more like a bug in zlib.</p>
<p>I began to scramble things around, trying to isolate the problem. Things just got weirder, the same code worked fine if instead of being inside a thread I was on the main thread. If you have psychic powers you now have enough information to know what the problem was. Although I should have known too (this wasn&#8217;t even the first time I saw a problem like this one!) I was mindset on finding a bug in zlib, which now, it seems, only appears while interacting with ACE (in my defence, I did see these kind of bugs too).</p>
<p>Fiddling around with the code some more, even stranger backtraces began to appear. First this one:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">Program received signal SIGSEGV, Segmentation fault.</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>Switching to LWP <span class="nu0">10</span><span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">0xfd6b88fc in _pollsys <span class="br0">&#40;</span><span class="br0">&#41;</span> from /usr/lib/libc.<span class="me1">so</span><span class="nu0">.1</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#40;</span>gdb<span class="br0">&#41;</span> bt</div>
</li>
<li class="li2">
<div class="de2"><span class="co2">#0 &nbsp;0xfd6b88fc in _pollsys () from /usr/lib/libc.so.1</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#1 &nbsp;0x696e7661 in ?? ()</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#2 &nbsp;0x696e7661 in ?? ()</span></div>
</li>
</ol>
</div>
<p>And then this other one, which led me into the right direction:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">Program received signal SIGSEGV, Segmentation fault.</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>Switching to LWP <span class="nu0">9</span><span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">0x000b6784 in std::<span class="me2">operator</span>| <span class="br0">&#40;</span>__a=Cannot access memory at address 0xfbb7b094</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; at /usr/local/lib/gcc/sparc-sun-solaris2<span class="nu0">.10</span>/<span class="nu0">3.4</span><span class="nu0">.6</span>/../../../../include/c++/<span class="nu0">3.4</span><span class="nu0">.6</span>/bits/ios_base.<span class="me1">h</span>:<span class="nu0">124</span></div>
</li>
<li class="li1">
<div class="de1"><span class="nu0">124</span> &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="kw1">return</span> _Ios_Openmode<span class="br0">&#40;</span>static_cast<span class="br0">&#40;</span>__a<span class="br0">&#41;</span> | static_cast<span class="br0">&#40;</span>__b<span class="br0">&#41;</span><span class="br0">&#41;</span>; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#40;</span>gdb<span class="br0">&#41;</span> bt</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#0 &nbsp;0x000b6784 in std::operator| (__a=Cannot access memory at address 0xfbb7b094</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; at /usr/local/lib/gcc/sparc-sun-solaris2<span class="nu0">.10</span>/<span class="nu0">3.4</span><span class="nu0">.6</span>/../../../../include/c++/<span class="nu0">3.4</span><span class="nu0">.6</span>/bits/ios_base.<span class="me1">h</span>:<span class="nu0">124</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#1 &nbsp;0x00152d5c in HandleClient::get_client_data (this=Cannot access memory at address 0xfbb7b088</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span> at IPC/DataReceiver.<span class="me1">cpp</span>:<span class="nu0">46</span></div>
</li>
</ol>
</div>
<p>That last stack trace got me to think how could it be possible for an otherwise working program to coredump while creating an stdlib object. I mean, stdlib is quite well tested, isn&#8217;t it? Then it struck me: the keyword isn&#8217;t stdlib but <strong>creating</strong>. It was allocating memory from the stack, upon entering the function.</p>
<p>Some more research later I found out that Solaris default thread size is about 1 mb, while in Ubuntu this thread is of about 8 mb. And I also noticed the buffer I was allocating for zlib was taking up space in&#8230; the stack.</p>
<p>If there&#8217;s something to learn from this story is that you should always know what goes in the stack: only small objects should live there, and you should always know the max stack depth a function could reach. Otherwise it may come back and bite you in the ass when you&#8217;re back from your vacations.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasb.com.ar/2010/06/oh-shit-the-stack/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

