July, 2006

Larry Osterman's WebLog

Confessions of an Old Fogey
  • Larry Osterman's WebLog

    Wait, that was MY bug? Ouch!

    • 100 Comments

    Over the weekend, the wires were full with reports of a speech recognition demo at the Microsoft's Financial Analysts Meeting here in Seattle that went horribly wrong. 

    Slashdot had it, Neowin had it,  Digg had it, Reuters had it.  It was everywhere.

    And it was all my fault.

     

    Well, mostly.  Rob Chambers on the speech team has already written about this, here's the same problem from my side of the fence.

    About a month ago (more-or-less), we got some reports from an IHV that sometimes when they set the volume on a capture stream the actual volume would go crazy (crazy, for those that don't know, is a technical term).  Since volume is one of the areas in the audio subsystem that I own, the bug landed on my plate.  At the time, I was overloaded with bugs, so another of the developers on the audio team took over the investigation and root caused the bug fairly quickly.  The annoying thing about it was that the bug wasn't reproducible - every time he stepped through the code in the debugger, it worked perfectly, but it kept failing when run without any traces.

     

    If you've worked with analog audio, it's pretty clear what's happening here - there's a timing issue that is causing a positive feedback loop that resulted from a signal being fed back into an amplifier.

    It turns out that one of the common causes of feedback loops in software is a concurrency issue with notifications - a notification is received with new data, which updates a value, updating the value causes a new notification to be generated, which updates a value, updating the value causes a new notification, and so-on...

    The code actually handled most of the feedback cases involving notifications, but there were two lower level bugs that complicated things.  The first bug was that there was an incorrect calculation that occurred when handling one of the values in the notification, and the second was that there was a concurrency issue - a member variable that should have been protected wasn't (I'm simplifying what actually happened, but this suffices). 

     

    As a consequence of these two very subtle low level bugs, the speech recognition engine wasn't able to correctly control the gain on the microphone, when it did, it hit the notification feedback loop, which caused the microphone to clip, which meant that the samples being received by the speech recognition engine weren't accurate.

    There were other contributing factors to the problem (the bug was fixed on more recent Vista builds than the one they were using for the demo, there were some issues with way the speech recognition engine had been "trained", etc), but it doesn't matter - the problem wouldn't have been nearly as significant.

    Mea Culpa.

  • Larry Osterman's WebLog

    To default, or not to default, that is the question...

    • 32 Comments
    One of the "interesting" features of C++ is the ability to default the value of parameters to a method.

    It's one of those features that I'm sure that Bjarne Stroustrup thought was just flat-out neat (there are a number of feature in C++ that fall into the broad category of "convenience features", I'm pretty sure that defaulted parameters is one of them).

    One of the developers (Nick) in my group was working on a fix for a bug, the fix required that he add a new parameter to a relatively common routine.

    It turned out that for all of the calls to that routine, except for one, the new parameter would have the same value.

    Nick's suggestion was to add the new parameter as a defaulted parameter because that way he wouldn't have to change that much code.

    Eventually I vetoed the idea, because of the following problem.

     

    Let's say you have a function foo:

    HRESULT Foo(DWORD param1, BOOL param2=FALSE)
    {
        :
        :
    }

    Everything's great - your code's running, and it's all great.

    What happens six months later when you need to change the signature for Foo to:

    HRESULT Foo(DWORD param1, void *newParam, BOOL param2=FALSE)
    {
        :
        :
    }

    Well, in this case, you're in luck, you can simply compile the code and the compiler will happily tell you every function that needs to change.

    On the other hand, what if the change was:

    HRESULT Foo(DWORD param1, DWORD newParam, BOOL param2=FALSE)
    {
        :
        :
    }

    Now that's a horse of a different color.  The problem is that the types for BOOL and DWORD are compatible.  It means that any code that specified a value for param2, like:

        hr = Foo(32, TRUE);

    is still going to compile without error.  The compiler will simply interpret it as:

        hr = Foo(param1=32, newParam=1, param2=FALSE);

    Now the language lawyer's are going to shout up and down that this is a design problem in Windows, the BOOL and DWORD types shouldn't have both been defined as "unsigned long", that instead param2 should have been defined as "bool".

    The problem is that you STILL have problems.  If param2 was defined as 'bool', what happens if you need to add a non default parameter that's of type 'bool'?  You're back where you were before.

    Or you could have:

    HRESULT Foo(DWORD param1, int newParam, short param2=3)
    {
        :
        :
    }

    In this case, the automatic promotion rules will quite happily promote a short to an int without a warning.

    There have been dozens of times when I've discovered bugs that were introduced by essentially this pattern - someone added a parameter to a function that has defaulted parameters, there was an automatic conversion between the defaulted parameter and the newly added parameter, and what was a simple change all of a sudden became a bug.

  • Larry Osterman's WebLog

    Paddington Thoughts

    • 31 Comments

    The other day, I mentioned I got sucked off on a high priority project shortly after I returned from my vacation.  I was asked to help out with the EU protocol documentation effort, working on a couple of the documents (based on some stuff I did back when I worked in the Lan Manager group).

    I'm pretty darned proud of the work that the people on the documentation team have done - the specifications that were produced are really quite impressive.

     

    But what most impressed me the most was the amount of work that the people working on this project have spent on it - I just got roped in to help with the final push, but some of those people have been working 16 hours a day, 7 days a week for months and months on this stuff. 

    The level of dedication to this project that I saw was as much or more than I've seen on ANY other Microsoft project.  These guys figuratively worked their fingers to the bone typing up documents - countless late hours spread across the entire team.

    In particular, the work of Henry Sanders, Iain McDonald, and several others was absolutely heroic.  Henry personally reviewed and provided technical feedback on every single specification that was submitted to the EU.  For the specification I wrote, there's no way that it couldn't have been completed without Henry's insightful comments and the invaluable help of David Kruse (he's the guy who's currently responsible for networking code I wrote back when I was on the NT networking group), and of course Veronica Skeels who made all the words I wrote look professional.

    I'm not going to say one word about the politics of the EU documentation work, I just want to recognize the truly remarkable work and the heroic effort that was done on the project.

     

  • Larry Osterman's WebLog

    I'm Back (European trip report)

    • 16 Comments

    I'm a baaad blogger.

    It's been a while, sorry 'bout that.  We were on vacation 'til the 5th, then I got massively jetlagged (which was weird, because I didn't have any jet lag issues on the trip to Istanbul, usually I have problems going west to east, not east to west).

     

    Anyway, we had a great time on the vacation - there were 11 of us traveling (the 4 West Coast Ostermans, 3 of my 4 siblings, my younger brothers girlfriend, my step-mom, our "adopted grandparents"), so we were quite the pack.  We started in Istanbul, staying at the Four Seasons (I HIGHLY recommend it - it's in the Sultanamhet, literally steps away from the Hagia Sofia, Blue Mosque,and Topkapi Palace.  The Hagia Sofia:

     

    We then moved to the Greek Isles. Visiting Santorini, we hiked up to the top of the remnants of the old Thera volcano - it's still active (if not very).  I kinda went a bit overboard taking pictures of Bougainvillea, for whatever reason, I just find it picturesque.  This is a house I ran into in Oia (2nd largest city on Santorini):

    Next on to Naphtlion.  We visited the ruins of Mycenia, and had an awesome lunch in a small cafe in the harbor.  We left early in the evening, so I was able to get a couple of evening pictures (an unnamed fort in the harbor):

    After Naphtlion, came the city of Itea, which is where the Oracle at Delph is (a rock wall at the oracle):

    Then to Corphu (where they offer bowling at their casino):

     and Korkula (in Croatia).  At Korkula, we went swimming in the Aegean sea, the water was WONDERFUL.

     

    We finally ended up in Venice (on a water taxi ride to the island of Morano):

    This was the view from our hotel:

    And, for my sister Edie, a laundry picture (she collects them):

    I'm a bit annoyed at the cruise line (Seabourn), but except for the issues we had with the cruise, the trip really was magical.  I ended up taking close to a thousand pictures, of which we're likely to print up and frame a dozen or so.

    The reason there are so many Venice pictures here was simply because the city is so unbelievably photogenic.  I really was blown away by it - the color palate there is different than any other city to which I've been.

     

     

    Anyway, after we got back and I recovered from jet lag, I got dropped into an insanely high priority project that only finished up on Tuesday, I spent today recovering from that project.

    But I'm back, and ready to resume blogging.  For real this time :)

     

  • Larry Osterman's WebLog

    Seen in the Grand Bazaar in Istanbul.

    • 15 Comments
    One more from my trip to Europe.

    One of the things that really surprised me about the Grand Bazaar was that many of the corridors had flat-screen monitors placed every 10 meters or so displaying the Turkish feed of CNBC-e.  It was basically a culture-shock thingy - you don't usually see news channels on TVs in shopping venues in the US.

     

    And, of course, those monitors weren't exempt from crashes :):

     

    Btw, when we went back the next day, the powers-that-be had resolved whatever issue was going on.

     

  • Larry Osterman's WebLog

    WASAPI documentation online

    • 7 Comments

    I've known this for a while, but forgot to mention it.  The documentation for the WASAPI interfaces (core audio interfaces in Vista) are now available on MSDN.

     

    The documents aren't final, but they're likely to be pretty close.

     

    Now I can start talking about how you use these thingys.

     

  • Larry Osterman's WebLog

    Daniel's first play of the summer starts on Thursday!

    • 0 Comments

    This summer, Daniel's appearing in two separate SCT productions (I believe he's the first actor to appear in two summer season productions during the same season).

    This Thursday, Friday and Saturday at 8:15PM, he appears in the role of "Father" in SCT's production of "All of a Kind Family".  The production of AKF is suitable for all ages.  It appears in a double bill with the Deaf Youth Theater's production of Shakespeare's "The Tempest".

     

    Next week, Daniel appears in the role of "Dad" (I detect a theme here) in SCT's production of "Speak", on Thursday, Friday and Saturday at 7:00PM.  Speak is intended for older audiences.

    Anyway, I'm really excited to see the shows!

Page 1 of 1 (7 items)