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

Fix deadlocks due to nesting AsyncExecs. #3

Merged
merged 1 commit into from
Oct 16, 2020
Merged

Fix deadlocks due to nesting AsyncExecs. #3

merged 1 commit into from
Oct 16, 2020

Conversation

edwarnicke
Copy link
Owner

Previously, due to finite channel size it was possible to deadlock
(see new TestNestedAsyncDeadlock test).

Now, we store incoming jobs in a backlog, so that we can accomodate
such cases.

Previously, due to finite channel size it was possible to deadlock
(see new TestNestedAsyncDeadlock test).

Now, we store incoming jobs in a backlog, so that we can accomodate
such cases.

Signed-off-by: Ed Warnicke <hagbard@gmail.com>
@edwarnicke
Copy link
Owner Author

edwarnicke commented Oct 15, 2020

Before

goos: darwin
goarch: amd64
pkg: github.com/edwarnicke/serialize
BenchmarkExecutorAsync
BenchmarkExecutorAsync-16    	 7213419	       163 ns/op
BenchmarkExecutorSync
BenchmarkExecutorSync-16     	 2312421	       528 ns/op

After

goos: darwin
goarch: amd64
pkg: github.com/edwarnicke/serialize
BenchmarkExecutorAsync
BenchmarkExecutorAsync-16    	 6077265	       198 ns/op
BenchmarkExecutorSync
BenchmarkExecutorSync-16     	 1779312	       668 ns/op

Delta:

BenchmarkExecutorAsync-16    	        	       35  ns/op (21% slower)
BenchmarkExecutorSync-16     	        	       140 ns/op (26% slower)

Copy link
Contributor

@denis-tingaikin denis-tingaikin left a comment

Choose a reason for hiding this comment

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

Tested locally with different scenarios. LGTM

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.

2 participants