trinodb / grafana-trino

The Trino datasource allows to query and visualize Trino data from within Grafana.
Apache License 2.0
35 stars 10 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #208

Closed kevinlinxc closed 1 year ago

kevinlinxc commented 1 year ago

When I try to add a Trino datasource, Grafana UI tells me "An error occurred within the plugin" and I see this stack trace in the grafana-server.exe terminal (with GF_LOG_LEVEL=debug). I removed the timestamp and logging level to make it more readable.

 level=info msg="Loading Trino data source settings"
  msg="panic: runtime error: invalid memory address or nil pointer dereference"
  msg="[signal 0xc0000005 code=0x0 addr=0x18 pc=0x128da22]"
  msg=
  msg="goroutine 15 [running]:"
  msg="github.com/trinodb/grafana-trino/pkg/trino/driver.Open({0xc0000f0510, {0xc0006540a0, 0xc0003d23c0, 0x0, 0x0, 0x0, 0xc00064bce0, 0xc00064bda0, 0xc00064bd40, {0x0, ...}, ...}})"
  msg="\t/home/runner/work/grafana-trino/grafana-trino/pkg/trino/driver/driver.go:27 +0x62"
  msg="github.com/trinodb/grafana-trino/pkg/trino.(*TrinoDatasource).Connect(0xc00043e5a0, {0x7, {0xc000656030, 0x24}, {0xc000052270, 0x10}, {0xc000052340, 0x5}, {0xc0003c8040, 0x3c}, ...}, ...)"
  msg="\t/home/runner/work/grafana-trino/grafana-trino/pkg/trino/datasource.go:50 +0xdf"
  msg="github.com/grafana/sqlds/v2.(*SQLDatasource).NewDatasource(0xc0004ad9a0, {0x7, {0xc000656030, 0x24}, {0xc000052270, 0x10}, {0xc000052340, 0x5}, {0xc0003c8040, 0x3c}, ...})"
  msg="\t/home/runner/go/pkg/mod/github.com/grafana/sqlds/v2@v2.5.1/datasource.go:84 +0x7f"
  msg="github.com/grafana/grafana-plugin-sdk-go/backend/datasource.(*instanceProvider).NewInstance(0xc0004ee3d8?, {0x1, {0xc000052270, 0x10}, 0xc0006489c0, 0x0, 0xc0003d8780})"
  msg="\t/home/runner/go/pkg/mod/github.com/grafana/grafana-plugin-sdk-go@v0.161.0/backend/datasource/instance_provider.go:58 +0xd5"
  msg="github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt.(*instanceManager).Get(0xc0004ee3c0, {0x1, {0xc000052270, 0x10}, 0xc0006489c0, 0x0, 0xc0003d8780})"
  msg="\t/home/runner/go/pkg/mod/github.com/grafana/grafana-plugin-sdk-go@v0.161.0/backend/instancemgmt/instance_manager.go:114 +0x595"
  msg="github.com/grafana/grafana-plugin-sdk-go/internal/automanagement.(*Manager).QueryData(0x165fbe8?, {0x165fbe8, 0xc00064bcb0}, 0xc0003c75e0)"
  msg="\t/home/runner/go/pkg/mod/github.com/grafana/grafana-plugin-sdk-go@v0.161.0/internal/automanagement/manager.go:28 +0x82"
  msg="github.com/grafana/grafana-plugin-sdk-go/backend.(*dataSDKAdapter).QueryData(0xc000116020, {0x165fbe8, 0xc00064baa0}, 0x0?)"
  msg="\t/home/runner/go/pkg/mod/github.com/grafana/grafana-plugin-sdk-go@v0.161.0/backend/data_adapter.go:49 +0x7d"
  msg="github.com/grafana/grafana-plugin-sdk-go/backend/grpcplugin.(*dataGRPCServer).QueryData(0xf98013?, {0x165fbe8?, 0xc00064baa0?}, 0xc00064ba70?)"
  msg="\t/home/runner/go/pkg/mod/github.com/grafana/grafana-plugin-sdk-go@v0.161.0/backend/grpcplugin/grpc_data.go:47 +0x2b"
  msg="github.com/grafana/grafana-plugin-sdk-go/genproto/pluginv2._Data_QueryData_Handler.func1({0x165fbe8, 0xc00064baa0}, {0x1421c00?, 0xc0003c60f0})"
  msg="\t/home/runner/go/pkg/mod/github.com/grafana/grafana-plugin-sdk-go@v0.161.0/genproto/pluginv2/backend_grpc.pb.go:195 +0x78"
  msg="github.com/grpc-ecosystem/go-grpc-prometheus.(*ServerMetrics).UnaryServerInterceptor.func1({0x165fbe8, 0xc00064baa0}, {0x1421c00, 0xc0003c60f0}, 0xc0005bd628?, 0xc0003cc858)"
  msg="\t/home/runner/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-prometheus@v1.2.0/server_metrics.go:107 +0x87"
  msg="github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func2.1({0x165fbe8?, 0xc00064baa0?}, {0x1421c00?, 0xc0003c60f0?})"
  msg="\t/home/runner/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/chain.go:48 +0x4f"
  msg="go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc.UnaryServerInterceptor.func1({0x165fbe8, 0xc00064a1e0}, {0x1421c00, 0xc0003c60f0}, 0xc0003d2360, 0xc000648740)"
  msg="\t/home/runner/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc@v0.41.1/interceptor.go:344 +0x528"
  msg="github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func2({0x165fbe8, 0xc00064a1e0}, {0x1421c00, 0xc0003c60f0}, 0xc0003d2360, 0x1373b60?)"
  msg="\t/home/runner/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/chain.go:53 +0x14e"
  msg="github.com/grafana/grafana-plugin-sdk-go/genproto/pluginv2._Data_QueryData_Handler({0x1353200?, 0xc0001163d0}, {0x165fbe8, 0xc00064a1e0}, 0xc0000e4070, 0xc00010c3c0)"
  msg="\t/home/runner/go/pkg/mod/github.com/grafana/grafana-plugin-sdk-go@v0.161.0/genproto/pluginv2/backend_grpc.pb.go:197 +0x138"
  msg="google.golang.org/grpc.(*Server).processUnaryRPC(0xc000138000, {0x1666fb8, 0xc0001041a0}, 0xc0000c8360, 0xc00010cab0, 0x1dd9790, 0x0)"
  msg="\t/home/runner/go/pkg/mod/google.golang.org/grpc@v1.55.0/server.go:1337 +0xdf3"
  msg="google.golang.org/grpc.(*Server).handleStream(0xc000138000, {0x1666fb8, 0xc0001041a0}, 0xc0000c8360, 0x0)"
  msg="\t/home/runner/go/pkg/mod/google.golang.org/grpc@v1.55.0/server.go:1714 +0xa36"
  msg=google.golang.org/grpc.(*Server).serveStreams.func1.1()
  msg="\t/home/runner/go/pkg/mod/google.golang.org/grpc@v1.55.0/server.go:959 +0x98"
  msg="created by google.golang.org/grpc.(*Server).serveStreams.func1"
  msg="\t/home/runner/go/pkg/mod/google.golang.org/grpc@v1.55.0/server.go:957 +0x18c"
logger=context userId=1 orgId=1 uname=adminlevel=error msg="Internal server error" error="[plugin.downstreamError] failed to query data: Failed to query data: rpc error: code = Unavailable desc = error reading from server: read tcp 127.0.0.1:55604->127.0.0.1:10000: wsarecv: An existing connection was forcibly closed by the remote host." remote_addr=[::1] traceID=
logger=context userId=1 orgId=1 uname=admin level=error msg="Request Completed" method=POST path=/api/ds/query status=500 remote_addr=[::1] time_ms=11 duration=11.2691ms size=116 referer=http://localhost:3000/connections/your-connections/datasources/edit/a141f150-d2b4-4751-9d56-f7419d7352e2 handler=/api/ds/query
  msg="plugin process exited" path="C:\\Program Files\\GrafanaLabs\\grafana\\data\\plugins\\trino-datasource/gpx_Trino_windows_amd64.exe" pid=8396 error="exit status 2"
  msg="Restarting plugin"
kevinlinxc commented 1 year ago

Note that I got this error with the 1.0.2 zip but not the 1.0.0 zip