Typically, space equipment goes through a lot of vigorous testing before it's allowed to go up into space for official use by astronauts, but sometimes, even something that passes all the tests can fail.
The Soviet Union's MIR was a modular space station that was used from 1986-2001 that would one day be succeeded by the International Space Station that's used today.
During one of the spacewalk missions that astronauts aboard the MIR were tasked to perform, getting back inside of the space station came with some nasty little problems. The outer hatch would not make a proper seal, and as a result, the astronauts were unable to remove their space suits because air was leaking out of the hatch.
Under a high-stress situation, the astronauts were tasked with moving to another part of the MIR, which had its own hatch that could be used to create a new vacuum for the oxygen supply.
The astronaut telling the story, David Wolf, explains that had it not been for a specific training exercise that he was put through here on Earth, the two astronauts may not have survived.