Closed missionsix closed 5 years ago
> [unrecovered-panic] runtime.startpanic() /usr/lib/go-1.10/src/runtime/panic.go:588 (hits goroutine(34):1 total:1) (PC: 0x438cd0)
Warning: debugging optimized function
runtime.curg._panic.arg: interface {}(string) "runtime error: index out of range"
583: }
584: return nil
585: }
586:
587: //go:nosplit
=> 588: func startpanic() {
589: systemstack(startpanic_m)
590: }
591:
592: //go:nosplit
593: func dopanic(unused int) {
(dlv) frame 3
> [unrecovered-panic] runtime.startpanic() /usr/lib/go-1.10/src/runtime/panic.go:588 (hits goroutine(34):1 total:1) (PC: 0x438cd0)
Warning: debugging optimized function
Frame 3: ./go/src/github.com/google/btree/btree.go:524 (PC: 4c58ef)
519: }
520: hit = true
521: if stop != nil && !n.items[i].Less(stop) {
522: return hit, false
523: }
=> 524: if !iter(n.items[i]) {
525: return hit, false
526: }
527: }
528: if len(n.children) > 0 {
529: if hit, ok = n.children[len(n.children)-1].iterate(dir, start, stop, includeStart, hit, iter); !ok {
(dlv) p i
3
(dlv) p n
*github.com/google/btree.node {
items: github.com/google/btree.items len: 3, cap: 8, [
...,
...,
...,
],
children: github.com/google/btree.children len: 4, cap: 8, [
*(*github.com/google/btree.node)(0xc4200b0840),
*(*github.com/google/btree.node)(0xc424796840),
*(*github.com/google/btree.node)(0xc42477f340),
*(*github.com/google/btree.node)(0xc42477ecc0),
],
cow: *github.com/google/btree.copyOnWriteContext {
freelist: *(*github.com/google/btree.FreeList)(0xc42012e000),},}
(dlv) p n.items
github.com/google/btree.items len: 3, cap: 8, [
*main.commitItem {
Commit: *(*gopkg.in/libgit2/git2go%2ev26.Commit)(0xc424789580),
Order: 514673,},
*main.commitItem {
Commit: *(*gopkg.in/libgit2/git2go%2ev26.Commit)(0xc424783720),
Order: 514430,},
*main.commitItem {
Commit: *(*gopkg.in/libgit2/git2go%2ev26.Commit)(0xc42477b8c0),
Order: 514187,},
]
(dlv) p i
3
This may have been a usage error.
I was attempting to remove entries from the btree while iterating, filtering them out via processChannel
.
This isn't threadsafe?
Hey, sorry I didn't see this earlier.
You're correct in your diagnosis. The btree is safe for concurrent access if all such access is reads/iterates. However, it (including reads) must be protected externally if any writes/deletes occur.
I'm hitting a Index error using Ascend to walk the tree.
My
stage
function is puttingO(0.5M)
object pointers into theBTree
:Sketched implementation:
Any ideas?