<?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>Alt om ingenting og litt i mellom &#187; debugging</title>
	<atom:link href="http://hovenko.no/blog/tag/debugging/feed/" rel="self" type="application/rss+xml" />
	<link>https://hovenko.no/blog</link>
	<description>En blogg av Knut-Olav</description>
	<lastBuildDate>Mon, 10 Mar 2025 19:25:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Cryptic error message from Courier IMAP server &#8211; Permission Denied</title>
		<link>https://hovenko.no/blog/2012/07/02/cryptic-error-message-from-courier-imap-server-permission-denied/</link>
		<comments>https://hovenko.no/blog/2012/07/02/cryptic-error-message-from-courier-imap-server-permission-denied/#comments</comments>
		<pubDate>Mon, 02 Jul 2012 00:40:24 +0000</pubDate>
		<dc:creator>Knut-Olav</dc:creator>
				<category><![CDATA[English-posts]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Teknologi]]></category>
		<category><![CDATA[Courier-IMAP]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://hovenko.no/blog/?p=749</guid>
		<description><![CDATA[I have debugged this error message for the last couple of days. Jul 1 23:11:56 lance imapd: LOGIN, user=knut-olav@hoven.ws, ip=[::ffff:AAA.BBB.CCC.DDD], port=[48700], protocol=IMAP Jul 1 23:11:56 lance imapd: knut-olav@hoven.ws: Permission denied The solution was pretty simple. The /tmp folder had bad permissions. This server was only meant for hosting email services, so bad permissions on /tmp [...]]]></description>
			<content:encoded><![CDATA[<p>I have debugged this error message for the last couple of days.<br />
<code>
<pre>Jul  1 23:11:56 lance imapd: LOGIN, user=knut-olav@hoven.ws, ip=[::ffff:AAA.BBB.CCC.DDD], port=[48700], protocol=IMAP
Jul  1 23:11:56 lance imapd: knut-olav@hoven.ws: Permission denied</pre>
<p></code></p>
<p>The solution was pretty simple.</p>
<p>The /tmp folder had bad permissions. This server was only meant for hosting email services, so bad permissions on /tmp folder was actually not an issue earlier.</p>
<p>I guess the wrong permissions were caused by my custom XEN node setup using multiple partitions, including a partition just for /tmp.</p>
<p><strong>Debugging was quite hard</strong></p>
<p>Authentication was successful, as I got a different error message when authenticating with a known bad password.</p>
<p>I debugged it using strace. It wasn&#8217;t easy, as courier imap forks out child processes for each connection, which I had to strace as well.</p>
<p><code>
<pre># strace /usr/sbin/couriertcpd -address=0 -maxprocs=40 -maxperip=20 -nodnslookup -noidentlookup 143 /usr/lib/courier/courier/imaplogin /usr/bin/imapd Maildir</pre>
<p></code></p>
<p>Connect to port 143 using telnet.<br />
Log in using this command:<br />
<code>
<pre>i login MY_EMAIL_USERNAME MY_PASSWORD
</pre>
<p></code></p>
<p>Then find the imap process PID. Look for a process running as user <tt>vmail</tt>:</p>
<p><code>
<pre>$ ps axuw|grep imapd
#...
vmail      362  0.0  1.0   4616  1344 ?        S    01:46   0:00 /usr/bin/imapd /var/spool/mail/vmail/hoven.ws/knut-olav/Maildir/
#...
</pre>
<p></code></p>
<p>In this case, the PID is 362. Then attach strace to it using <tt>strace -p 362</tt>, as sudo.</p>
<p>From the telnet interface, I entered a couple of commands like these:<br />
<code>
<pre>2 select "INBOX"
5 UID fetch 1:10 (UID RFC822.SIZE FLAGS BODY.PEEK[HEADER.FIELDS (From To Cc Bcc Subject Date Message-ID Priority X-Priority References Newsgroups In-Reply-To Content-Type)])
</pre>
<p></code></p>
<p>Then I found this somewhere down into the strace output:<br />
<code>
<pre>
open("/tmp/tmpfWsezjv", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied)
write(2, "ERR: knut-olav@hoven.ws: Permiss"..., 43) = 43
</pre>
<p></code></p>
<p><strong>Fixing the problem</strong><br />
<tt>chmod 1777 /tmp</tt></p>
<p>As I wrote earier&#8230; a simple solution.</p>
]]></content:encoded>
			<wfw:commentRss>https://hovenko.no/blog/2012/07/02/cryptic-error-message-from-courier-imap-server-permission-denied/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging Google Maps in Android applications &#8211; uses-library</title>
		<link>https://hovenko.no/blog/2010/07/20/debugging-google-maps-in-android-applications-uses-library/</link>
		<comments>https://hovenko.no/blog/2010/07/20/debugging-google-maps-in-android-applications-uses-library/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 21:17:11 +0000</pubDate>
		<dc:creator>Knut-Olav</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[English-posts]]></category>
		<category><![CDATA[Programmering]]></category>
		<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://hovenko.no/blog/?p=445</guid>
		<description><![CDATA[If your application is failing with a ClassNotFoundException of the class com.google.android.maps.MapView, then the uses-library tag might be misplaced or missing from the application manifest XML. When adding Google Maps to your Android application, make sure that the &#60;uses -library&#62;-tag is inside the &#60;application&#62;-tag of the manifest XML. This might be obvious, but I got [...]]]></description>
			<content:encoded><![CDATA[<p>If your application is failing with a ClassNotFoundException of the class <strong>com.google.android.maps.MapView</strong>, then the uses-library tag might be misplaced or missing from the application manifest XML.</p>
<p>When adding Google Maps to your Android application, make sure that the &lt;uses -library&gt;-tag is inside the &lt;application&gt;-tag of the manifest XML. This might be obvious, but I got this wrong and it took me a long time to figure out the real reason for the error.</p>
<p><code><br />
&lt;uses -library android:name="com.google.android.maps" /&gt;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>https://hovenko.no/blog/2010/07/20/debugging-google-maps-in-android-applications-uses-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging MythTV 0.23 and ivtv</title>
		<link>https://hovenko.no/blog/2010/07/08/debugging-mythtv-0-23-and-ivtv/</link>
		<comments>https://hovenko.no/blog/2010/07/08/debugging-mythtv-0-23-and-ivtv/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 14:26:17 +0000</pubDate>
		<dc:creator>Knut-Olav</dc:creator>
				<category><![CDATA[English-posts]]></category>
		<category><![CDATA[Teknologi]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[MythTV]]></category>

		<guid isPermaLink="false">http://hovenko.no/blog/?p=423</guid>
		<description><![CDATA[If you have a Hauppauge PVR-500 card and recently upgraded Ubuntu to latest 10.04 Lucid, then you might have had problems viewing live TV. The quick fix might be to just install the package &#8220;ivtv-utils&#8221; and to reconfigure the video input/sources with mythtv-setup. I also had a problem with disconnects and warnings of wrong protocol [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a <a href="http://www.mythtv.org/wiki/Hauppauge_PVR-500">Hauppauge PVR-500</a> card and recently upgraded <a href="http://www.ubuntu.com/">Ubuntu</a> to latest 10.04 Lucid, then you might have had problems viewing live TV.</p>
<p>The quick fix might be to just install the package &#8220;ivtv-utils&#8221; and to reconfigure the video input/sources with mythtv-setup.</p>
<p>I also had a problem with disconnects and warnings of wrong protocol version. I cleaned out the database and deployed a new database with the sql file from /usr/share/mythtv/sql. That might be because of some badly configured IP-addresse for the backend and master, but I could actually not see why it changing from my LAN IP-address to 127.0.0.1 would have anything to do with it.</p>
<p>Anyway&#8230; Try installing ivtv-utils first. After installing that package the MPEG2 capture card selection becomes available. First I tried using the v4l option, but that didn&#8217;t work, not even any useful log messages to work with.</p>
]]></content:encoded>
			<wfw:commentRss>https://hovenko.no/blog/2010/07/08/debugging-mythtv-0-23-and-ivtv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging your Android application</title>
		<link>https://hovenko.no/blog/2010/01/09/debugging-your-android-application/</link>
		<comments>https://hovenko.no/blog/2010/01/09/debugging-your-android-application/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 16:43:12 +0000</pubDate>
		<dc:creator>Knut-Olav</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[English-posts]]></category>
		<category><![CDATA[Programmering]]></category>
		<category><![CDATA[Teknologi]]></category>
		<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://hovenko.no/blog/?p=396</guid>
		<description><![CDATA[I am novice on Android application development, slowly starting to understand the architecture. I particularly like that communication between applications and data storage are resource centric. But anyway&#8230; If you have been developing mobile applications for Android you have most likely seen some exceptions in the Eclipse debugger that you don&#8217;t understand, maybe not the [...]]]></description>
			<content:encoded><![CDATA[<p>I am novice on <a href="http://developer.android.com/">Android application development</a>, slowly starting to understand the architecture. I particularly like that communication between applications and data storage are resource centric. But anyway&#8230;</p>
<p>If you have been developing mobile applications for Android you have most likely seen some exceptions in the Eclipse debugger that you don&#8217;t understand, maybe not the tiniest bit. This mostly has to do with lack of experience with the API combined with the strict way that Android sets up views and restricts which threads that are allowed to draw and control the views, along with other concurrency issues.</p>
<p>Starting up your application in the emulated Android environment is not the fastest thing to do, so how can you debug your applications in a little more snappier way? &#8211; In short, I really don&#8217;t know.</p>
<p>What I want is a sane error message with a stack trace of my application code, but since I can&#8217;t get that, I have to debug my application in other ways.</p>
<p><strong>Break points</strong><br />
By setting a breakpoint in your code on places where you think the bug might exist, you can step through your source code until the application fails.</p>
<p>The cons of this are that it is time consuming to do all the manual step by step operations, it&#8217;s a boring way of debugging and the exception message you get might not be understandable to you.</p>
<p><strong>Logging</strong><br />
The Android API provides a <a href="http://developer.android.com/reference/android/util/Log.html">Log class</a> that can be used to log messages and exceptions. It took me some time to figure out how to read the log messages, but the Android Eclipse plugin provides a LogCat view.</p>
<p>To show the LogCat view in Eclipse, you go to &#8220;Window&#8221;, &#8220;Show View&#8221;, &#8220;Other &#8230;&#8221;, expand the &#8220;Android&#8221; category and then open the &#8220;LogCat&#8221; view.</p>
<p>Example output from the LogCat view.<br />
<code>
<pre>
01-09 16:56:52.069: ERROR/Listings(1064): Failed to get trip listings
01-09 16:56:52.069: ERROR/Listings(1064): java.lang.RuntimeException: Example of exception logging
01-09 16:56:52.069: ERROR/Listings(1064):     at no.ut.trip.Listings$ProgressThread.run(Listings.java:112)
</pre>
<p></code></p>
<p>The example above shows an error message on the first line, the exception class and message on the second line, with the stack trace on the following lines. Might be helpful.</p>
]]></content:encoded>
			<wfw:commentRss>https://hovenko.no/blog/2010/01/09/debugging-your-android-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Could not dupe: Bad file descriptor</title>
		<link>https://hovenko.no/blog/2009/09/08/could-not-dupe-bad-file-descriptor/</link>
		<comments>https://hovenko.no/blog/2009/09/08/could-not-dupe-bad-file-descriptor/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 17:39:22 +0000</pubDate>
		<dc:creator>Knut-Olav</dc:creator>
				<category><![CDATA[English-posts]]></category>
		<category><![CDATA[Programmering]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://hovenko.no/blog/?p=348</guid>
		<description><![CDATA[Ok, so I have been debugging a Perl application that I wrote about six months ago. Basically it creates some meta data and copies files to other user accounts using SSH. For file transfer it uses File::RsyncP and for remote control it uses Net::SSH::Perl. Some times I get the error message Could not dupe: Bad [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so I have been debugging a Perl application that I wrote about six months ago. Basically it creates some meta data and copies files to other user accounts using SSH.</p>
<p>For file transfer it uses <a href="http://search.cpan.org/dist/File-RsyncP/">File::RsyncP</a> and for remote control it uses <a href="http://search.cpan.org/dist/Net-SSH-Perl/">Net::SSH::Perl</a>. Some times I get the error message <strong>Could not dupe: Bad file descriptor</strong>. Not a very informative error message, but I had an idea that it might have something to do with the file transfer. After I restart the application, running as a FastCGI web application, everything works, for a short while, then it breaks again.</p>
<p>I found out that it stops working right after I end my SSH connection, after debugging and restarting the application. After some research I found out it had something to do with the loss of STDIN. My best guess is that SSH needs STDIN to be able to read the password entered by the user, but I use keys for authentication, so I won&#8217;t need STDIN at all for interacting with SSH.</p>
<p>I tried different tactics to keep STDIN open. Running it using nohup did not help. Then I tried starting up the web application using <a href="http://www.gnu.org/software/screen/">screen</a>, and now it still runs several hours after logging out from the server.</p>
<p>I don&#8217;t like this workaround very much. So if anyone has a better solution to this problem, I would love to hear about it.</p>
<p>A possible solution might be to redirect STDIN to a temporary file. Anyone had success doing this with Net::SSH::Perl or File::RsyncP?</p>
]]></content:encoded>
			<wfw:commentRss>https://hovenko.no/blog/2009/09/08/could-not-dupe-bad-file-descriptor/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
