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

[Issue 763][producer] Fix deadlock in Producer Send when message fails to encode. #762

Merged
merged 2 commits into from
Apr 29, 2022

Conversation

samuelhewitt
Copy link
Contributor

@samuelhewitt samuelhewitt commented Apr 20, 2022

Add tests for producer schema encode.

Fixes #763

Motivation

When using Producer, if the ProducerMessage.Value fails to encode using the producer's Schema, the code never returns when using producer.Send() and never executes the callback when using producer.SendAsync(). Additionally, the publishSemaphore that was Acquired is never released.

Modifications

When an error is returned by Schema Encode, release the Semaphore and execute the callback.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • Added integration test with failure to encode schema

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): no
  • The public API: no
  • The schema: no
  • The default values of configurations: no
  • The wire protocol: no

Documentation

  • Does this pull request introduce a new feature? no

@samuelhewitt samuelhewitt changed the title [producer] Release semaphore and execute callback when message fails to encode. [Issue 763][producer] Release semaphore and execute callback when message fails to encode. Apr 20, 2022
@samuelhewitt samuelhewitt changed the title [Issue 763][producer] Release semaphore and execute callback when message fails to encode. [Issue 763][producer] Fix deadlock in Producer Send when message fails to encode. Apr 20, 2022
@chiragbparikh
Copy link

@merlimat @wolfstudy @sijie Can we please review the above PR ^^^

@chiragbparikh
Copy link

@lhotari could you please review the above PR ^^^

@merlimat merlimat added this to the v0.9.0 milestone Apr 28, 2022
@merlimat merlimat merged commit 5ee6330 into apache:master Apr 29, 2022
@samuelhewitt samuelhewitt deleted the patch-1 branch May 6, 2022 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Producer blocks on Send when Schema fails to Encode
3 participants