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: converted pointer straddles multiple allocations #391

Closed
ahrtr opened this issue Jan 25, 2023 · 2 comments
Closed
Assignees
Labels

Comments

@ahrtr
Copy link
Member

ahrtr commented Jan 25, 2023

$ go test -run TestFindPathsToKey -race -v
=== RUN   TestFindPathsToKey
    btesting.go:42: Opening bbolt DB at: /var/folders/n9/qhsds19d75x16c351t6tzhfc0000gp/T/TestFindPathsToKey2933362473/001/db
    btesting.go:81: Closing bbolt DB at: /var/folders/n9/qhsds19d75x16c351t6tzhfc0000gp/T/TestFindPathsToKey2933362473/001/db
fatal error: checkptr: converted pointer straddles multiple allocations

goroutine 4 [running]:
runtime.throw({0x1342042?, 0x11d3dbb?})
	/Users/wachao/software/go/src/runtime/panic.go:1047 +0x5d fp=0xc000125ad0 sp=0xc000125aa0 pc=0x1089f5d
runtime.checkptrAlignment(0xc000257000?, 0xc000125c10?, 0xc0000140c0?)
	/Users/wachao/software/go/src/runtime/checkptr.go:26 +0x6c fp=0xc000125af0 sp=0xc000125ad0 pc=0x1059aec
go.etcd.io/bbolt/internal/guts_cli.(*Page).LeafPageElement(...)
	/Users/wachao/go/src/github.com/ahrtr/bbolt/internal/guts_cli/guts_cli.go:176
go.etcd.io/bbolt/internal/surgeon.XRay.FindPathsToKey.func1(0xc000257000, {0xc000242a68, 0x1, 0x0?})
	/Users/wachao/go/src/github.com/ahrtr/bbolt/internal/surgeon/xray.go:87 +0xf0 fp=0xc000125b90 sp=0xc000125af0 pc=0x11d4d50
go.etcd.io/bbolt/internal/surgeon.XRay.traverse({{0xc00007a4e0?, 0x54?}}, {0xc000242a68, 0x1, 0x1}, 0xc000125d78)
	/Users/wachao/go/src/github.com/ahrtr/bbolt/internal/surgeon/xray.go:28 +0x21b fp=0xc000125cf0 sp=0xc000125b90 pc=0x11d3dbb
go.etcd.io/bbolt/internal/surgeon.XRay.FindPathsToKey({{0xc00007a4e0?, 0xc000150820?}}, {0xc000125e00, 0x4, 0x4})
	/Users/wachao/go/src/github.com/ahrtr/bbolt/internal/surgeon/xray.go:83 +0x13b fp=0xc000125db0 sp=0xc000125cf0 pc=0x11d4b5b
go.etcd.io/bbolt/internal/surgeon_test.TestFindPathsToKey(0x0?)
	/Users/wachao/go/src/github.com/ahrtr/bbolt/internal/surgeon/xray_test.go:26 +0x150 fp=0xc000125ea8 sp=0xc000125db0 pc=0x12d65f0
testing.tRunner(0xc000150820, 0x135e7e8)
	/Users/wachao/software/go/src/testing/testing.go:1446 +0x217 fp=0xc000125fb0 sp=0xc000125ea8 pc=0x1165137
testing.(*T).Run.func1()
	/Users/wachao/software/go/src/testing/testing.go:1493 +0x48 fp=0xc000125fe0 sp=0xc000125fb0 pc=0x1166968
runtime.goexit()
	/Users/wachao/software/go/src/runtime/asm_amd64.s:1594 +0x1 fp=0xc000125fe8 sp=0xc000125fe0 pc=0x10bee41
created by testing.(*T).Run
	/Users/wachao/software/go/src/testing/testing.go:1493 +0x75e

goroutine 1 [chan receive]:
runtime.gopark(0x10054b0?, 0x0?, 0x0?, 0x0?, 0xc0000122b8?)
	/Users/wachao/software/go/src/runtime/proc.go:363 +0xd6 fp=0xc000147750 sp=0xc000147730 pc=0x108cb36
runtime.chanrecv(0xc00016c3f0, 0xc00014784f, 0x1)
	/Users/wachao/software/go/src/runtime/chan.go:583 +0x42c fp=0xc0001477e0 sp=0xc000147750 pc=0x10592cc
runtime.chanrecv1(0xc00007d3e0?, 0x1337bd5?)
	/Users/wachao/software/go/src/runtime/chan.go:442 +0x18 fp=0xc000147808 sp=0xc0001477e0 pc=0x1058e38
testing.(*T).Run(0xc000150680, {0x1337bd5, 0x12}, 0x135e7e8)
	/Users/wachao/software/go/src/testing/testing.go:1494 +0x789 fp=0xc000147920 sp=0xc000147808 pc=0x1166869
testing.runTests.func1(0x0?)
	/Users/wachao/software/go/src/testing/testing.go:1846 +0x9a fp=0xc000147978 sp=0xc000147920 pc=0x1169e5a
testing.tRunner(0xc000150680, 0xc000147ba0)
	/Users/wachao/software/go/src/testing/testing.go:1446 +0x217 fp=0xc000147a80 sp=0xc000147978 pc=0x1165137
testing.runTests(0xc000001220?, {0x150c680, 0x3, 0x3}, {0x40?, 0x2568a08?, 0x1512b80?})
	/Users/wachao/software/go/src/testing/testing.go:1844 +0x7ed fp=0xc000147bd0 sp=0xc000147a80 pc=0x1169cad
testing.(*M).Run(0xc000001220)
	/Users/wachao/software/go/src/testing/testing.go:1726 +0xa85 fp=0xc000147ed8 sp=0xc000147bd0 pc=0x1167825
main.main()
	_testmain.go:53 +0x2ea fp=0xc000147f80 sp=0xc000147ed8 pc=0x12d77aa
runtime.main()
	/Users/wachao/software/go/src/runtime/proc.go:250 +0x212 fp=0xc000147fe0 sp=0xc000147f80 pc=0x108c772
runtime.goexit()
	/Users/wachao/software/go/src/runtime/asm_amd64.s:1594 +0x1 fp=0xc000147fe8 sp=0xc000147fe0 pc=0x10bee41

goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/Users/wachao/software/go/src/runtime/proc.go:363 +0xd6 fp=0xc000058fb0 sp=0xc000058f90 pc=0x108cb36
runtime.goparkunlock(...)
	/Users/wachao/software/go/src/runtime/proc.go:369
runtime.forcegchelper()
	/Users/wachao/software/go/src/runtime/proc.go:302 +0xad fp=0xc000058fe0 sp=0xc000058fb0 pc=0x108c9cd
runtime.goexit()
	/Users/wachao/software/go/src/runtime/asm_amd64.s:1594 +0x1 fp=0xc000058fe8 sp=0xc000058fe0 pc=0x10bee41
created by runtime.init.6
	/Users/wachao/software/go/src/runtime/proc.go:290 +0x25

goroutine 18 [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/Users/wachao/software/go/src/runtime/proc.go:363 +0xd6 fp=0xc000054790 sp=0xc000054770 pc=0x108cb36
runtime.goparkunlock(...)
	/Users/wachao/software/go/src/runtime/proc.go:369
runtime.bgsweep(0x0?)
	/Users/wachao/software/go/src/runtime/mgcsweep.go:278 +0x8e fp=0xc0000547c8 sp=0xc000054790 pc=0x1077a0e
runtime.gcenable.func1()
	/Users/wachao/software/go/src/runtime/mgc.go:178 +0x26 fp=0xc0000547e0 sp=0xc0000547c8 pc=0x106c6e6
runtime.goexit()
	/Users/wachao/software/go/src/runtime/asm_amd64.s:1594 +0x1 fp=0xc0000547e8 sp=0xc0000547e0 pc=0x10bee41
created by runtime.gcenable
	/Users/wachao/software/go/src/runtime/mgc.go:178 +0x6b

goroutine 19 [GC scavenge wait]:
runtime.gopark(0xc000096000?, 0x13a4fd8?, 0x1?, 0x0?, 0x0?)
	/Users/wachao/software/go/src/runtime/proc.go:363 +0xd6 fp=0xc000054f70 sp=0xc000054f50 pc=0x108cb36
runtime.goparkunlock(...)
	/Users/wachao/software/go/src/runtime/proc.go:369
runtime.(*scavengerState).park(0x1512c00)
	/Users/wachao/software/go/src/runtime/mgcscavenge.go:389 +0x53 fp=0xc000054fa0 sp=0xc000054f70 pc=0x1075ad3
runtime.bgscavenge(0x0?)
	/Users/wachao/software/go/src/runtime/mgcscavenge.go:617 +0x45 fp=0xc000054fc8 sp=0xc000054fa0 pc=0x1076085
runtime.gcenable.func2()
	/Users/wachao/software/go/src/runtime/mgc.go:179 +0x26 fp=0xc000054fe0 sp=0xc000054fc8 pc=0x106c686
runtime.goexit()
	/Users/wachao/software/go/src/runtime/asm_amd64.s:1594 +0x1 fp=0xc000054fe8 sp=0xc000054fe0 pc=0x10bee41
created by runtime.gcenable
	/Users/wachao/software/go/src/runtime/mgc.go:179 +0xaa

goroutine 3 [finalizer wait]:
runtime.gopark(0xc000007860?, 0x0?, 0x0?, 0x6?, 0xc000058770?)
	/Users/wachao/software/go/src/runtime/proc.go:363 +0xd6 fp=0xc000058628 sp=0xc000058608 pc=0x108cb36
runtime.goparkunlock(...)
	/Users/wachao/software/go/src/runtime/proc.go:369
runtime.runfinq()
	/Users/wachao/software/go/src/runtime/mfinal.go:180 +0x145 fp=0xc0000587e0 sp=0xc000058628 pc=0x106b805
runtime.goexit()
	/Users/wachao/software/go/src/runtime/asm_amd64.s:1594 +0x1 fp=0xc0000587e8 sp=0xc0000587e0 pc=0x10bee41
created by runtime.createfing
	/Users/wachao/software/go/src/runtime/mfinal.go:157 +0x45
exit status 2
FAIL	go.etcd.io/bbolt/internal/surgeon	1.408s

@ahrtr ahrtr added the type/bug label Jan 25, 2023
@ahrtr
Copy link
Member Author

ahrtr commented Mar 14, 2023

Resolved in #407.

Note that release-1.3 still has this issue, but no plan to resolve it for release-1.3, because

  1. It needs huge refactoring;
  2. The functionality isn't affected.

@ahrtr ahrtr closed this as completed Mar 14, 2023
missinglink pushed a commit to missinglink/bbolt that referenced this issue Dec 5, 2023
Points:
1. There are lots of duplicated definitions between bolt and
   guts_cli, which is definitely not good.
2. The implementation in guts_cli also has issue, please
   refer to etcd-io#391.
   This refactoring can fix the issue.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
roperzh added a commit to fleetdm/fleet that referenced this issue Feb 29, 2024
scheduled tests, which are run with `-race` are [failing][1], this was
fixed in the `etcd-io/bbolt` fork of the now archived `boltdb/bolt`, for
more details check [this issue][2].

since boltdb is used only for tests, and they're passing after switching
to the fork, this seems like a reasonable way to fix them.

[1]: https://github.com/fleetdm/fleet/actions/runs/8090809417
[2]: etcd-io/bbolt#391
roperzh pushed a commit to fleetdm/fleet that referenced this issue Feb 29, 2024
scheduled tests, which are run with `-race` are [failing][1], this was
fixed in the `etcd-io/bbolt` fork of the now archived `boltdb/bolt`, for
more details check [this issue][2].

since boltdb is used only for tests, and they're passing after switching
to the fork, this seems like a reasonable way to fix them.

[1]: https://github.com/fleetdm/fleet/actions/runs/8090809417
[2]: etcd-io/bbolt#391

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
passiondev2024 added a commit to passiondev2024/bbolt that referenced this issue Mar 20, 2024
Points:
1. There are lots of duplicated definitions between bolt and
   guts_cli, which is definitely not good.
2. The implementation in guts_cli also has issue, please
   refer to etcd-io/bbolt#391.
   This refactoring can fix the issue.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant