Skip to content

fatal error: concurrent map writes #36

@Ekleog

Description

@Ekleog

Today, after around 5-10 hours of runtime, with 8 probes all configured to watch the same maildir (so /cur and /new as per #35) and one mail per minute with 1min timeout, the mail exporter crashed with the following message:

fatal error: concurrent map writes
goroutine 34628 [running]:
runtime.throw(0x..., 0x15)
        runtime/panic.go:1117 +0x72 fp=0x... sp=0x... pc=0x...
runtime.mapassign_faststr(0x..., 0x..., 0x..., 0x..., 0x0)
        runtime/map_faststr.go:211 +0x... fp=0x... sp=0x... pc=0x...
main.probe(0x..., 0x4, 0x..., 0x9, 0x..., 0x2, 0x0, 0x0, 0x0, 0x0, ...)
        github.com/cherti/mailexporter/mailexporter.go:366 +0x8e fp=0x... sp=0x... pc=0x...
runtime.goexit()
        runtime/asm_amd64.s:1371 +0x1 fp=0x... sp=0x... pc=0x...
created by main.monitor
        github.com/cherti/mailexporter/mailexporter.go:400 +0x1b4
goroutine 1 [IO wait, 479 minutes]:
[...]

If I understand correctly, the relevant code is https://github.com/cherti/mailexporter/blob/main/mailexporter.go#L366 ; in which case my guess would be it'd be enough to add a mutex around muxer.

Does that make sense to you? If so, I've never written any go yet but it feels like something I could write up a PR for :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions