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

unaligned 64-bit atomic operation on i386 #2873

Closed
gibmat opened this issue Apr 25, 2024 · 4 comments · Fixed by #2874
Closed

unaligned 64-bit atomic operation on i386 #2873

gibmat opened this issue Apr 25, 2024 · 4 comments · Fixed by #2874
Assignees

Comments

@gibmat
Copy link

gibmat commented Apr 25, 2024

Description

I've recently packaged this library for Debian, as it is required to upgrade another library. When the tests were run on a 32bit system (i386), the following panic is reported:

=== RUN   TestConsumerHandlesExpectationsPausingResuming
    consumer.go:284: Expectations set on other/0, but no partition consumer was started.
    consumer.go:284: Expectations set on test/1, but no partition consumer was started.
    consumer.go:284: Expectations set on test/0, but no partition consumer was started.
--- FAIL: TestConsumerHandlesExpectationsPausingResuming (0.00s)
panic: unaligned 64-bit atomic operation [recovered]
	panic: unaligned 64-bit atomic operation

goroutine 49 [running]:
testing.tRunner.func1.2({0x81c13e0, 0x822cc58})
	/usr/lib/go-1.22/src/testing/testing.go:1631 +0x2a3
testing.tRunner.func1()
	/usr/lib/go-1.22/src/testing/testing.go:1634 +0x434
panic({0x81c13e0, 0x822cc58})
	/usr/lib/go-1.22/src/runtime/panic.go:770 +0x103
runtime/internal/atomic.panicUnaligned()
	/usr/lib/go-1.22/src/runtime/internal/atomic/unaligned.go:8 +0x2d
runtime/internal/atomic.Xadd64(0xa49e944, 0x1)
	/usr/lib/go-1.22/src/runtime/internal/atomic/atomic_386.s:125 +0x11
github.com/IBM/sarama/mocks.(*PartitionConsumer).YieldMessage(0xa49e910, 0xa4c8ea0)
	/tmp/autopkgtest-lxc.3ncu_7nv/downtmp/autopkgtest_tmp/_build/src/github.com/IBM/sarama/mocks/consumer.go:400 +0xcb
github.com/IBM/sarama/mocks.TestConsumerHandlesExpectationsPausingResuming(0xa4eec08)
	/tmp/autopkgtest-lxc.3ncu_7nv/downtmp/autopkgtest_tmp/_build/src/github.com/IBM/sarama/mocks/consumer_test.go:82 +0x1e2
testing.tRunner(0xa4eec08, 0x81ff324)
	/usr/lib/go-1.22/src/testing/testing.go:1689 +0x125
created by testing.(*T).Run in goroutine 1
	/usr/lib/go-1.22/src/testing/testing.go:1742 +0x3b9
FAIL	github.com/IBM/sarama/mocks	0.008s
Versions
Sarama Kafka Go
1.43.0 and 1.43.1 N/A 1.22.2
Configuration

Debian sid, with go 1.22.2 on an i386 system (both the auto test builder and a local container where I reproduced the problem). I don't know if this affects armel/armhf, or if this is specific to the 32bit i386 architecture.

Logs

Full log available here.

Additional Context

I've taken a quick look for an easy fix like an unaligned struct field, but didn't see anything obvious.

@puellanivis
Copy link
Contributor

Looking at this… yeah. suppressedHighWaterMarkOffset probably needs to be moved up next to highWaterMarkOffset for the exact same reason.

There’s definitely no reason for it to be listed under the sync.Mutex as it is not being protected by it.

@dnwe dnwe self-assigned this Apr 25, 2024
@dnwe
Copy link
Collaborator

dnwe commented Apr 25, 2024

@gibmat thanks for reporting this as similar to #2337 it will effect Fargate too. Have added a fix and a simple lint check using GOARCH=i386 staticcheck which seems to catch it

@dnwe
Copy link
Collaborator

dnwe commented Apr 25, 2024

@gibmat I've pushed out a tagged release to include this fix so that hopefully you can continue your packaging efforts

Version 1.43.2 (2024-04-25)

@gibmat
Copy link
Author

gibmat commented Apr 26, 2024

Awesome, thanks for the quick response! I've just uploaded the latest release to Debian. 😄

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 a pull request may close this issue.

3 participants