Skip to content

Conversation

@cyriltovena
Copy link
Contributor

Since #1727 ARM build fails with an error:

# github.com/cortexproject/cortex/pkg/ring/kv/memberlist
--
130 | vendor/github.com/cortexproject/cortex/pkg/ring/kv/memberlist/memberlist_client.go:619:21: constant 4294967295 overflows int

see grpc/grpc-go#1471, it seems that this is cause by missing int conversion with MaxUint32.

I also run all tests GOARCH=386 make test all good now.

see grpc/grpc-go#1471

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
@bboreham
Copy link
Contributor

This test is now a no-op on a 32-bit platform: it can never be true.

I’m not immediately convinced that this is the right way to go.

@pstibrany
Copy link
Contributor

pstibrany commented Nov 15, 2019

This test is now a no-op on a 32-bit platform: it can never be true.

I’m not immediately convinced that this is the right way to go.

This is fine, because you're unlikely to have more than 4gb slice in memory on 32-bit platform, so this check will never fail. It is there only to make sure that we don't overflow 32-bit serialized value few lines below.

Copy link
Contributor

@tomwilkie tomwilkie left a comment

Choose a reason for hiding this comment

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

I'm inclined to agree with Peter on this one.

Copy link
Contributor

@gouthamve gouthamve left a comment

Choose a reason for hiding this comment

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

tbh, I am not super sure why the compilation fails and what the compiler is doing. But adding this fixes the compilation and the change doesn't doesn't seem wrong.

➜  cortex git:(release-0.4) ✗ GOARCH=386 go build ./cmd/cortex
go: downloading google.golang.org/grpc v1.25.1
go: extracting google.golang.org/grpc v1.25.1
go: finding google.golang.org/grpc v1.25.1
# github.com/cortexproject/cortex/pkg/ring/kv/memberlist
pkg/ring/kv/memberlist/memberlist_client.go:619:21: constant 4294967295 overflows int
# github.com/thanos-io/thanos/pkg/store/cache
../../../../pkg/mod/github.com/thanos-io/thanos@v0.7.0/pkg/store/cache/cache.go:166:22: constant 9223372036854775807 overflows int

But Thanos is broken as well and needs a PR upstream.

@gouthamve
Copy link
Contributor

I'm merging this as it's a Golang quirk.

@gouthamve gouthamve merged commit 06c4340 into cortexproject:master Nov 17, 2019
@pstibrany
Copy link
Contributor

bh, I am not super sure why the compilation fails and what the compiler is doing.

len function returns int, which has different size on 32-bit and 64-bit systems. We compare output of len against math.MaxUint32, which doesn't fit into 32-bit int (it would fit into uint32 though). That's why compiler complains when compiling for 32-bit systems.

Fix changes left side of comparison to uint, which makes compiler to convert math.MaxUint32 constant to uint as well, which now fits.

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.

6 participants