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

fatal error: checkptr: pointer arithmetic result points to invalid allocation #758

Closed
mec07 opened this issue Nov 21, 2022 · 1 comment · Fixed by #759
Closed

fatal error: checkptr: pointer arithmetic result points to invalid allocation #758

mec07 opened this issue Nov 21, 2022 · 1 comment · Fixed by #759

Comments

@mec07
Copy link
Collaborator

mec07 commented Nov 21, 2022

Describe the bug
I’m getting a really annoying issue with using protoactor-go. Running go test -race fails for:

var system = actor.NewActorSystem()

with the error:

fatal error: checkptr: pointer arithmetic result points to invalid allocation

This is due to a known issue in the murmur3 package: spaolacci/murmur3#34.

The line in protoactor-go which is using it is: https://github.com/asynkron/protoactor-go/blob/dev/actor/process_registry.go#L35.

Some other repos have worked around this issue by using murmur3.Sum64 instead of murmur3.Sum32 e.g. rudderlabs/rudder-server#2645. Would that be an acceptable workaround?

It would be a good opportunity to add a proper go compatible tag, e.g. v0.3.0.

To Reproduce

  • Create a test file, e.g. tmp/tmp_test.go:
package tmp_test

import (
        "testing"

        "github.com/asynkron/protoactor-go/actor"
)

func TestNewActorSystem(t *testing.T) {
        _ = actor.NewActorSystem()
}
  • Then run that test with the race flag: go test -race ./tmp
  • Result:
fatal error: checkptr: pointer arithmetic result points to invalid allocation

goroutine 6 [running]:
runtime.throw({0x10063d750?, 0x100155aa0?})
	/opt/homebrew/Cellar/go/1.19.2/libexec/src/runtime/panic.go:1047 +0x40 fp=0xc000062a80 sp=0xc000062a50 pc=0x10016b230
runtime.checkptrArithmetic(0x100b4b080?, {0x0, 0x0, 0x10013e404?})
	/opt/homebrew/Cellar/go/1.19.2/libexec/src/runtime/checkptr.go:69 +0xac fp=0xc000062ab0 sp=0xc000062a80 pc=0x10013879c
github.com/spaolacci/murmur3.Sum32WithSeed({0xc000062b68, 0xa, 0x20}, 0x0)
	/Users/mec07/pkg/mod/github.com/spaolacci/[email protected]/murmur32.go:129 +0x7c fp=0xc000062b20 sp=0xc000062ab0 pc=0x1006048cc
github.com/spaolacci/murmur3.Sum32(...)
	/Users/mec07/pkg/mod/github.com/spaolacci/[email protected]/murmur32.go:111
github.com/asynkron/protoactor-go/actor.(*SliceMap).GetBucket(0xc00000eeb8, {0x10062677c, 0xa})
	/Users/mec07/pkg/mod/github.com/asynkron/[email protected]/actor/process_registry.go:35 +0x44 fp=0xc000062ba0 sp=0xc000062b20 pc=0x10061aa14
github.com/asynkron/protoactor-go/actor.(*ProcessRegistryValue).Add(0xc0001ac080, {0x1007fdc18?, 0xc0001a0018}, {0x10062677c, 0xa})
	/Users/mec07/pkg/mod/github.com/asynkron/[email protected]/actor/process_registry.go:89 +0x60 fp=0xc000062c30 sp=0xc000062ba0 pc=0x10061adb0
github.com/asynkron/protoactor-go/actor.NewDeadLetter(0xc000118140)
	/Users/mec07/pkg/mod/github.com/asynkron/[email protected]/actor/deadletter.go:28 +0x104 fp=0xc000062cc0 sp=0xc000062c30 pc=0x1006139b4
github.com/asynkron/protoactor-go/actor.NewActorSystemWithConfig(0xc000110300)
	/Users/mec07/pkg/mod/github.com/asynkron/[email protected]/actor/actor_system.go:66 +0x660 fp=0xc000062e30 sp=0xc000062cc0 pc=0x100612e40
github.com/asynkron/protoactor-go/actor.NewActorSystem({0x0, 0x0, 0x0})
	/Users/mec07/pkg/mod/github.com/asynkron/[email protected]/actor/actor_system.go:55 +0x40 fp=0xc000062e60 sp=0xc000062e30 pc=0x1006127a0
github.com/godragons/draughthublink/tmp_test.TestNewActorSystem(0x0?)
	/Users/mec07/src/github.com/GoDragons/draughthublink/tmp/temp_test.go:10 +0x30 fp=0xc000062e90 sp=0xc000062e60 pc=0x100622880
testing.tRunner(0xc000003ba0, 0x1007f7fc0)
	/opt/homebrew/Cellar/go/1.19.2/libexec/src/testing/testing.go:1446 +0x18c fp=0xc000062fa0 sp=0xc000062e90 pc=0x10027b6ac
testing.(*T).Run.func1()
	/opt/homebrew/Cellar/go/1.19.2/libexec/src/testing/testing.go:1493 +0x44 fp=0xc000062fd0 sp=0xc000062fa0 pc=0x10027c814
runtime.goexit()
	/opt/homebrew/Cellar/go/1.19.2/libexec/src/runtime/asm_arm64.s:1172 +0x4 fp=0xc000062fd0 sp=0xc000062fd0 pc=0x1001a0b44
created by testing.(*T).Run
	/opt/homebrew/Cellar/go/1.19.2/libexec/src/testing/testing.go:1493 +0x560

Expected behavior
This should not trigger an error!

@mec07
Copy link
Collaborator Author

mec07 commented Nov 22, 2022

There is a temporary workaround that you can do, until this issue is fixed. You need to make the go.mod file in your repo replace the package github.com/spaolacci/murmur3 with github.com/twmb/murmur3. You can either use the go mod edit tool like this:

go mod edit -replace github.com/spaolacci/murmur3=github.com/twmb/[email protected]
go mod tidy -compat=1.17

or you can just edit the go.mod file yourself by adding this line at the end of the file:

replace github.com/spaolacci/murmur3 => github.com/twmb/murmur3 v1.1.0

and then run:

go mod tidy -compat=1.17

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.

1 participant