Skip to content
New issue

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

Added mutex to avoid concurrency errors on SubscriptionManager #2316

Merged
merged 3 commits into from Apr 5, 2023

Conversation

danielbdias
Copy link
Contributor

This PR aims to fix a concurrency error that is happening on Tracetest:

persistentRunner job. ID 1, testID JFxVPFY4R, TraceID 8ec5afeaca8d38668e5053fc4fb79998, SpanID b8a543d68fd34165
fatal error: concurrent map read and map write

goroutine 49 [running]:
github.com/kubeshop/tracetest/server/subscription.(*Manager).Publish(0x1a97540?, {0xc002b95740, 0x1a}, {0x1a97540, 0xc0033331e0})
	/home/runner/work/tracetest/tracetest/server/subscription/manager.go:59 +0x65
github.com/kubeshop/tracetest/server/executor.(*internalEventEmitter).Emit(_, {_, _}, {0x0, {0x1b2908b, 0xc}, {0x1b1a196, 0x7}, {0x1b5697d, 0x1c}, ...})
	/home/runner/work/tracetest/tracetest/server/executor/eventemitter.go:35 +0x18d
github.com/kubeshop/tracetest/server/executor.persistentRunner.processExecQueue({0xc0006b7fb0, {0x7f86d6a14208, 0xc000522e40}, {0x7f86d6a141b8, 0xc000136068}, {0x1f32940, 0xc000131410}, {0x1f2fda0, 0xc000092940}, 0xc0002a2050, ...}, ...)
	/home/runner/work/tracetest/tracetest/server/executor/runner.go:177 +0x262
github.com/kubeshop/tracetest/server/executor.persistentRunner.Start.func1()
	/home/runner/work/tracetest/tracetest/server/executor/runner.go:115 +0x238
created by github.com/kubeshop/tracetest/server/executor.persistentRunner.Start
	/home/runner/work/tracetest/tracetest/server/executor/runner.go:100 +0x85

Changes

Fixes

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

Copy link
Collaborator

@schoren schoren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -88,6 +88,7 @@ jobs:

build-go:
name: Build go binaries (API Server and CLI)
needs: [unit-test-cli, test-server]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this dependency to avoid running tests based on build if our unit tests break by some reason.

@danielbdias danielbdias merged commit 40560b1 into main Apr 5, 2023
27 checks passed
@danielbdias danielbdias deleted the fix/server-event-publishing branch April 5, 2023 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants