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

consensus/ethash: close mmap before rename, windows limitation #14329

Merged
merged 3 commits into from
Apr 14, 2017

Conversation

karalabe
Copy link
Member

@karalabe karalabe commented Apr 14, 2017

Our current ethash memory mapped caches generated the cache in a temp file, then renamed it into its final location. Unfortunately this is forbidden under Windows, as it's not capable of renaming open files opposed to unix systems. The PR changes the logic so that instead of flush/rename, we now do a close/rename/open cycle. It is more costly but I didn't want to add Windows specific logic so low level as ethash.

It also works around #3815 . The underlying issue there is that the mmap-go library calls flush on the memory map handle, not the file handle. This is an upstream bug, also spotted by someone else (edsrzf/mmap-go#14). However since we close the generated cache down before rename, we don't care that the Flush method doesn't work as the OS will flush it on close anyway.

@karalabe karalabe added this to the 1.6.0 milestone Apr 14, 2017
@karalabe karalabe merged commit 15f32a8 into ethereum:master Apr 14, 2017
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.

2 participants