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 a Windows crash on exit without 'quit' command #2679

Conversation

skiminki
Copy link
Contributor

There was a bug in commit d476342
(Add support for Windows large pages) that could result in trying to
free memory allocated with VirtualAlloc incorrectly with free().

Fix this by reverting the TT.resize(0) logic in the previous commit,
and instead, we'll just call aligned_ttmem_free() in
TranspositionTable::~TranspositionTable().

There was a bug in commit d476342
(Add support for Windows large pages) that could result in trying to
free memory allocated with VirtualAlloc incorrectly with free().

Fix this by reverting the TT.resize(0) logic in the previous commit,
and instead, we'll just call aligned_ttmem_free() in
TranspositionTable::~TranspositionTable().
@skiminki
Copy link
Contributor Author

Sorry about this. With this patch amended, this is how the original patch was supposed to be.

@@ -75,7 +75,7 @@ class TranspositionTable {
static_assert(sizeof(Cluster) == 32, "Unexpected Cluster size");

public:
~TranspositionTable() { free(mem); }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦

@vondele vondele added the to be merged Will be merged shortly label May 14, 2020
@vondele
Copy link
Member

vondele commented May 14, 2020

thanks for the quick analysis, looks like a clean fix. I'll merge later tonight, if there are no more remarks.

@silversolver1
Copy link

Created a compile with this fix on top. Looks good now, No crashes or errors showing up in Windows log. The 2 to 3 second hang is also gone and closing is now instantaneous (ie normal behavior) for the two methods of closing that were lagging before: Ctrl-C and "X".

The only remaining (minor) thing is that on typing command "bench", the phrase "info string Hash table allocation: Windows large pages not used." is printed out twice, in addition to it initially printing out once when the executable is first started, so a total of three times. This also seems to happen with the initial Large Pages commit so it isn't something new introduced by the fix. Not sure if this is expected behavior or not but either way it doesn't seem to impact the functionality. So, looks good to me too, thanks :)

@vondele
Copy link
Member

vondele commented May 14, 2020

The printing is more or less expected behavior, just reflects how often we allocate. Shouldn't be changed in the current PR.

@vondele vondele closed this in beb327f May 14, 2020
@vondele
Copy link
Member

vondele commented May 14, 2020

Thanks for fixing things quickly!

@skiminki skiminki deleted the windows-large-pages-crash-fix branch June 13, 2020 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to be merged Will be merged shortly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants