{"id":26,"date":"2007-04-04T21:30:56","date_gmt":"2007-04-05T02:30:56","guid":{"rendered":"http:\/\/www.opticality.com\/blog\/?p=26"},"modified":"2007-04-04T21:30:56","modified_gmt":"2007-04-05T02:30:56","slug":"networking-mystery-solved","status":"publish","type":"post","link":"https:\/\/opticality.com\/blog\/2007\/04\/04\/networking-mystery-solved\/","title":{"rendered":"Networking mystery solved!"},"content":{"rendered":"<p>I run my own server for a variety of things, and I&#8217;m the SA (SysAdmin). I get a kick out of it, so I don&#8217;t find it to be a grind.<\/p>\n<p>One of the things that I run is a Jabber server. On my laptop, I use <a href=\"http:\/\/gaim.sourceforge.net\/\" title=\"GAIM\" target=\"_blank\">GAIM<\/a> to connect to it. I&#8217;ve been running it for a long time, and for the most part, I really like GAIM as a client, and Jabber as a service. Unfortunately, if I&#8217;m on for my typical 12 hour day, GAIM will lose it&#8217;s connection to my server at least 10 times. It reconnects within a few seconds, but every one on my buddy list sees me &#8220;flapping&#8221; (logging off and then back on).<\/p>\n<p>It has been <em>really<\/em> annoying, but I never spent even one minute trying to track it down. I assumed that either GAIM was flakey, or the Jabber server I was running was flakey, etc.<\/p>\n<p>For many reasons (most of them more paranoid than sound), I have <strong>strongly<\/strong> resisted running IMAP as my main email protocol. As a result, I use POP to retrieve my emails, and back up my files on to external USB disks. For those of you who have read my past posts, you&#8217;ll know that I spent an absurd amount of time playing with SPAM filtering over the past 1-2 months.<\/p>\n<p>As a result, I ended up with a rhythm that I like. All <em>suspicious<\/em> mail gets auto-filtered into IMAP folders (yes, IMAP, because it&#8217;s not intended to <em>stay<\/em> on the server), and all good mail continues to be polled and pulled continuously via POP. Whenever I want to check on my spam, I open up the IMAP folders, scan them quickly, and either dispose of the spam permanently, or drag a good email into my inbox, etc.<\/p>\n<p>When I first started, it worked fine. Then I started doing it for Lois as well (with equally good results). After a week or two, IMAP started hanging relatively frequently. It <em>always<\/em> worked, but it was <em>way<\/em> more annoying than the GAIM disconnect\/reconnect dance. In the case of IMAP, I was <em>actively<\/em> clicking on something because I was ready to process it, and the hangs (even if they were only 30 seconds in length) were killing me!<\/p>\n<p>So, I googled a bit, and discovered a likely culprit. Courier-imap (which I have been very happy with forever) has a configuration variable that by default, only permits 4 simultaneous connections from a single IP. Of course, since I was NAT&#8217;ed, all of my connections were coming from the same IP. I was proud of myself for finding this, and I upped the variable and restarted Courier-imap. It seemed to work. However, after a few days (and perhaps more folders and clicks), it started to reliably hang again.<\/p>\n<p>I upgraded to the latest Courier-imap with no change. This was too maddening. So, I started watching the \/var\/log\/messages file. When I was hanging, I was seeing a number of IPTABLES log messages being spewed. It turns out that packets from my laptop were being <strong>dropped<\/strong> (rejected!). Huh? My firewall is supposed to let me in, not keep me out!<\/p>\n<p>So, the specific packets were dropped for being in the state &#8220;NewNotSyn&#8221; (you can google it yourself if you care) \ud83d\ude09<\/p>\n<p>After some serious googling, it turns out that this is a known problem in two frequent configurations:<\/p>\n<ol>\n<li>Two firewalls in between the client and application (this is true for me)<\/li>\n<li>Microsoft Networking being the client, with Linux being the server (oops, that&#8217;s me too).<\/li>\n<\/ol>\n<p>So, after changing my firewall config a bit, IMAP <strong>never<\/strong> hangs any longer (yeah, that&#8217;s right, <strong>never<\/strong>). As a bonus, in three days since I&#8217;ve made the change, GAIM has only flapped once (perhaps twice). GAIM still seems overly sensitive to any network hiccup, but it&#8217;s clear that the dropped packets were killing GAIM, whereas Thunderbird&#8217;s IMAP implementation kept trying relentlessly, and eventually always reconnected&#8230;<\/p>\n<p>Whew. If I hadn&#8217;t started mucking with spam filters, then I wouldn&#8217;t have started using IMAP, then I wouldn&#8217;t have started hanging on IMAP, then I wouldn&#8217;t have discovered the dropped packets, and I wouldn&#8217;t have solved my long-standing, long-suffering GAIM problem.<\/p>\n<p>Another happy ending. \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I run my own server for a variety of things, and I&#8217;m the SA (SysAdmin). I get a kick out of it, so I don&#8217;t find it to be a grind. One of the things that I run is a Jabber server. On my laptop, I use GAIM to connect to it. I&#8217;ve been running [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[4,3,2],"tags":[],"class_list":["post-26","post","type-post","status-publish","format-standard","hentry","category-4","category-3","category-2"],"_links":{"self":[{"href":"https:\/\/opticality.com\/blog\/wp-json\/wp\/v2\/posts\/26","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opticality.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opticality.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opticality.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/opticality.com\/blog\/wp-json\/wp\/v2\/comments?post=26"}],"version-history":[{"count":0,"href":"https:\/\/opticality.com\/blog\/wp-json\/wp\/v2\/posts\/26\/revisions"}],"wp:attachment":[{"href":"https:\/\/opticality.com\/blog\/wp-json\/wp\/v2\/media?parent=26"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opticality.com\/blog\/wp-json\/wp\/v2\/categories?post=26"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opticality.com\/blog\/wp-json\/wp\/v2\/tags?post=26"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}