gazebosim / gz-transport

Transport library for component communication based on publication/subscription and service calls.
https://gazebosim.org
Apache License 2.0
29 stars 36 forks source link

Acquire the GIL when invoking callbacks #431

Closed azeey closed 11 months ago

azeey commented 11 months ago

🦟 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 https://github.com/gazebosim/gz-sim/pull/2081. Tests there are flaky without this PR.

Checklist

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.

codecov[bot] commented 11 months ago

Codecov Report

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

:exclamation: 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%) :arrow_up: