uber-go / cadence-client

Framework for authoring workflows and activities running on top of the Cadence orchestration engine.

Home Page:https://cadenceworkflow.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Race in Register...WithOptions due to un-protected map read

Groxx opened this issue · comments

if _, ok := r.workflowFuncMap[registerName]; ok {

It's pretty clear when the addWorkflowFn call right below it uses a mutex:

func (r *registry) addWorkflowFn(fnName string, wf interface{}) {
r.Lock()
defer r.Unlock()
r.workflowFuncMap[fnName] = wf
}

This is also happening in the equivalent Activity methods:

if _, ok := r.activityFuncMap[registerName]; ok {

vs
func (r *registry) addActivity(fnName string, a activity) {
r.Lock()
defer r.Unlock()
r.activityFuncMap[fnName] = a
}

Can I request adding more t.Parallel() tests to catch this kind of thing up-front?