golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.09k stars 17.68k forks source link

x/tools/gopls: duplicate package paths in export data manifest (via telemetry) #63822

Open findleyr opened 1 year ago

findleyr commented 1 year ago
#!stacks
"bug.Reportf" && "(*typeCheckBatch).importMap.func1:+6" ||
"bug.Reportf" && "gcimporter.iimportCommon:+119"

Telemetry data at https://storage.googleapis.com/prod-telemetry-merged/2023-10-28.json clearly demonstrates a package that cannot be imported: there are in fact two bug reports, one each in type checking (#64235) and analysis (#64236).

Clearly some invariant is being violated. We should use the reportf callback passed into the importer to get a more accurate stack, as otherwise this is unlikely to be actionable (we can't see the error message in telemetry, which we probably didn't consider when adding this instrumentation).

Putting this in the v0.14.2 milestone as it would be nice to get to the bottom of this error. I'll push down the instrumentation.

CC @adonovan

Dups: BQtcLQ m5UK3A W_lHAg du4kbA PDrh5Q jZbDKQ 4elxTA JhOH0g oat8ig wr44gQ 6j0bvA 9wAdDQ 6LjVfg A3ISjw nJQxXw tQYZmg vx_wYg BQtcJQ WpB6LA WzmCgg DetyaA yimcvw y4xHuQ 0JP54Q -trCvQ fuzfjQ w2_GEQ 3_R2tA 3_R2vA iBh0rw m44AmQ CYJxZw WUTC9w nPNE0A 5I0Kxw kVgEzw

Dups for which I can't be bothered to include the stack: rPGxIQ _ZJXvw VJTMTw hCJB7Q 1xF43w nPNE0A m9MmHA SQT0sg TwtkSg Dups: BWn-Aw 8nKERA YQKCXA xOe7BQ y7CqCA 3ue-nQ cYxHdQ PQst8g Jm14RQ eFV2uQ cIxFiw lZ85Ug ovScmQ eZ-Gkw h1dggQ hViEvg DUHIGA zw0_tw

adonovan commented 3 weeks ago

This stack h1dggQ was reported by telemetry:

adonovan commented 2 weeks ago

This stack hViEvg was reported by telemetry:

adonovan commented 1 week ago

This stack DUHIGA was reported by telemetry:

adonovan commented 1 week ago

This stack zw0_tw was reported by telemetry:

findleyr commented 1 day ago

I believe I know what this may be, having been looking more closely at our loading logic.

I think this can happen when there are on-disk file changes that gopls does not observe, and one branch of the package tree is invalidated while the other isn't.

I also have an idea for a fix. Will try to get this in for v0.17.0.

gopherbot commented 16 hours ago

Change https://go.dev/cl/628495 mentions this issue: gopls/internal/cache: refine bug reports for inconsistent dep view