RIO DE JANEIRO — For months, fears about the Rio de Janeiro Olympics have been hogging the spotlight.

There are concerns about safety amid a surge of murders in Rio, and extremist attacks in Europe and the United States. Polluted beaches and waterways could make athletes and visitors ill, and the Zika virus scared some competitors away.

If all that wasn’t enough, the state of Rio is so broke that months ago it stopped paying thousands of public employees; angry police have periodically been greeting tourists in the international airport with signs that say, “Welcome to hell!”

But if history is a guide, a focus on the problems is all part of the script in the run-up to the games. Once the competitions start, most if not all of the problems fade into the background – at least for the athletes, tourists and millions watching around the world.

Such negative coverage has a “very simple explanation,” said Michael Heine, director of the Center for Olympic Studies at Western University.

“The event is about sports but you can’t find sporting material because the whistle hasn’t gone yet,” said Heine.

“So what else do you write about?”

Coverage ahead of the 2012 Olympics in London included stories about terrorism fears and concerns about civil liberties in light of increased military and police presence. The run-up to the 2008 Games in Beijing put a spotlight on authoritarianism and extreme air pollution in China. In Athens 2004, there were myriad questions about whether the venues would be ready in time.

Many Brazilians feel frustrated that the expectations are overwhelmingly negative, especially when the country has pulled off big events like the 2014 World Cup.

They argue that such accounts don’t take into account Brazilian “jeito,” or way of doing things, which includes an easy-going nature and a penchant for successfully pulling things off at the last moment. And the doomsday scenarios all but ignore samba dancing and capoeira martial arts, beautiful coastlines contrasted by mountains covered with lush jungle, stunning sunrises and sunsets, caipirinha cocktails and culinary options that range from meat-eaters’ delights to exotic fish plucked from the Amazon River.

“No one throws parties like Brazil,” said Denis Eduardo, a 34-year-old travel agent from Sao Paulo. “People might be bashing Brazil now, as if all previous Olympics had been perfect, but it won’t be long until they are all enjoying it here.”

But Brazil’s problems go beyond what other recent countries hosting the Olympics have faced. Latin America’s largest economy and most populous nation is suffering its worst recession in decades. A political crisis has paralyzed the country and brought out deep polarization, which could translate into large protests during competitions.

The opening ceremony will highlight the cloud over the country: Interim President Michel Temer will ring in the games while impeached President Dilma Rousseff, suspended for alleged fiscal irregularities in managing the budget, stays home.

Even in normal times, Brazil’s infrastructure is poor. Building collapses are frequent, clogged and pot-hole plagued streets turn traffic into parking lots, and electricity and running water are not always a given, even in rich areas.

When the Australian delegation complained last week about dangling wires, bursting toilets and gas smells in the Olympic Village, they were experiencing things that are common for Brazilians.

The April collapse of a coastal bike lane, an Olympics legacy project inaugurated with much fanfare a few months before, underscored how dangerous shoddy construction can be. Two men plunged to their death when a big wave turned a large chunk of the path into a mountain of concrete and metal.

The lane has been shut down while authorities investigate, but there’s little doubt that the engineering was deficient or the construction was faulty.

David Wallechinsky, president of the International Society of Olympic Historians, said the last-minute completion of major projects reminds him of an episode in Athens.

On the way back from watching a beach volleyball game, his wife and son got stuck in a newly built metro train. It was over 90 degrees and the doors weren’t working so several men pried them open.

When Wallechinsky looked into it he was told: “We just inaugurated it yesterday.”

Arguably the biggest fear is security. The recession has exacerbated the already precarious situation of millions who live in the city’s hundreds of slums. Armed men sometimes descend from the hills to rob tourists and more well-to-do locals.

After recent attacks in Orlando, Florida, and Nice, France, authorities have gone on the offensive, arresting more than a dozen men who expressed allegiance to the Islamic State group, but had done almost nothing to actually plan an attack.

Soldiers wearing bullet proof vests and carrying automatic weapons have blanketed the airports, malls and tourist areas.

Authorities say 85,000 soldiers and police will be on hand during the games, roughly twice the number on hand in London.

“I understand that people are concerned about security,” said Alexandre Braga, chief of the city’s tourist police unit. “But I don’t think there will be any major problems in Rio.”