-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/tools/gopls: out-of-bounds slice panic in bug in frob.(*reader).bytes #71244
Comments
If the line number is accurate, the Looking at the disassembly, the check whose failure calls panicSliceACap is the very first thing the function does after its prolog:
This implicates the first slice operation---and means the line number is indeed off by one. In any case, the frob decoder is clearly being fed an illegal short message that doesn't even contain the 4-byte magic number. |
This looks like a consequence of execution continuing after the failed bug.Reportf in typerefData: // typerefData retrieves encoded typeref data from the filecache, or computes it on
// a cache miss.
func (s *Snapshot) typerefData(ctx context.Context, id PackageID, imports map[ImportPath]*metadata.Package, cgfs []file.Handle) ([]byte, error) {
key := typerefsKey(id, imports, cgfs)
if data, err := filecache.Get(typerefsKind, key); err == nil {
return data, nil
} else if err != filecache.ErrNotFound {
bug.Reportf("internal error reading typerefs data: %v", err) /// <-- should return an error
}
... The bug.Reportf should be turned into [Edit: nope, the code here looks fine. An unexpected error is just a cache miss. The problem must come either from Get returning a tiny or empty file and no error.] |
Change https://go.dev/cl/642435 mentions this issue: |
This is a really weird one. What we know:
The only explanations I can think of are:
What am I missing? |
Also, add justification for fall through. Updates golang/go#71244 Change-Id: I781d015a9d4659815588e95dea92eb350388b925 Reviewed-on: https://go-review.googlesource.com/c/tools/+/642435 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Skimming EDIT: err, I suppose the order of deletion doesn't really matter: the fact is we could try to read a content file concurrent with another process GCing that file. EDIT2: nevermind, we'd fail the hash comparison, of course. OK, I agree that I don't understand this. |
Issue created by stacks.
This stack
MZjt-Q
was reported by telemetry:crash/crash
runtime.gopanic:+69
golang.org/x/tools/gopls/internal/cache.assert:=10
golang.org/x/tools/gopls/internal/cache.(*packageHandleBuilder).evaluatePackageHandle.func1:+2
runtime.gopanic:+50
runtime.goPanicSliceAcap:+2
golang.org/x/tools/gopls/internal/util/frob.(*reader).bytes:=392
golang.org/x/tools/gopls/internal/util/frob.(*frob).Decode:+6
golang.org/x/tools/gopls/internal/util/frob.Codec[...].Decode:=53
golang.org/x/tools/gopls/internal/cache/typerefs.decode:+2
golang.org/x/tools/gopls/internal/cache/typerefs.Decode:=42
golang.org/x/tools/gopls/internal/cache.(*Snapshot).typerefs:+12
golang.org/x/tools/gopls/internal/cache.(*packageHandleBuilder).evaluatePackageHandle:+53
golang.org/x/tools/gopls/internal/cache.(*Snapshot).getPackageHandles.func2.1:+8
golang.org/x/sync/errgroup.(*Group).Go.func1:+3
runtime.goexit:+0
The text was updated successfully, but these errors were encountered: