Skip to content

fatal error: concurrent map iteration and map write #2863

Closed

Description

@gbartolini

As raised in #2860 by @ksyblast (see that discussion for the full log) there's a concurrent access to the cache:

fatal error: concurrent map iteration and map write

goroutine 562 [running]:
reflect.mapiterinit(0x451652?, 0x1c0?, 0x1d96c40?)
	/opt/hostedtoolcache/go/1.20.6/x64/src/runtime/map.go:1375 +0x19
reflect.(*MapIter).Next(0x1c7fc60?)
	/opt/hostedtoolcache/go/1.20.6/x64/src/reflect/value.go:1919 +0x65
encoding/json.mapEncoder.encode({0xc00062d388?}, 0xc00048c280, {0x1c7fc60?, 0xc0004af678?, 0x800?}, {0xd?, 0x0?})
	/opt/hostedtoolcache/go/1.20.6/x64/src/encoding/json/encode.go:797 +0x33e
encoding/json.structEncoder.encode({{{0xc000b0fb00?, 0x79c025?, 0xc00062d490?}, 0xc0006d9ad0?}}, 0xc00048c280, {0x1e35ae0?, 0xc0004af678?, 0xd?}, {0x0, 0x1})
	/opt/hostedtoolcache/go/1.20.6/x64/src/encoding/json/encode.go:759 +0x1f4
encoding/json.structEncoder.encode({{{0xc0005d8c00?, 0x37?, 0xc00062d598?}, 0xc000683380?}}, 0xc00048c280, {0x1f460a0?, 0xc0004af608?, 0x7?}, {0x0, 0x1})
	/opt/hostedtoolcache/go/1.20.6/x64/src/encoding/json/encode.go:759 +0x1f4
encoding/json.structEncoder.encode({{{0xc000b0e480?, 0xc00062d690?, 0x40bbb6?}, 0xc000683bc0?}}, 0xc00048c280, {0x1e63b60?, 0xc0004af500?, 0x7a025a?}, {0x0, 0x1})
	/opt/hostedtoolcache/go/1.20.6/x64/src/encoding/json/encode.go:759 +0x1f4
encoding/json.ptrEncoder.encode({0x1?}, 0xc00048c280, {0x1f53e00?, 0xc0004af500?, 0x1f53e00?}, {0x8?, 0xd8?})
	/opt/hostedtoolcache/go/1.20.6/x64/src/encoding/json/encode.go:943 +0x21c
encoding/json.(*encodeState).reflectValue(0xc00048c280?, {0x1f53e00?, 0xc0004af500?, 0x40e1c7?}, {0x78?, 0x0?})
	/opt/hostedtoolcache/go/1.20.6/x64/src/encoding/json/encode.go:358 +0x78
encoding/json.(*encodeState).marshal(0xc00062d8f0?, {0x1f53e00?, 0xc0004af500?}, {0x20?, 0x60?})
	/opt/hostedtoolcache/go/1.20.6/x64/src/encoding/json/encode.go:330 +0xfa
encoding/json.Marshal({0x1f53e00, 0xc0004af500})
	/opt/hostedtoolcache/go/1.20.6/x64/src/encoding/json/encode.go:161 +0xe5
github.com/cloudnative-pg/cloudnative-pg/pkg/management/postgres/webserver.(*localWebserverEndpoints).serveCache(0x985a70?, {0x22618d0, 0xc000e4a000}, 0x50fb69?)
	pkg/management/postgres/webserver/local.go:96 +0x179
net/http.HandlerFunc.ServeHTTP(0xc00048c100?, {0x22618d0?, 0xc000e4a000?}, 0x40ddea?)
	/opt/hostedtoolcache/go/1.20.6/x64/src/net/http/server.go:2122 +0x2f
net/http.(*ServeMux).ServeHTTP(0x0?, {0x22618d0, 0xc000e4a000}, 0xc000e7a000)
	/opt/hostedtoolcache/go/1.20.6/x64/src/net/http/server.go:2500 +0x149
net/http.serverHandler.ServeHTTP({0xc0004224e0?}, {0x22618d0, 0xc000e4a000}, 0xc000e7a000)
	/opt/hostedtoolcache/go/1.20.6/x64/src/net/http/server.go:2936 +0x316
net/http.(*conn).serve(0xc00029e090, {0x2262830, 0xc0004b8180})
	/opt/hostedtoolcache/go/1.20.6/x64/src/net/http/server.go:1995 +0x612
created by net/http.(*Server).Serve
	/opt/hostedtoolcache/go/1.20.6/x64/src/net/http/server.go:3089 +0x5ed

Please investigate.

Activity

  1. added this to the 1.21.0 milestone on Sep 25, 2023
  2. added a commit that references this issue on Sep 27, 2023
    f77af89
  3. added 2 commits that reference this issue on Sep 27, 2023
    db4b2cc
    c9941b5
  4. added a commit that references this issue on Sep 30, 2023
    e991968
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't working

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions