puppetlabs-toy-chest / wash

Wide Area SHell: a cloud-native shell for bringing remote infrastructure to your terminal.
https://puppetlabs.github.io/wash
Apache License 2.0
180 stars 29 forks source link

`docs <root>` panics if external plugins are enabled #703

Closed ekinanp closed 4 years ago

ekinanp commented 4 years ago
wash . ❯ docs
2020/02/02 17:21:56 http: panic serving : runtime error: invalid memory address or nil pointer dereference
goroutine 456 [running]:
net/http.(*conn).serve.func1(0xc000364460)
    /usr/local/go/src/net/http/server.go:1767 +0x139
panic(0x5ca2a20, 0x765dcb0)
    /usr/local/go/src/runtime/panic.go:679 +0x1b2
github.com/emirpasic/gods/maps/linkedhashmap.(*Map).Get(...)
    /Users/enisinan/go/pkg/mod/github.com/emirpasic/gods@v1.12.0/maps/linkedhashmap/linkedhashmap.go:52
github.com/puppetlabs/wash/plugin.schema(0xb960140, 0xc000273320, 0xf, 0x0, 0xc00f6cdc50)
    /Users/enisinan/GitHub/wash/plugin/entrySchema.go:36 +0x6d1
github.com/puppetlabs/wash/plugin.Schema(0xb960140, 0xc000273320, 0xc000049a40, 0x2f, 0x0)
    /Users/enisinan/GitHub/wash/plugin/methodWrappers.go:109 +0x35
github.com/puppetlabs/wash/plugin.schema(0x64cd440, 0xc00014b500, 0x5ff0340, 0xc000332c00, 0x64979a0)
    /Users/enisinan/GitHub/wash/plugin/entrySchema.go:51 +0x274
github.com/puppetlabs/wash/plugin.Schema(0x64cd440, 0xc00014b500, 0xc0004ba380, 0x64979a0, 0xc0004ba380)
    /Users/enisinan/GitHub/wash/plugin/methodWrappers.go:109 +0x35
github.com/puppetlabs/wash/api.glob..func10(0x64dc740, 0xc0004ba380, 0xc00051c700, 0x2)
    /Users/enisinan/GitHub/wash/api/schema.go:42 +0x11b
github.com/puppetlabs/wash/api.handler.ServeHTTP(0x6170198, 0x0, 0x64dc740, 0xc0004ba380, 0xc00051c700)
    /Users/enisinan/GitHub/wash/api/server.go:58 +0x137
github.com/puppetlabs/wash/api.StartAPI.func1.1(0x64dc740, 0xc0004ba380, 0xc00051c600)
    /Users/enisinan/GitHub/wash/api/server.go:121 +0x448
net/http.HandlerFunc.ServeHTTP(0xc0004cbcc0, 0x64dc740, 0xc0004ba380, 0xc00051c600)
    /usr/local/go/src/net/http/server.go:2007 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0002e03f0, 0x64dc740, 0xc0004ba380, 0xc00051c600)
    /Users/enisinan/go/pkg/mod/github.com/gorilla/mux@v1.6.2/mux.go:162 +0x104
net/http.serverHandler.ServeHTTP(0xc00061a000, 0x64dc740, 0xc0004ba380, 0xc00051c400)
    /usr/local/go/src/net/http/server.go:2802 +0xa4
net/http.(*conn).serve(0xc000364460, 0x64e5e40, 0xc0004cb8c0)
    /usr/local/go/src/net/http/server.go:1890 +0x875
created by net/http.(*Server).Serve
    /usr/local/go/src/net/http/server.go:2927 +0x38e
2020/02/02 17:21:56 http: panic serving : runtime error: invalid memory address or nil pointer dereference
goroutine 424 [running]:
net/http.(*conn).serve.func1(0xc0002ee640)
    /usr/local/go/src/net/http/server.go:1767 +0x139
panic(0x5ca2a20, 0x765dcb0)
    /usr/local/go/src/runtime/panic.go:679 +0x1b2
github.com/emirpasic/gods/maps/linkedhashmap.(*Map).Get(...)
    /Users/enisinan/go/pkg/mod/github.com/emirpasic/gods@v1.12.0/maps/linkedhashmap/linkedhashmap.go:52
github.com/puppetlabs/wash/plugin.schema(0xb960140, 0xc000273320, 0xf, 0x0, 0xc00f81d4d0)
    /Users/enisinan/GitHub/wash/plugin/entrySchema.go:36 +0x6d1
github.com/puppetlabs/wash/plugin.Schema(0xb960140, 0xc000273320, 0xc00f7f4b40, 0x2f, 0x0)
    /Users/enisinan/GitHub/wash/plugin/methodWrappers.go:109 +0x35
github.com/puppetlabs/wash/plugin.schema(0x64cd440, 0xc00014b500, 0x5ff0340, 0xc00033da00, 0x64979a0)
    /Users/enisinan/GitHub/wash/plugin/entrySchema.go:51 +0x274
github.com/puppetlabs/wash/plugin.Schema(0x64cd440, 0xc00014b500, 0xc00061a380, 0x64979a0, 0xc00061a380)
    /Users/enisinan/GitHub/wash/plugin/methodWrappers.go:109 +0x35
github.com/puppetlabs/wash/api.glob..func10(0x64dc740, 0xc00061a380, 0xc00f74c300, 0x2)
    /Users/enisinan/GitHub/wash/api/schema.go:42 +0x11b
github.com/puppetlabs/wash/api.handler.ServeHTTP(0x6170198, 0x0, 0x64dc740, 0xc00061a380, 0xc00f74c300)
    /Users/enisinan/GitHub/wash/api/server.go:58 +0x137
github.com/puppetlabs/wash/api.StartAPI.func1.1(0x64dc740, 0xc00061a380, 0xc00f74c200)
    /Users/enisinan/GitHub/wash/api/server.go:121 +0x448
net/http.HandlerFunc.ServeHTTP(0xc00041ee40, 0x64dc740, 0xc00061a380, 0xc00f74c200)
    /usr/local/go/src/net/http/server.go:2007 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0002e03f0, 0x64dc740, 0xc00061a380, 0xc00f74c200)
    /Users/enisinan/go/pkg/mod/github.com/gorilla/mux@v1.6.2/mux.go:162 +0x104
net/http.serverHandler.ServeHTTP(0xc00061a000, 0x64dc740, 0xc00061a380, 0xc00f74c000)
    /usr/local/go/src/net/http/server.go:2802 +0xa4
net/http.(*conn).serve(0xc0002ee640, 0x64e5e40, 0xc00041ed00)
    /usr/local/go/src/net/http/server.go:1890 +0x875
created by net/http.(*Server).Serve
    /usr/local/go/src/net/http/server.go:2927 +0x38e
failed to get the schema: Get http://localhost/fs/schema?path=%2FUsers%2Fenisinan%2FLibrary%2FCaches%2Fwash%2Fmnt481821552: EOF

This only happens with external plugins. Probably due to the recent "move external plugins to a separate package" refactor.

ekinanp commented 4 years ago

Note this only happens with schema-less external plugins (like spotify). So plugins like Boltwash work fine.