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

Problem: worker exits from a panic when slice bounds out of range #1180

Closed
wants to merge 1 commit into from

Conversation

mmsqe
Copy link
Collaborator

@mmsqe mmsqe commented Sep 22, 2023

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

Worker exits from a panic: runtime error: slice bounds out of range [:1200] with capacity 0 Stack trace: goroutine 1892 [running]: runtime/debug.Stack() /opt/homebrew/Cellar/go/1.21.1/libexec/src/runtime/debug/stack.go:24 +0x64 github.com/alitto/pond.defaultPanicHandler({0x107639f20, 0x14005d94018}) /Users/mavis/go/pkg/mod/github.com/alitto/[email protected]/pond.go:26 +0x24 github.com/alitto/pond.(*WorkerPool).executeTask.func1() /Users/mavis/go/pkg/mod/github.com/alitto/[email protected]/pond.go:437 +0x78 panic({0x107639f20?, 0x14005d94018?}) /opt/homebrew/Cellar/go/1.21.1/libexec/src/runtime/panic.go:914 +0x218 github.com/crypto-org-chain/cronos/memiavl.Nodes.Node(...) /Users/mavis/Documents/crypto/cronos/memiavl/layout_little_endian.go:21 github.com/crypto-org-chain/cronos/memiavl.PersistedNode.branchNode(...) /Users/mavis/Documents/crypto/cronos/memiavl/persisted_node.go:54 github.com/crypto-org-chain/cronos/memiavl.PersistedNode.Left({0x14004bd4e60?, 0x14?, 0x1?}) /Users/mavis/Documents/crypto/cronos/memiavl/persisted_node.go:109 +0x12c github.com/crypto-org-chain/cronos/memiavl.(*snapshotWriter).writeRecursive(0x140039e2440, {0x1078a4760, 0x140019a4670}) /Users/mavis/Documents/crypto/cronos/memiavl/snapshot.go:555 +0x5c github.com/crypto-org-chain/cronos/memiavl.(*MultiTree).WriteSnapshot.func1.(*Tree).WriteSnapshot.func1(0x140039e2440) /Users/mavis/Documents/crypto/cronos/memiavl/snapshot.go:356 +0x30 github.com/crypto-org-chain/cronos/memiavl.writeSnapshot({0x140037ac380, 0x39}, 0x2d, 0x14005fd2e08) /Users/mavis/Documents/crypto/cronos/memiavl/snapshot.go:411 +0x474 github.com/crypto-org-chain/cronos/memiavl.(*Tree).WriteSnapshot(...) /Users/mavis/Documents/crypto/cronos/memiavl/snapshot.go:352 github.com/crypto-org-chain/cronos/memiavl.(*MultiTree).WriteSnapshot.func1() /Users/mavis/Documents/crypto/cronos/memiavl/multitree.go:371 +0x7c github.com/alitto/pond.(*TaskGroupWithContext).Submit.func1() /Users/mavis/go/pkg/mod/github.com/alitto/[email protected]/group.go:60 +0x88 github.com/alitto/pond.(*WorkerPool).executeTask(0x1400150c000, 0x1074daf40?, 0x38?) /Users/mavis/go/pkg/mod/github.com/alitto/[email protected]/pond.go:454 +0xc8 github.com/alitto/pond.worker({0x107887738, 0x14001178050}, 0x1400150c090?, 0x102be5114?, 0x140015022a0, 0x14003d6ed00) /Users/mavis/go/pkg/mod/github.com/alitto/[email protected]/worker.go:32 +0x9c created by github.com/alitto/pond.(*WorkerPool).maybeStartWorker in goroutine 1881 /Users/mavis/go/pkg/mod/github.com/alitto/[email protected]/pond.go:423 +0x154
# PR Checklist:
  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)


if offset+SizeNode > len(nodes.data) {
return NodeLayout{data: (*[SizeNode]byte)(nodes.data[offset:])}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should investigate why the caller pass an invalid index, rather than translate the error into a more obscure issue.

@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Merging #1180 (489405c) into main (506c6dd) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1180      +/-   ##
==========================================
- Coverage   34.04%   34.02%   -0.02%     
==========================================
  Files         114      114              
  Lines       11245    11251       +6     
==========================================
  Hits         3828     3828              
- Misses       7040     7044       +4     
- Partials      377      379       +2     
Files Changed Coverage Δ
memiavl/layout_little_endian.go 83.33% <0.00%> (-16.67%) ⬇️

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.

2 participants