golang / golang/groupcache

bugfix: When the fn function is executed, causing panic will cause the key to remain permanently. This leads to a series of problems.

Open
#139 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
13.3k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

When the fn function is executed, causing panic will cause the key to remain permanently. This leads to a series of problems.

```
goroutine 1

Group.Do
// add
g.m[key] = c

// execute fn()
c.val, c.err = fn() // panic;

// delete key
delete(g.m, key)

goroutine 2

Group.Do
// lookup
if c, ok := g.m[key]; ok {
g.mu.Unlock()
c.wg.Wait() // wait forever
return
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.