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

atomic requires struct field to be 64-bit aligned #23

Merged
merged 1 commit into from
Nov 26, 2015

Conversation

tpng
Copy link
Contributor

@tpng tpng commented Nov 26, 2015

@CLAassistant
Copy link

CLA assistant check
All committers have accepted the CLA.

@mbertschler
Copy link
Collaborator

Interesting issue, thank you for the fix.

mbertschler added a commit that referenced this pull request Nov 26, 2015
atomic requires struct field to be 64-bit aligned
@mbertschler mbertschler merged commit 12fcb8c into spf13:master Nov 26, 2015
@tpng tpng deleted the patch-1 branch November 26, 2015 10:10
@moorereason
Copy link
Contributor

@tpng, I'm impressed. How in the world did you come up with that? What lead you to this solution?

@tpng
Copy link
Contributor Author

tpng commented Nov 27, 2015

@moorereason I first encountered this issue with the new v0.15 hugo using the server command and found that only the 386 version has this issue.

Then I went adding log.Print in the source code to find where hugo hang and it ends up in (*InMemoryFile).Open().

After that I try to create a repro to see how atomic failed in this case, which crash with a nil pointer error on the call to atomic.StoreInt64(&f.readDirCount, 0).

Finally a google search of golang atomic 386 amd64 ended up with a result that stated that struct field has to be 64-bit aligned and thus the fix.

@moorereason
Copy link
Contributor

That's the first time I've seen a "Bugs" section in the Go stdlib docs. The docs also say this affects non-Linux ARM platforms.

I'm not very familiar with AppVeyor, but it seems like afero could use AppVeyor to automate testing on the Windows x86 platform to catch this sneaky bug.

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.

hugo server hang for windows_386 binary
4 participants