Skip to content

Conversation

@exg
Copy link
Contributor

@exg exg commented Dec 12, 2025

Issue number: closes #7792

Summary

The PR fixes a regression in the batch processor.

Changes

The change to BasePartialProcessor.async_process() in commit d08711f causes the method to create a new loop on every invocation. This is because asyncio.get_running_loop() raises RuntimeError also when the thread has an event loop, since the loop is no longer running after loop.run_until_complete() terminates.

User experience

Please share what the user experience looks like before and after this change


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@exg exg requested a review from a team as a code owner December 12, 2025 15:08
@exg exg requested a review from sdangol December 12, 2025 15:08
@boring-cyborg
Copy link

boring-cyborg bot commented Dec 12, 2025

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 12, 2025
The change to BasePartialProcessor.async_process() in commit d08711f
causes the method to create a new loop on every invocation. This is
because asyncio.get_running_loop() raises RuntimeError also when the
thread has an event loop, since the loop is no longer running after
loop.run_until_complete() terminates.
@exg exg force-pushed the fix-batch-processor branch from 152d9c0 to c3df3ad Compare December 12, 2025 15:16
@pull-request-size pull-request-size bot removed the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 12, 2025
@boring-cyborg boring-cyborg bot added the tests label Dec 12, 2025
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 12, 2025
@github-actions github-actions bot added the bug Something isn't working label Dec 12, 2025
@leandrodamascena
Copy link
Contributor

Hi @exg, thank you so much for opening this PR! I'm attending an external event today and will review this PR ASAP.

@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.52%. Comparing base (9734e84) to head (9eff01d).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #7798   +/-   ##
========================================
  Coverage    96.52%   96.52%           
========================================
  Files          275      275           
  Lines        13123    13123           
  Branches       990      990           
========================================
  Hits         12667    12667           
  Misses         353      353           
  Partials       103      103           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leandrodamascena leandrodamascena changed the title fix: fix batch processor fix(batch_processor): fix batch processor Dec 15, 2025
@leandrodamascena leandrodamascena merged commit 83fec2f into aws-powertools:develop Dec 15, 2025
13 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Dec 15, 2025

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

@sonarqubecloud
Copy link

@exg exg deleted the fix-batch-processor branch December 15, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: AsyncBatchProcessor recreates the loop on the warm start, ruining some module level locks

2 participants