A report released Thursday suggests social distancing shouldn't be the only concern as people flock to beaches this summer.

The annual analysis of water quality at the state's beaches by the group Environment Massachusetts found testing at 257 beaches last year discovered potentially unsafe levels of fecal bacteria on at least one day. That's out of 559 beaches that were tested.

Tenean Beach in Dorchester and Kings Beach in Lynn and Swampscott had the greatest number of failing tests in the state.

"Most of our beaches in Massachsuetts are safe for swimming most of the time," said Ben Hellerstein of Environment Massachusetts. "Unfortunately, all too often our beaches are plagued with pollution that can make swimmers sick."

Hellerstein said one reason for that is outdated water infrastructure. In many places, the problem comes from storm water runoff. And in19 communities in the state, sewage and storm water flow into the same pipes.

"These combined sewer systems can become overwhelmed during heavy storms discharging untreated sewage into nearby waterways," Hellerstein said.

"Collectively, we are still discharging about 3 billion gallons of untreated sewage into rivers and bays every year," Gabby Queenan of the nonprofit Massachusetts Rivers Alliance said.

It's a problem that's likely to become more common as climate change leads to more extreme precipitation events. And, Queenan said, it correlates to economic and racial disparities in the state.

"You are three times more likely to have combined sewer overflow infrastructure in your community if you're identified as an environmental justice community," Queenan said. "Which I think just points to the fact that some communities, honestly, have been left behind when it comes to having those resources to actually fix the infrastructure."

A bill currently before the state legislature would shine a light on such discharges.

"It would require the operators of combined sewage overflow systems to tell the public, to notify the public, when sewage is being dumped in the waters," said state Sen. Pat Jehlen, who is one of the authors of the bill.

"We don't like to know that it happens at all," Jehlen said. "But we should know when it does."

The U.S. House of Representatives is set to vote Friday on an$11 billion water infrastructure billthat Hellesterin says he hopes will provide funding to help fix some of Massachusetts' water quality trouble spots.

Beaches are closed to swimmers when they test above safe limits for bacteria. But Bruce Berman of the nonprofit Save the Harbor/Save the Bay said that beachgoers who see a posted flag that designates whether the water is safe to enter are not necessarily getting an accurate reflection of the current water quality. It takes a day for communities to get the those testing results, he said.

"If there's a red flag, it means it was dirty yesterday, not that it's dirty today," Berman said. "If you swim with a green flag, it means it's clean yesterday. But if there was a rainstorm last night, it might not be clean today."

Berman said communities should take this into account, and proactively close a beach after a heavy rain if that has historically caused poor water quality.