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

[Eventhub] Fix Blocking Behavior of Buffered Producer Flush #25406

Merged
merged 17 commits into from
Aug 12, 2022

Conversation

kashifkhan
Copy link
Member

This is in reference to the issue #23510

Thanks to @annatisch for helping with the bug :)

  • Identified that the blocking behavior of queue.get was not needed for both sync & async. Flush should simply empty the queue, reset the buffer length and move on. This is why block=False is passed in and cur_buffered_len is reset on Empty exception
  • Added locks around put_event as it is modifying some shared variables such as curr_batch, cur_buffered_len as well as attempts a flush when the queue is full. This way we won't be adding things into the queue while flushing, leading to an infinite loop.

@azure-sdk
Copy link
Collaborator

azure-sdk commented Jul 26, 2022

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-eventhub

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@l0lawrence l0lawrence left a comment

Choose a reason for hiding this comment

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

I just had some questions about the locking -- wasn't sure how it works

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

/check-enforcer override

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

/check-enforcer override

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan kashifkhan enabled auto-merge (squash) August 4, 2022 21:08
@kashifkhan kashifkhan requested a review from annatisch August 10, 2022 17:45
@kashifkhan kashifkhan merged commit a13a526 into Azure:main Aug 12, 2022
@kashifkhan kashifkhan deleted the eh_async branch August 17, 2022 14:00
wonder6845 pushed a commit to wonder6845/azure-sdk-for-python that referenced this pull request Aug 23, 2022
)

* changes to make get non blocking async

* make emptying a queue non blocking

* test

* reset sample async

* test

* new line

* remove second lock

* sum over all the partitions

* fix async tests

* remove debug print

* lock around queue

* fix pylint

* changelog

* remove print

* reset cur_buffer_length outside while loop

* increase waiting time to receive events

* remove sleep on add
mccoyp pushed a commit to mccoyp/azure-sdk-for-python that referenced this pull request Sep 22, 2022
)

* changes to make get non blocking async

* make emptying a queue non blocking

* test

* reset sample async

* test

* new line

* remove second lock

* sum over all the partitions

* fix async tests

* remove debug print

* lock around queue

* fix pylint

* changelog

* remove print

* reset cur_buffer_length outside while loop

* increase waiting time to receive events

* remove sleep on add
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-python that referenced this pull request Aug 28, 2023
update typescript.md in resource (Azure#25406)

* update typescript.md in resource

* update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants