We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when testing several Activities with t.Parallel, the test framework crash with "fatal error: concurrent map writes"
fatal error: concurrent map writes ... goroutine 129 [running]: go.temporal.io/sdk/internal.(*testWorkflowEnvironmentImpl).setActivityHandle(...) /Users/xavier.delannoy/go/pkg/mod/go.temporal.io/[email protected]/internal/internal_workflow_testsuite.go:1415 go.temporal.io/sdk/internal.(*testWorkflowEnvironmentImpl).executeActivity(0x140000e4488, {0x10304e900?, 0x1031d92a8?}, {0x14000513020, 0x1, 0x1}) /Users/xavier.delannoy/go/pkg/mod/go.temporal.io/[email protected]/internal/internal_workflow_testsuite.go:703 +0x524 go.temporal.io/sdk/internal.(*TestActivityEnvironment).ExecuteActivity(0x1030c99a0?, {0x10304e900?, 0x1031d92a8?}, {0x14000513020?, 0x140004d1f38?, 0x1028bb6a0?}) /Users/xavier.delannoy/go/pkg/mod/go.temporal.io/[email protected]/internal/workflow_testsuite.go:195 +0x2c github.com/strangebee/godsl/flow/activities/strings.Test_Activity_TrimRight.func1(0x140004c36c0) /Users/xavier.delannoy/go/src/github.com/strangebee/Delannoy/godsl/flow/activities/strings/trimright_test.go:150 +0xac testing.tRunner(0x140004c36c0, 0x14000494390) /usr/local/go/src/testing/testing.go:1690 +0xe4 created by testing.(*T).Run in goroutine 24 /usr/local/go/src/testing/testing.go:1743 +0x314
code:
func (env *testWorkflowEnvironmentImpl) setActivityHandle(activityID, runID string, handle *testActivityHandle) { env.activities[env.makeUniqueActivityID(activityID, runID)] = handle }
activities map[string]*testActivityHandle
as several go routines can write in the map 'activities', the type of activities should be a sync.Map or use a mutex to protect the write
internal/internal_workflow_testsuite.go:1415
func (env *testWorkflowEnvironmentImpl) setActivityHandle(activityID, runID string, handle *testActivityHandle) { env.locker.Lock() defer env.locker.Unlock() env.activities[env.makeUniqueActivityID(activityID, runID)] = handle }
The text was updated successfully, but these errors were encountered:
Fix issue temporalio#1703
69b2c64
protect the write to the map env.activities with env.locker
To clarify, are you seeing this data race when the same test environment being shared by multiple tests?
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Expected Behavior
Actual Behavior
when testing several Activities with t.Parallel, the test framework crash with "fatal error: concurrent map writes"
Steps to Reproduce the Problem
Specifications
Investigation
code:
as several go routines can write in the map 'activities', the type of activities should be a sync.Map or use a mutex to protect the write
Potential fix
internal/internal_workflow_testsuite.go:1415
The text was updated successfully, but these errors were encountered: