Tuesday, July 15, 2008

On Losing Internet (and Insanity) After a Standby

So I've got a Lenovo T60p running Windows XP. Every time I bring the laptop out of standby mode the wireless device stops working. The issue manifests itself in a "No wireless connections available" error reported from the Wireless Network Connection wizard. I'm sure this happens on other platforms, but I've only ever seen it with the Atheros wifi drivers on the Lenovo T60p (Atheros 11a/b/g/n Wireless LAN Mini-PCI Express Adapter).

Anyway, it appears to be a bug in how the driver handles power saving. I think such thoughts because by disabling the power-save mode of the driver, the issue goes away.

So how does one disable power save mode on their wifi driver.

1. Right-click My Network Places, select Properties.
2. Richt click Wireless Network Connection.
3. In the General tab, click on the Configure... button.
4. Select the Advanced tab
5. Choose Power Save Mode from the Property field.
6. Select Off for the Value.

I just upgraded to the Atheros driver, so I'm going to need to test Standby mode again with Power Save Mode set to Maximum.

On OutOfMemoryErrors In JUnit Tests

I ran into an OutOfMemoryError while running a JUnit test in Eclipse. OutOfMemoryErrors are usually really simple to fix ... just increase the amount of memory to the JVM. This issue was a little try

So first of all, I figured JUnit would be running inside the Eclipse JVM, so I increased the memory settings in eclipse.ini to 1 Gig (from 512m).


I restarted Eclipse and reran the JUnit test. Same result.

I then decided to try to execute the same code in our webapp (running in Tomcat 5.5 configured with 512m of heap) and it completed successfully. This made me realize that the JUnit tests must be running in a separate JVM (either spawned or forked). The critical piece is that the JUnit JVM was not using the Eclipse memory settings from eclipse.ini. Instead, it must be using the default JVM memory settings (i.e. 64m). I searched a bit for how one might allocate more memory to a JUnit test in Eclipse and didn't find anything conclusive, so I went in and played around with the JUnit settings myself.

I started by opening up the Eclipse page that allows a user to manage JUnit configuration settings (right click a JUnit class file and select Run As > Open Run Dialog). From this dialog, click on the "Arguments" tab and paste the following settings into the "VM arguments" field:


Apply the settings and Close the dialog. Rerun your test and reconfigure these settings if necessary.