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

Acquire the GIL when invoking callbacks #431

Merged
merged 1 commit into from
Aug 24, 2023
Merged

Conversation

azeey
Copy link
Contributor

@azeey azeey commented Aug 24, 2023

🦟 Bug fix

Summary

gz-transport callbacks are invoked from a separate thread so we need to acquire the GIL. Users such as gz-sim need to release the GIL regularly to ensure callbacks are serviced in a timely manner.

Came up in tests in gazebosim/gz-sim#2081. Tests there are flaky without this PR.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@azeey azeey requested a review from caguero as a code owner August 24, 2023 19:52
@azeey azeey self-assigned this Aug 24, 2023
@azeey azeey added the beta Targeting beta release of upcoming collection label Aug 24, 2023
@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Aug 24, 2023
@azeey azeey requested a review from mjcarroll August 24, 2023 19:52
@codecov
Copy link

codecov bot commented Aug 24, 2023

Codecov Report

Merging #431 (662fdc9) into main (d888517) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 662fdc9 differs from pull request most recent head 0950458. Consider uploading reports for the commit 0950458 to get more accurate results

@@           Coverage Diff           @@
##             main     #431   +/-   ##
=======================================
  Coverage   87.75%   87.75%           
=======================================
  Files          59       59           
  Lines        5693     5694    +1     
=======================================
+ Hits         4996     4997    +1     
  Misses        697      697           
Files Changed Coverage Δ
python/src/transport/_gz_transport_pybind11.cc 75.00% <100.00%> (+0.15%) ⬆️

@azeey azeey merged commit e176237 into gazebosim:main Aug 24, 2023
4 checks passed
@azeey azeey deleted the pybind11_gil branch August 24, 2023 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta Targeting beta release of upcoming collection 🎵 harmonic Gazebo Harmonic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants