Skip to content

x/tools/gopls: RenderPkgDoc crashes on go.starlark.net/starlark #67287

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

Closed
adonovan opened this issue May 10, 2024 · 3 comments
Closed

x/tools/gopls: RenderPkgDoc crashes on go.starlark.net/starlark #67287

adonovan opened this issue May 10, 2024 · 3 comments
Assignees
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

 server.go:3430: http: panic serving 127.0.0.1:54595: got invalid type, want variadic parameter with unnamed slice type or string as core type
 goroutine 6676 [running]:
 net/http.(*conn).serve.func1()
 	/Users/adonovan/w/goroot/src/net/http/server.go:1898 +0xb0
 panic({0x10504bf60?, 0x14001bc98e0?})
 	/Users/adonovan/w/goroot/src/runtime/panic.go:759 +0x124
 go/types.NewSignatureType(0x0, {0x105898240, 0x0, 0x0}, {0x105898240, 0x0, 0x0}, 0x14002b2c090, 0x14001c27170, 0x1)
 	/Users/adonovan/w/goroot/src/go/types/signature.go:57 +0x2f4
 golang.org/x/tools/gopls/internal/golang.RenderPackageDoc.func13(0x14006588f00)
 	/Users/adonovan/w/xtools/gopls/internal/golang/pkgdoc.go:493 +0x398
 golang.org/x/tools/gopls/internal/golang.RenderPackageDoc(0x14002367950, 0x14006917810, 0x140045aeaf8)
 	/Users/adonovan/w/xtools/gopls/internal/golang/pkgdoc.go:534 +0xb74
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.func6({0x1051db0b0, 0x14001dc40e0}, 0x14005714120)
 	/Users/adonovan/w/xtools/gopls/internal/server/server.go:351 +0x2dc
 net/http.HandlerFunc.ServeHTTP(0x0?, {0x1051db0b0?, 0x14001dc40e0?}, 0x5?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.StripPrefix.func9({0x1051db0b0, 0x14001dc40e0}, 0x14005714000)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2226 +0x228
 net/http.HandlerFunc.ServeHTTP(0x14001db29a0?, {0x1051db0b0?, 0x14001dc40e0?}, 0x104cb14bc?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 net/http.(*ServeMux).ServeHTTP(0x0?, {0x1051db0b0, 0x14001dc40e0}, 0x14005714000)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2700 +0x1a4
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.StripPrefix.func7({0x1051db0b0, 0x14001dc40e0}, 0x14000001b00)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2226 +0x228
 net/http.HandlerFunc.ServeHTTP(0x0?, {0x1051db0b0?, 0x14001dc40e0?}, 0x10?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.withPanicHandler.func8({0x1051db0b0?, 0x14001dc40e0?}, 0x140037c9b48?)
 	/Users/adonovan/w/xtools/gopls/internal/server/server.go:412 +0x74
 net/http.HandlerFunc.ServeHTTP(0x14001db28c0?, {0x1051db0b0?, 0x14001dc40e0?}, 0x1046d0db4?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 net/http.(*ServeMux).ServeHTTP(0x0?, {0x1051db0b0, 0x14001dc40e0}, 0x14000001b00)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2700 +0x1a4
 net/http.serverHandler.ServeHTTP({0x1400222e420?}, {0x1051db0b0?, 0x14001dc40e0?}, 0x6?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:3154 +0xbc
 net/http.(*conn).serve(0x1400226c090, {0x1051dbd28, 0x14001e946c0})
 	/Users/adonovan/w/goroot/src/net/http/server.go:2042 +0x4fc
 created by net/http.(*Server).Serve in goroutine 3248
 	/Users/adonovan/w/goroot/src/net/http/server.go:3302 +0x3dc
 server.go:3430: http: panic serving 127.0.0.1:54599: got invalid type, want variadic parameter with unnamed slice type or string as core type
 goroutine 6857 [running]:
 net/http.(*conn).serve.func1()
 	/Users/adonovan/w/goroot/src/net/http/server.go:1898 +0xb0
 panic({0x10504bf60?, 0x1400425baa0?})
 	/Users/adonovan/w/goroot/src/runtime/panic.go:759 +0x124
 go/types.NewSignatureType(0x0, {0x105898240, 0x0, 0x0}, {0x105898240, 0x0, 0x0}, 0x140070cb248, 0x14001c27170, 0x1)
 	/Users/adonovan/w/goroot/src/go/types/signature.go:57 +0x2f4
 golang.org/x/tools/gopls/internal/golang.RenderPackageDoc.func13(0x14006588f00)
 	/Users/adonovan/w/xtools/gopls/internal/golang/pkgdoc.go:493 +0x398
 golang.org/x/tools/gopls/internal/golang.RenderPackageDoc(0x14002367950, 0x14000135810, 0x14005b8e3f0)
 	/Users/adonovan/w/xtools/gopls/internal/golang/pkgdoc.go:534 +0xb74
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.func6({0x1051db0b0, 0x140019f4380}, 0x14005888480)
 	/Users/adonovan/w/xtools/gopls/internal/server/server.go:351 +0x2dc
 net/http.HandlerFunc.ServeHTTP(0x0?, {0x1051db0b0?, 0x140019f4380?}, 0x5?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.StripPrefix.func9({0x1051db0b0, 0x140019f4380}, 0x14005888360)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2226 +0x228
 net/http.HandlerFunc.ServeHTTP(0x14001db29a0?, {0x1051db0b0?, 0x140019f4380?}, 0x104cb14bc?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 net/http.(*ServeMux).ServeHTTP(0x0?, {0x1051db0b0, 0x140019f4380}, 0x14005888360)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2700 +0x1a4
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.StripPrefix.func7({0x1051db0b0, 0x140019f4380}, 0x14005888240)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2226 +0x228
 net/http.HandlerFunc.ServeHTTP(0x0?, {0x1051db0b0?, 0x140019f4380?}, 0x10?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.withPanicHandler.func8({0x1051db0b0?, 0x140019f4380?}, 0x14003340b48?)
 	/Users/adonovan/w/xtools/gopls/internal/server/server.go:412 +0x74
 net/http.HandlerFunc.ServeHTTP(0x14001db28c0?, {0x1051db0b0?, 0x140019f4380?}, 0x1046d0db4?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 net/http.(*ServeMux).ServeHTTP(0x0?, {0x1051db0b0, 0x140019f4380}, 0x14005888240)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2700 +0x1a4
 net/http.serverHandler.ServeHTTP({0x14005c96c00?}, {0x1051db0b0?, 0x140019f4380?}, 0x6?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:3154 +0xbc
 net/http.(*conn).serve(0x14000286a20, {0x1051dbd28, 0x14001e946c0})
 	/Users/adonovan/w/goroot/src/net/http/server.go:2042 +0x4fc
 created by net/http.(*Server).Serve in goroutine 3248
 	/Users/adonovan/w/goroot/src/net/http/server.go:3302 +0x3dc
 server.go:3430: http: panic serving 127.0.0.1:54609: got invalid type, want variadic parameter with unnamed slice type or string as core type
 goroutine 6888 [running]:
 net/http.(*conn).serve.func1()
 	/Users/adonovan/w/goroot/src/net/http/server.go:1898 +0xb0
 panic({0x10504bf60?, 0x1400857e530?})
 	/Users/adonovan/w/goroot/src/runtime/panic.go:759 +0x124
 go/types.NewSignatureType(0x0, {0x105898240, 0x0, 0x0}, {0x105898240, 0x0, 0x0}, 0x140030e31a0, 0x14001c27170, 0x1)
 	/Users/adonovan/w/goroot/src/go/types/signature.go:57 +0x2f4
 golang.org/x/tools/gopls/internal/golang.RenderPackageDoc.func13(0x14006588f00)
 	/Users/adonovan/w/xtools/gopls/internal/golang/pkgdoc.go:493 +0x398
 golang.org/x/tools/gopls/internal/golang.RenderPackageDoc(0x14002367950, 0x1400691b810, 0x14003ed0a50)
 	/Users/adonovan/w/xtools/gopls/internal/golang/pkgdoc.go:534 +0xb74
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.func6({0x1051db0b0, 0x14001db22a0}, 0x14002d32240)
 	/Users/adonovan/w/xtools/gopls/internal/server/server.go:351 +0x2dc
 net/http.HandlerFunc.ServeHTTP(0x0?, {0x1051db0b0?, 0x14001db22a0?}, 0x5?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.StripPrefix.func9({0x1051db0b0, 0x14001db22a0}, 0x14002d32120)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2226 +0x228
 net/http.HandlerFunc.ServeHTTP(0x14001db29a0?, {0x1051db0b0?, 0x14001db22a0?}, 0x104cb14bc?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 net/http.(*ServeMux).ServeHTTP(0x0?, {0x1051db0b0, 0x14001db22a0}, 0x14002d32120)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2700 +0x1a4
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.StripPrefix.func7({0x1051db0b0, 0x14001db22a0}, 0x14002d32000)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2226 +0x228
 net/http.HandlerFunc.ServeHTTP(0x0?, {0x1051db0b0?, 0x14001db22a0?}, 0x10?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.withPanicHandler.func8({0x1051db0b0?, 0x14001db22a0?}, 0x1400352cb48?)
 	/Users/adonovan/w/xtools/gopls/internal/server/server.go:412 +0x74
 net/http.HandlerFunc.ServeHTTP(0x14001db28c0?, {0x1051db0b0?, 0x14001db22a0?}, 0x1046d0db4?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 net/http.(*ServeMux).ServeHTTP(0x0?, {0x1051db0b0, 0x14001db22a0}, 0x14002d32000)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2700 +0x1a4
 net/http.serverHandler.ServeHTTP({0x14002076f60?}, {0x1051db0b0?, 0x14001db22a0?}, 0x6?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:3154 +0xbc
 net/http.(*conn).serve(0x14003930000, {0x1051dbd28, 0x14001e946c0})
 	/Users/adonovan/w/goroot/src/net/http/server.go:2042 +0x4fc
 created by net/http.(*Server).Serve in goroutine 3248
 	/Users/adonovan/w/goroot/src/net/http/server.go:3302 +0x3dc
 server.go:3430: http: panic serving 127.0.0.1:54622: got invalid type, want variadic parameter with unnamed slice type or string as core type
 goroutine 6949 [running]:
 net/http.(*conn).serve.func1()
 	/Users/adonovan/w/goroot/src/net/http/server.go:1898 +0xb0
 panic({0x10504bf60?, 0x14001a8bc90?})
 	/Users/adonovan/w/goroot/src/runtime/panic.go:759 +0x124
 go/types.NewSignatureType(0x0, {0x105898240, 0x0, 0x0}, {0x105898240, 0x0, 0x0}, 0x140030e2c90, 0x14001c27170, 0x1)
 	/Users/adonovan/w/goroot/src/go/types/signature.go:57 +0x2f4
 golang.org/x/tools/gopls/internal/golang.RenderPackageDoc.func13(0x14006588f00)
 	/Users/adonovan/w/xtools/gopls/internal/golang/pkgdoc.go:493 +0x398
 golang.org/x/tools/gopls/internal/golang.RenderPackageDoc(0x14002367950, 0x14000135810, 0x1400040b908)
 	/Users/adonovan/w/xtools/gopls/internal/golang/pkgdoc.go:534 +0xb74
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.func6({0x1051db0b0, 0x14001db22a0}, 0x14002d32240)
 	/Users/adonovan/w/xtools/gopls/internal/server/server.go:351 +0x2dc
 net/http.HandlerFunc.ServeHTTP(0x0?, {0x1051db0b0?, 0x14001db22a0?}, 0x5?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.StripPrefix.func9({0x1051db0b0, 0x14001db22a0}, 0x14002d32120)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2226 +0x228
 net/http.HandlerFunc.ServeHTTP(0x14001db29a0?, {0x1051db0b0?, 0x14001db22a0?}, 0x104cb14bc?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 net/http.(*ServeMux).ServeHTTP(0x0?, {0x1051db0b0, 0x14001db22a0}, 0x14002d32120)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2700 +0x1a4
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.StripPrefix.func7({0x1051db0b0, 0x14001db22a0}, 0x14002d32000)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2226 +0x228
 net/http.HandlerFunc.ServeHTTP(0x0?, {0x1051db0b0?, 0x14001db22a0?}, 0x10?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 golang.org/x/tools/gopls/internal/server.(*server).initWeb.withPanicHandler.func8({0x1051db0b0?, 0x14001db22a0?}, 0x14003340b48?)
 	/Users/adonovan/w/xtools/gopls/internal/server/server.go:412 +0x74
 net/http.HandlerFunc.ServeHTTP(0x14001db28c0?, {0x1051db0b0?, 0x14001db22a0?}, 0x1046d0db4?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2169 +0x38
 net/http.(*ServeMux).ServeHTTP(0x0?, {0x1051db0b0, 0x14001db22a0}, 0x14002d32000)
 	/Users/adonovan/w/goroot/src/net/http/server.go:2700 +0x1a4
 net/http.serverHandler.ServeHTTP({0x14000279c80?}, {0x1051db0b0?, 0x14001db22a0?}, 0x6?)
 	/Users/adonovan/w/goroot/src/net/http/server.go:3154 +0xbc
 net/http.(*conn).serve(0x14000286240, {0x1051dbd28, 0x14001e946c0})
 	/Users/adonovan/w/goroot/src/net/http/server.go:2042 +0x4fc
 created by net/http.(*Server).Serve in goroutine 3248
 	/Users/adonovan/w/goroot/src/net/http/server.go:3302 +0x3dc
@adonovan adonovan self-assigned this May 10, 2024
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels May 10, 2024
@gopherbot gopherbot added this to the Unreleased milestone May 10, 2024
@adonovan
Copy link
Member Author

The cause is that truncation of long parameter lists should remove the "variadic" flag (otherwise NewSignatureType will panic). Fix pending.

@adonovan adonovan modified the milestones: Unreleased, gopls/v0.16.0 May 10, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/584405 mentions this issue: gopls/internal/golang: RenderPackageDoc: fix param truncation crash

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/584406 mentions this issue: gopls/internal/golang: fix another crash in RenderPackageDoc

gopherbot pushed a commit to golang/tools that referenced this issue May 10, 2024
..also in the call to NewSignatureType (like golang/go#67287).
This time it was caused by mutation of TypeParams,
and an overly assertive check that they are new,
so now we clone them.

Fixes golang/go#67294

Change-Id: Id9e0af4b90a0da41efac9be98365d036d78a2c55
Reviewed-on: https://go-review.googlesource.com/c/tools/+/584406
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
@golang golang locked and limited conversation to collaborators May 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

2 participants