From 97ef4dca6cbfacf4e26c05d3125f7fc812e16122 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Fri, 11 Oct 2024 13:35:31 +0000 Subject: [PATCH] Force flake8 to the use the single-threaded pool. The comment in the code has more information about why we want to do this. Signed-off-by: Chris Lalancette --- ament_flake8/ament_flake8/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ament_flake8/ament_flake8/main.py b/ament_flake8/ament_flake8/main.py index ed22bdde..c612a705 100755 --- a/ament_flake8/ament_flake8/main.py +++ b/ament_flake8/ament_flake8/main.py @@ -264,6 +264,13 @@ def generate_flake8_report(config_file, paths, excludes, max_line_length=None): if max_line_length is not None: flake8_argv.append('--max-line-length={0}'.format(max_line_length)) + # We've seen some problems, especially on RHEL-9, where using the multi-threaded + # pool in flake8 can cause the Python interpreter to crash. Force flake8 to use + # the single-threaded pool here. This has some performance implications for + # large codebases, but given the distributed nature of ROS packages this shouldn't + # generally be a large problem. + flake8_argv.append('-j=1') + style = get_flake8_style_guide(flake8_argv) # Monkey patch formatter to collect all errors