Skip to content

panic: assignment to entry in nil map #19

Open
@karimtabet

Description

@karimtabet

We are seeing panic: assignment to entry in nil map when running ./postgresql-prometheus-adapter for the first time. The offending line appears to be this:

vMetricIDMap[sMetric] = nextId

Are we initialising vMetricIDMap properly?

$ ./postgresql-prometheus-adapter
ts=2022-10-28T16:42:45.954Z caller=main.go:129 level=info config="&{remoteTimeout:30000000000 listenAddr::9201 telemetryPath:/metrics pgPrometheusConfig:{CommitSecs:15 CommitRows:20000 PGWriters:1 PGParsers:5 PartitionScheme:hourly} logLevel: haGroupLockId:0 prometheusTimeout:0 promlogConfig:{Level:0xc000013470 Format:0xc000036650}}"
ts=2022-10-28T16:42:45.954Z caller=main.go:130 level=info pgPrometheusConfig="{CommitSecs:15 CommitRows:20000 PGWriters:1 PGParsers:5 PartitionScheme:hourly}"
ts=2022-10-28T16:42:45.968Z caller=main.go:172 level=info msg="Starting HTTP Listerner"
ts=2022-10-28T16:42:45.968Z caller=main.go:177 level=info msg="Starting up..."
ts=2022-10-28T16:42:45.968Z caller=main.go:178 level=info msg=Listening addr=:9201
ts=2022-10-28T16:42:45.989Z caller=client.go:241 level=info msg="creating tables"
ts=2022-10-28T16:42:45.991Z caller=client.go:314 level=info msg="Creating partition, hourly"
ts=2022-10-28T16:42:45.992Z caller=client.go:135 level=info bgwriter0="Starting 5 Parsers"
ts=2022-10-28T16:42:45.992Z caller=client.go:140 level=info bgwriter0=Started
ts=2022-10-28T16:42:45.992Z caller=client.go:69 level=info bgparser4=Started
ts=2022-10-28T16:42:45.992Z caller=client.go:69 level=info bgparser2=Started
ts=2022-10-28T16:42:45.992Z caller=client.go:69 level=info bgparser3=Started
ts=2022-10-28T16:42:45.992Z caller=client.go:69 level=info bgparser0=Started
ts=2022-10-28T16:42:45.992Z caller=client.go:69 level=info bgparser1=Started
ts=2022-10-28T16:42:47.361Z caller=client.go:314 level=info msg="Creating partition, hourly"
ts=2022-10-28T16:42:47.363Z caller=client.go:314 level=info msg="Creating partition, hourly"
panic: assignment to entry in nil map

goroutine 24 [running]:
github.com/crunchydata/postgresql-prometheus-adapter/pkg/postgresql.(*PGParser).RunPGParser(0xc000199900, 0x4e20?, {0xb20fc1, 0x6}, 0x1055ae0)
	/root/postgresql-prometheus-adapter/pkg/postgresql/client.go:92 +0x67e
created by github.com/crunchydata/postgresql-prometheus-adapter/pkg/postgresql.(*PGWriter).RunPGWriter
	/root/postgresql-prometheus-adapter/pkg/postgresql/client.go:137 +0x545

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions