Skip to content

Surpressing multi-threaded process warning from rosbag2 flake8.#2329

Open
fujitatomoya wants to merge 2 commits intorollingfrom
fujitatomoya/surpress-warnings-ros2bag
Open

Surpressing multi-threaded process warning from rosbag2 flake8.#2329
fujitatomoya wants to merge 2 commits intorollingfrom
fujitatomoya/surpress-warnings-ros2bag

Conversation

@fujitatomoya
Copy link
Contributor

Description

  • before
root@tomoyafujita-B760M-Pro-RS-D4:~/ros2_ws/colcon_ws# colcon test --event-handlers console_direct+ --packages-select ros2bag
Starting >>> ros2bag
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-7.4.4, pluggy-1.4.0
cachedir: /root/ros2_ws/colcon_ws/build/ros2bag/.pytest_cache
rootdir: /root/ros2_ws/colcon_ws/src/ros2/rosbag2/ros2bag
configfile: pytest.ini
plugins: launch-testing-ros-0.29.5, launch-testing-3.9.6, ament-mypy-0.20.3, ament-xmllint-0.20.3, ament-copyright-0.20.3, ament-pep257-0.20.3, ament-flake8-0.20.3, ament-lint-0.20.3, anyio-4.11.0, None-None, timeout-2.2.0, cov-4.1.0, rerunfailures-12.0, mock-3.12.0, colcon-core-0.20.1
collecting ...
collected 41 items

test/test_api.py .......                                                 [ 17%]
test/test_burst.py .                                                     [ 19%]
test/test_cli_extension.py .                                             [ 21%]
test/test_copyright.py .                                                 [ 24%]
test/test_flake8.py .                                                    [ 26%]
test/test_info.py .                                                      [ 29%]
test/test_pep257.py .                                                    [ 31%]
test/test_play_qos_profiles.py .                                         [ 34%]
test/test_record.py .                                                    [ 36%]
test/test_record_qos_profiles.py .                                       [ 39%]
test/test_record_with_compression_thread_priority.py .                   [ 41%]
test/test_recorder_args_parser.py .......................                [ 97%]
test/test_xmllint.py .                                                   [100%]

=============================== warnings summary ===============================
test/test_flake8.py: 28 warnings
  Warning: This process (pid=34066) is multi-threaded, use of fork() may lead to deadlocks in the child.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
----- generated xml file: /root/ros2_ws/colcon_ws/build/ros2bag/pytest.xml -----
======================= 41 passed, 28 warnings in 10.10s =======================
--- stderr: ros2bag

=============================== warnings summary ===============================
test/test_flake8.py: 28 warnings
  Warning: This process (pid=34066) is multi-threaded, use of fork() may lead to deadlocks in the child.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---
Finished <<< ros2bag [10.7s]

Summary: 1 package finished [11.5s]
  1 package had stderr output: ros2bag
  • after
root@tomoyafujita-B760M-Pro-RS-D4:~/ros2_ws/colcon_ws# colcon test --event-handlers console_direct+ --packages-select ros2bag
Starting >>> ros2bag
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-7.4.4, pluggy-1.4.0
cachedir: /root/ros2_ws/colcon_ws/build/ros2bag/.pytest_cache
rootdir: /root/ros2_ws/colcon_ws/src/ros2/rosbag2/ros2bag
configfile: pytest.ini
plugins: launch-testing-ros-0.29.5, launch-testing-3.9.6, ament-mypy-0.20.3, ament-xmllint-0.20.3, ament-copyright-0.20.3, ament-pep257-0.20.3, ament-flake8-0.20.3, ament-lint-0.20.3, anyio-4.11.0, None-None, timeout-2.2.0, cov-4.1.0, rerunfailures-12.0, mock-3.12.0, colcon-core-0.20.1
timeout: 900.0s
timeout method: thread
timeout func_only: False
collecting ...
collected 41 items

test/test_api.py .......                                                 [ 17%]
test/test_burst.py .                                                     [ 19%]
test/test_cli_extension.py .                                             [ 21%]
test/test_copyright.py .                                                 [ 24%]
test/test_flake8.py .                                                    [ 26%]
test/test_info.py .                                                      [ 29%]
test/test_pep257.py .                                                    [ 31%]
test/test_play_qos_profiles.py .                                         [ 34%]
test/test_record.py .                                                    [ 36%]
test/test_record_qos_profiles.py .                                       [ 39%]
test/test_record_with_compression_thread_priority.py .                   [ 41%]
test/test_recorder_args_parser.py .......................                [ 97%]
test/test_xmllint.py .                                                   [100%]

----- generated xml file: /root/ros2_ws/colcon_ws/build/ros2bag/pytest.xml -----
============================== 41 passed in 9.56s ==============================
Finished <<< ros2bag [10.2s]

Summary: 1 package finished [11.0s]

Fixes # (issue)

Is this user-facing behavior change?

No

Did you use Generative AI?

No

Additional Information

https://github.com/ros2/sros2/blob/rolling/sros2/pytest.ini, we have done the same thing to sros2.

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates ros2bag’s pytest configuration to eliminate noisy warnings during the flake8 test run (notably the “multi-threaded, use of fork() may lead to deadlocks” warning observed under Python 3.12/Ubuntu 22.04).

Changes:

  • Adds pytest-timeout configuration (900s per-test timeout, thread-based timeout method).
  • Converts filterwarnings to a multi-line list and adds a filter to suppress the fork-in-multithreaded-process warning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Tomoya.Fujita <Tomoya.Fujita@sony.com>
@fujitatomoya
Copy link
Contributor Author

Pulls: #2329
Gist: https://gist.githubusercontent.com/fujitatomoya/9a57d81c73dcf9882acc9db4d4407b60/raw/c201a3b28592e728866591cedbc97d4263150fa2/ros2.repos
BUILD args: --packages-above-and-dependencies ros2bag
TEST args: --packages-above ros2bag
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18193

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants