Sunday, February 24, 2013

Cool talks to play in class

Last semester I decided (for the first time) to give up an entire lecture to playing a talk I thought was just too good to ignore. Since then I've realized that there are several "cool talks" out there that fit a variety of courses I teach, and so I plan to collect them. Maybe others will find them just as cool?

So for this first post in the series, the talk that started it all. I played this one in "Computer Systems Fundamentals" which is an introductory systems course at JHU that covers (among many other things) microprocessor design and assembly level programming. The talk covers the MOS 6502 in a variety of ways, but the real "cool-factor" comes from the reverse engineering efforts described and demonstrated toward the end. Kudos to Michael Steil!

Wednesday, February 6, 2013

Annoying Heisenbug: Wavemon breaks NetworkManager

I installed a new wireless router today, one of my Christmas presents finally put to use after sitting in the proverbial box for way too long. Being ever the diligent geek, of course I needed to measure how good the reception is around the house. I looked for a tool that would show me the signal strength of my wireless network on my netbook and found wavemon. The tool seemed to work rather well and allowed me to verify that even in the basement I still get 60% signal strength. Not to shabby for a router sitting on the second floor, is it now?

So I went back upstairs to configure more of the many confusing options dd-wrt provides only to notice that my netbook would intermittently drop its wireless connection. I'd open Chromium to look something up and things would just time out, then suddenly NetworkManager would pop up and request that I enter the admin password followed by the wireless key again, sometimes four times in a row. Then the connection would work for a few minutes before falling to pieces again, yada yada.

I was starting to get rather annoyed by this. Another laptop in the house was having similar problems with the previous wireless router, the very reason I got a new one. Of course that laptop now connected fine with no more problems, but for some reason my netbook which had always worked perfectly on the old router had "caught the bug" and would now not stay connected for more than a few minutes at a time. I kept double-checking what the router said about the connection to my netbook and what wavemon said (running in my netbook) about the connection to the router. Things were just messed up, and all kinds of theories started developing in my head about what could be wrong with Lubuntu 12.10 and NetworkManager and wpa_supplicant and the driver for my strange wireless card, etc. etc. etc.

What never occurred to me was that by desperately looking at the connections using wavemon, a tool used to measure stuff, I was actually causing all this trouble! When I shut down wavemon the network become wonderfully stable. When I started wavemon again, after a minute or two, it started misbehaving. The very definition of a Heisenbug (well, in this case an inverse Heisenbug I guess): It's there when you look for it and gone when you don't. Apparently wavemon was overloading wpa_supplicant with requests for SSID scans (the logs seem to indicate something to that effect) but I didn't verify that in detail.

Now of course there could still be something else wrong, but I've repeated the experiment several times and over and over again wavemon will mess up the connection after a few minutes. My advice: Use that tool only to measure signal strength for a few minutes, then get rid of it and never try to debug your wireless network with it. Never!

Bottom line: About 2 hours wasted. Sigh.

Edit: Some helpful hints for debugging NetworkManager stuff:  https://wiki.ubuntu.com/DebuggingNetworkManager