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

Fixed 64-bit alignment panic in chunkedContentCoder on 32-bit platforms. #148

Merged
merged 1 commit into from
Feb 21, 2023

Conversation

cj123
Copy link
Contributor

@cj123 cj123 commented Feb 17, 2023

Following the fix in #147, a 'panic: unaligned 64-bit atomic operation' is still occurring on some platforms.

As noted in #147, this commit implements the alternative fix by placing the bytesWritten field at the top of the struct. Per the Golang sync/atomic documentation, on ARM, 386 and 32-bit MIPS systems, this is the reliable way to prevent these issues.

Following the fix in blevesearch#147, a 'panic: unaligned 64-bit atomic operation' is
still occurring on some platforms.

As noted in blevesearch#147, this commit implements the alternative fix by placing the
bytesWritten field at the top of the struct. Per the Golang sync/atomic
documentation, on ARM, 386 and 32-bit MIPS systems, this is the reliable
way to prevent these issues.

Signed-off-by: Callum Jones <[email protected]>
Copy link
Member

@abhinavdangeti abhinavdangeti left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @cj123 . Looks good to me. Let's wait on one other review.

@abhinavdangeti abhinavdangeti merged commit 67addef into blevesearch:master Feb 21, 2023
abhinavdangeti pushed a commit that referenced this pull request Feb 3, 2025
It's the same story as per #148, but for v16.

```
panic: unaligned 64-bit atomic operation

goroutine 1 [running]:
internal/runtime/atomic.panicUnaligned()
/root/go/pkg/mod/golang.org/[email protected]/src/internal/runtime/atomic/unaligned.go:8 +0x2d
internal/runtime/atomic.Xadd64(0xa0226e4, 0x0)
/root/go/pkg/mod/golang.org/[email protected]/src/internal/runtime/atomic/atomic_386.s:125 +0x11
github.com/blevesearch/zapx/v16.(*invertedIndexOpaque).incrementBytesWritten(...)
/root/go/pkg/mod/github.com/blevesearch/zapx/[email protected]/section_inverted_text_index.go:401
github.com/blevesearch/zapx/v16.(*invertedIndexOpaque).writeDicts(0xa022608, 0xfd7efa8)
/root/go/pkg/mod/github.com/blevesearch/zapx/[email protected]/section_inverted_text_index.go:529 +0xe74
github.com/blevesearch/zapx/v16.(*invertedTextIndexSection).Persist(0x9424880, 0xfe720c0, 0xfd7efa8)
/root/go/pkg/mod/github.com/blevesearch/zapx/[email protected]/section_inverted_text_index.go:54 +0x3d
github.com/blevesearch/zapx/v16.(*interim).convert(0xfe5fc00)
/root/go/pkg/mod/github.com/blevesearch/zapx/[email protected]/new.go:220 +0x6d9
github.com/blevesearch/zapx/v16.(*ZapPlugin).newWithChunkMode(0x9424880, {0xf774008, 0x3e9, 0x3e9}, 0x402)
/root/go/pkg/mod/github.com/blevesearch/zapx/[email protected]/new.go:69 +0x194
github.com/blevesearch/zapx/v16.(*ZapPlugin).New(0x9424880, {0xf774008, 0x3e9, 0x3e9})
/root/go/pkg/mod/github.com/blevesearch/zapx/[email protected]/new.go:45 +0x43
github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).Batch(0x9fde008, 0xf6ffa90)
/root/go/pkg/mod/github.com/blevesearch/bleve/[email protected]/index/scorch/scorch.go:445 +0x63a
github.com/blevesearch/bleve/v2.(*indexImpl).Batch(0x9c98500, 0xf6bf680)
/root/go/pkg/mod/github.com/blevesearch/bleve/[email protected]/index_impl.go:316 +0x90
```
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