Monday, July 13, 2009

further adventures in horrible code -- effin assert

Lots of assert() checks spread throughout our code, testing perfectly valid error conditions. Used sparingly, testing things that absolutely could not happen... ok. But checking for NULL values passed as parameters to various type comparison functions? Eeesh.

It's caused problems up a couple times before... but last Friday's was extra awesome. I'd been working for 3 days with a customer, trying to resolve the cause of a crash of our application at their site. Finally get them to install WinDbg and run our debug build so we can get some crash dumps.

Bang. Assertion failure. Nowhere near the crash we see when running a release build.

Dig into the crash dump. Dirty data in their database that the release-compiled version of our application just ignores because the assert() check is turned into a no-op by the preprocessor for release builds.

I can't tell them it's their data that needs to be fixed. This application and its periodic releases has been running just fine on their system for 5+ years.

But, I also can't run the debug version of the latest release to diagnose their current problem. It's stopping during initialization due to the asserts.

Argh.

3 comments:

Bartski said...

Speak Engrish, man!

neeber said...

NEBER!

Anonymous said...

I used to get drunk on my mom's client stash of Royal Crown and chase my cat around, too. I'd really try to scare her, and make faces, and I'd crawl around weird.

She'd hide. But I always found her.

Sometimes I felt a little remorseful, and put a little jelly on a plate for her to eat.