Wednesday, December 19, 2007

Toolbox for troubleshooting processes and connectivity

I have had a rather nasty issue for the past month or so with a VB6 application I'm rewriting in VB.Net 2005. It uses free threading in VB6, and it's not done very well. It memory leaks like crazy, floods the DB server with connections, and crashes a lot. With the previous author using advanced techniques like "Dim X As Variant" and then assigning it to everything from strings to objects to function addresses -- all in the same procedure -- troubleshooting was exceedingly difficult. In the course of making sense of this madness I amassed a toolbox of free tools and Windows utilities you can use to troubleshoot processes and connectivity.

Stuff built into Windows (XP)


ipconfig - The first place to check when you're having network issues. Use this to verify the IP address is set, and add the /all switch to make sure you have the correct DNS entries.

route
- The second thing to look at when you're having network routing problems. With the print flag it shows you every identified route from your computer.

Free tools


Process Explorer - This gives you an accurate and complete picture of how memory is allocated and everything a process has loaded. It will even tell you every Registry key a process touches, which can be tremendously handy.

[Side Note: Task Manager has numerous limitations, but two really stand out as truly egregious. First, it doesn't accurately report virtual memory. It actually tells you the private bytes a process has allocated, which is not the VM size. Second, it doesn't tell you external modules (DLL's, spawned applications) a process has loaded. If you see that an app is hanging you don't know if it's a problem in the application or one of the DLL's or applications it calls. Process Explorer plugs both these holes, and a whole lot more.]

Network Monitor - Allows you to capture and analyze TCP/IP packets.

Wireshark
- A network protocol analyzer that takes the Network Monitor to new levels. It can be used with everything from TCP/IP to USB and FDDI. This is the ultimate tool, but it does have a steep learning curve.

iperf - This handy utility will measure the bandwidth, delay jitter and datagram loss between hosts. This is most useful in WAN scenarios so you can verify what the bandwidth is between locations, but you can also use it as an indicator of network congestion on a LAN. Note that this is also sometimes called lperf, with a lower case "L" at the beginning. The correct name starts with a lower case "i".

I also want to mention that a great collection of tools is available from Sysinternals. This was a private company making tools (such as Process Explorer and Network Monitor) to plug holes in the base offerings by Microsoft. Microsoft bought them in 2006, but the same people are still working on the tools so the quality is still great. There is a wide range of tools, so you'll probably find something useful. :-)

2 comments:

  1. Maintaining cryptic code/having your worst week ever, I hope Santa gives you something nice for christmas.. :)

    ReplyDelete
  2. Thanks Tommy. :-) If by Santa you mean my second job, I got one of these.

    ReplyDelete