-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
bugSomething isn't workingSomething isn't working
Description
We had issue in PRD with concurrent map read / writes in the s3inbox with concurrent uploads.
fatal error: concurrent map writes
goroutine 13331 [running]:
internal/runtime/maps.fatal({0xb71015?, 0xab27a0?})
/usr/local/go/src/runtime/panic.go:1058 +0x18
internal/runtime/maps.(*Map).Delete(0xc0004dd860, 0xab27a0, 0xc0005fb958)
/usr/local/go/src/internal/runtime/maps/map.go:672 +0x10f
main.(*Proxy).allowedResponse(0xc0000a8180, {0xc92558, 0xc0034001c0}, 0xc0025f8000, {0xc99558, 0xc003e4a850})
/go/cmd/s3inbox/proxy.go:254 +0x10f6
main.(*Proxy).ServeHTTP(0xc0000a8180, {0xc92558, 0xc0034001c0}, 0xc0025f8000)
/go/cmd/s3inbox/proxy.go:109 +0x17b
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0000a80c0, {0xc92558, 0xc0034001c0}, 0xc00330bb80)
/root/go/pkg/mod/github.com/gorilla/mux@v1.8.1/mux.go:212 +0x1e2
net/http.serverHandler.ServeHTTP({0xc8e690?}, {0xc92558?, 0xc0034001c0?}, 0x6?)
/usr/local/go/src/net/http/server.go:3301 +0x8e
net/http.(*conn).serve(0xc004859c20, {0xc931c8, 0xc0004ddf50})
/usr/local/go/src/net/http/server.go:2102 +0x625
created by net/http.(*Server).Serve in goroutine 1
/usr/local/go/src/net/http/server.go:3454 +0x485
Hotfix was prepared based on v3.1.0 so we could fix it in PRD: 822354f but we also need to port this to main which is the aim of this task.
In addition the sync.RWMutex there are additional improvements to be made, eg:
- resuse fileID read from cache instead of reading each time
- better performance since each call to .read() will trigger a RLock() and RUnlock().
- in a highly concurrent environment, this avoids the problems that each call may return different results, sometimes might be empty if another process deleted the entry, etc
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working