As we know a CPU is pretty much billions of transistors on a single thumbnail, what if one of the transistors breaks?
Does CPU have any auto-recovery mechanism?
It's simple, we test them before we sell them and throw the bad ones out.
There are lots of ways to do this - different people do different thing, often use a combination of:
some tests are at speed to make sure they go fast enough.
other tests involve a mode that turns some or all of the flipflops in the chip into giant serial shift registers, we clock known data into those chains, then run the chip for one clock and then scan the new results back out and check that they match our predicted results - automatic test tools generate a minimum set of "scan vectors" that will test every random gate or transistor on the chip - other vectors do special tests of ram blocks,
others test that the external wires are all bonded correctly
we make sure it's not pulling an unhealthy amount of current
Testing time costs money, we sometimes do some simple testing for obvious dead chips before they are packaged to discard the bad ones and then more testing after the packaging is done
To expand a bit on what others have said: There is validation and after that there is classification of chips.
Transistors in CPUs tend to show their problems at higher frequencies, so it is common to make one CPU and then market it as several different products. The cheaper CPUs are actually damaged versions of the expensive CPU. Another option is disabling certain parts of the CPU. For example, AMD made processors with BArton core. It also sold processors with Thorton core. Thorton wasn't a new core. Instead, half of L2 cache was defective and disabled. This way, AMD made some recovery on the CPUs that would have been otherwise wasted.
Same thing happened with AMD's 3 core processors. They were originally 4 core processors, but one of the cores was determined to be defective, so it was disabled.
The answer to your question is, "No." There are currently no auto-recovery methods, for hardware failures.
Manufacturers engineer their processes to get the best yield (dollars) possible from their wafers. By shrinking the transistors, they can fit more functionality into less area. This can be thought of as more chips (of the same functionality) per wafer. As the chip size shrinks, you can get more of them out of a wafer, but as they shrink, more of them turn out bad. Manufactures accept this, and are constantly pushing the envelope of technology to shrink chips. The thing which tells them they ARE at the edge of the envelope is bad chips.
If a company can shrink feature size to 70% of the old feature size, they can get about 2 times the number of chips on a wafer. If their yield on the old process was 95% (say, 95 good chips chips out of 100 on a wafer) and their yield on the new process is 75% (150 good chips out of 200 on a wafer) they made money going to the new process.
At small nodes, each "transistor" is 2 gates unless you have memory, such as SRAM. If one doesn't work, you just have a slow driver. For SRAM, if it doesn't pass, you just "blow" the row. If both of the FETS on transistor fail, you'd have a very expensive piece of sand, but I've personally never had that happen. The modern FinFETs are so small, there are a bunch of production problems (hassles mainly) due to the nature of lithography and probability. You will find that first things out on new processes are FPGAs because you can just "blow" the bad cells and change the routing graph. I cannot give you the numbers, but you can guess by how the x86 world does binning, things seldom go perfectly.
The green bars left/right are fins, and the red is poly. The blues are the coloured metal at level 1.
Commercial CPUs do not have an autorecovery mechanism, but things floating around in academia and special application CPUs do. I've made some specialized components that use asynchronous architectures to solve clock issues that arise due to bad gates though destruction of oxide of a hole as a hot carrier where you just get one really slow transistor.
Apparently times have changed. Many of the five year old answers in this question no longer reflect the state of art and some were not accurate then.
Transistors and other devices on silicon are fairly stable after manufacturing, provided the IC does not overheat.
Here are things now done in a modern IC manufacturing process to minimize defects:
Programming errors in the processor's formal specification are more likely than failures of a particular transistor.
While common CPUs don't have anything like an autorecovery ability, there has also been work on self-resetting CPUs as a countermeasure for cosmic rays. Cosmic rays can deposit enough energy in a CPU or RAM to cause bit-flips.
As pointed out in comments, mission critical systems have relied on multiple CPUs for verification for a long time. The space shuttle, back in 1976, as one example, used five computers, four of which ran the same program and "voted" on all flight control decisions to ensure safety.
Most modern processor transistors are FETs. These have the advantage of gaining source/drain resistance when starting to overload. This is one factor that allows high power MOSFETs to be made by putting many in parallel. The load automatically distributes. That may be a factor to help distribute issues. But I think it is really simpler than that.
As with most electronic parts, if you drive them within spec, they will last for quite a while. When a microprocessor is made, there are two factors for the cost. Just the space on the silicon and, due to complexity, the actual yield. Not all chips work after manufacturing. However, once it is made and pasts the validation, you know the transistors are good. If driven within spec, chances are that they will stay good.
Have you ever wondered why the same chip is sometimes sold at different speeds? And have you noticed that sometimes the same GPU chip architecture is sold with different number of internal units?
There is no way of fixing a hardware defect at the silicon level, but over time designers have learned to deal with the problem of increasing the yield. With no foresight, the yield is solely dependent on the manufacturing quality. However, if you are clever, you can recover some of the bad chips.
For instance, let's say that you have a 18-core chip design, that work more or less independently. During testing, you sort perfect chips and release it as the A18 model. Most failed chips have only one error, so they will work fine as long as the faulty core is disabled. You sell these as the A17 model at a slightly lower price, and those that have two bad cores are sold as the A16 model at an ever lower price.
The same can apply to a chip's speed rating. Perfectly manufactured chips will be capable of running at speeds beyond the design spec, but chips with problems might not. These are sold at lower speed specs.
This method will dramatically increase the overall yield and is therefore quite commonly seen. The PlayStation 3 for instance has 8 SPE units in hardware, but one is always disabled to account for yield problems.
Does CPU have any auto-recovery mechanism?
No as explained above. However their caches, especially L2 and L3, can have extra RAM in them. When the part is tested at the factory, bad RAM blocks can be removed and the extra RAM blocks used.
In general no, you cover bad transistors through chip screen, and you expect a relatively small percentage of losses after that. The chip business has been around for decades they have lots of tricks for managing this (and yes, sometimes one of the tricks is to just let bad parts out and replace them for free or let the customers be unhappy).
For radiation hardened environments (space) you would likely be triple voting, every "bit" actually has three bits that vote to make one. it only takes a two thirds vote to determine the bit setting. so transistors in the other third could go bad and will with total dose eventually. but the primary concern is single event upset. Those chips and systems are designed for these environments from top to bottom, silicon, hardware, software, etc. And they use old tried and true tech, not cutting edge, so the transistor count and size of the transistors is from years ago.
COTS is expected to hiccup and fail from time to time.
It may seem like a miracle but there are a number of mechanisms used to reduce the amount of transistor failures. However, depending on the type of failure experienced by the transistor and where, the CPU may or may not still be usable sometimes under certain conditions.
At present, there is often no auto-recovery mechanism built in but there is a lot of research into reconfigurable computing, redundancy and other techniques to minimise this problem.