Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix misc errors that show up in the logs #830

Merged
merged 8 commits into from
Sep 18, 2021

Conversation

Askaholic
Copy link
Collaborator

  • Better logging of errors with reported JsonStats
  • Error handling if hydra jwk endpoint is unreachable
  • Better handling of game timeout
  • Fix error in deadlock_retry_execute exception handler

@codecov
Copy link

codecov bot commented Sep 3, 2021

Codecov Report

Merging #830 (587061d) into develop (f2e70b6) will increase coverage by 0.00%.
The diff coverage is 86.79%.

Impacted Files Coverage Δ
server/stats/game_stats_service.py 96.68% <50.00%> (-1.62%) ⬇️
server/oauth_service.py 93.33% <86.95%> (-6.67%) ⬇️
server/db/__init__.py 90.62% <100.00%> (+16.43%) ⬆️
server/gameconnection.py 94.48% <100.00%> (+0.13%) ⬆️
server/games/game.py 95.69% <100.00%> (-0.04%) ⬇️
server/ladder_service.py 98.29% <100.00%> (+0.01%) ⬆️
server/matchmaker/pop_timer.py 100.00% <100.00%> (ø)
server/timing/timer.py 79.36% <0.00%> (+1.58%) ⬆️

@Askaholic Askaholic force-pushed the fix-log-errors branch 2 times, most recently from 05266d8 to f9a1982 Compare September 6, 2021 18:48
@@ -269,17 +265,16 @@ def get_team_sets(self) -> List[Set[Player]]:

async def wait_hosted(self, timeout: float):
return await asyncio.wait_for(
asyncio.shield(self._is_hosted),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to keep the call to shield

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it and it doesn't seem to matter. I think I added shield before because it prevented some exception from showing up in the logs when the server was shutting down, but that doesn't seem to happen with events.

Comment on lines +60 to +61
error_text = str(e)
if any(msg in error_text for msg in (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, what's more advantageous about using str(e) over referencing the error message directly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't throw an attribute error xD. I think str(e) is the only standard way to get the error message from an exception, exceptions don't have a message attribute.

self._logger.warning(
"Malformed game stats reported by %s: '...%s'",
self._player.login,
stats[-20:]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm obviously not familiar with this codebase, but stats[-20:] seem quite ambiguous. What is special about the last 20 elements of this object? Maybe some comments would be useful here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just that when these errors happens, it seems like it's always due to truncated data. Having the last few characters just lets you confirm that by seeing if the json structure is terminated or not.

)
return

self._logger.info("Launching game %s", self.game)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think including which player is launching the game could be useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's always the host, and the host is included in the string representation of self.game

server/ladder_service.py Outdated Show resolved Hide resolved
Copy link

@Wesmania Wesmania left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks alright to me.

@Askaholic Askaholic merged commit 5cb90fa into FAForever:develop Sep 18, 2021
@Askaholic Askaholic deleted the fix-log-errors branch September 18, 2021 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants