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 possible endless loop in replay recorder while opening save file. #19209

Merged

Conversation

anvilvapre
Copy link
Contributor

Fixes #18789.

Minimal fix. To be able to close the issue. Should not occur in practice.

Throws an ArgumentException because the normal situation the filename contains a timestamp. If a file can not be created after 128+ attempt is likely indicates the filename refers to an invalid - non writable - path.

catch (IOException) { }
catch (IOException ex)
{
if (id > 128)
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add a comment explaining the significance of 128? We know right now that this is arbitrary, but looking back at this in 5 years might cause confusion over whether 128 is meaningfully different than 100 or 500.

Copy link
Contributor

Choose a reason for hiding this comment

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

Better to have it as a constant with a good name?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, but that should still have a comment explaining the motivation for its specific value (unless we want to call it const int ArbitraryRetryCount 😁 - but please don't call it that)

Copy link
Contributor

@reaperrr reaperrr left a comment

Choose a reason for hiding this comment

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

Untested, but looks fine

@teinarss teinarss merged commit 52d39db into OpenRA:bleed Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReplayRecorder, possible endless loop, hang
5 participants