Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Need For Arch-Enemy

0 comments
Jeff Atwood reasons the need for an enemy : Who's Your Arch-Enemy?

Coding and Testing

0 comments

Code is not ready for release until unit test cases are run and verified. It is always recommended that this rule is religiously followed no matter how little changes that the programmer might have done. Recently I had to relearn this rule the hard way. Confident that nothing would have got broken with the kind of changes that I did, I merged the changes to mainline with out complete testing. The code was released to the test team. And when I attend the office the next day and check my mail, there is a high severity bug reported. A bug so severe it had blocked a huge chunk of test cases of the test team. I had to resubmit the code with the fix sooner. The fix was trivial, thanks to Rational clearcase, I could diff the versions of code and find the cause for the issue. The lessons learnt are, always do complete analysis of the difference b/w the mainline code which has been thoroughly tested and the changed version before merging the codes. And do exhaustive testing before release of the code to avoid the test team report embarrassing issues. The time for testing might be greater than the time invested for writing code but still DO the testing. Lastly I would say that I have fallen in love with the Rational clearcase. I haven’t had experience on any other but I say any amount that might be quoted for the license of the tool is highly justifiable!

Bug Fixes

2 comments
Fixing a bug in an application, which uses a third party stack is always challenging especially if it isn't obvious at outset where the problem lies. Recently I was up against two such issues in the application that I code. The fascinating thing is that both required a single line change of code but almost twenty man-days to find out which line to change! The multithreaded client application uses the OpenSSL stack to secure the communication with the server. One issue was significant memory leak and the other a crash. Both issues did not give direct pointers to the buggy code.

Valgrind is a very good tool for debugging memory leak issues. It reported 3k bytes of leak for every connection that was made to the server. The mailing list gave hints to the solution. After about ten days of analysis and help from top-notch developer in team it turned that I was using an OpenSSL API incorrectly. The fix turned out to be calling a different method than what I was using.

The application crash problem was tougher. It couldn't make it to the targeted release of the product. The crash was occurring when the application was heavily stressed. The mailing list was of not much help. After days of investigation it turned out that the bug was in the OpenSSL code. The OpenSSL method of getting thread IDs was failing in the Linux kernel 2.6. The implementation returned the same ID for every thread. As such the stack was to be changed to fix the issue. And even this time the fix is just a change in one line of the code. Here too I should be thanking my friend who helped me in having the issue fixed and the product released. It helps in having a high quality developer in the team as very good friend of yours!