Often dishwashers start to smell sour because something has lodged in the pump or the drain. Food particles can stick in these areas and start to rot, creating a nasty smell. Take a close look at your empty dishwasher, checking all grates for food or pieces of plastic that may be blocking the drains. If your dishwasher has visible sprayers or nozzles, check these as well. Once you have removed all obstructions, run the dishwasher on empty on the hottest setting before using it for your dishes again.
Every once in a while, your dishwasher needs to be washed just like anything else. Start with a soapy rag and warm water. Scrub the interior of the dishwasher, wiping down the sides and the bottom. Use a plastic scrubber to remove dried or baked-on grime. Clean off the racks as well. Then run the dishwasher empty but with a full load of soap on the hottest water setting.
Vinegar will go a long way toward fixing a stinky dishwasher. Fill a heavy bowl with a one-to-one solution of white vinegar and hot water. Place it upright in the top section of the dishwasher. Run the dishwasher through a regular cycle and the vinegar should help eliminate the sour odor.
If cleaning and vinegar do not do the trick, then it's time to get out the big guns. Pour a package of citric acid crystals into the detergent compartment and run the dishwasher on its regular setting or do the same with a tablespoon of chlorine bleach. This should remedy the problem.