Repository navigation
fix(deps): Python 3.11 and Pillow 13.0.0 for the test sandbox harness - #163
Merged
Merged
Conversation
The workflow test sandbox image (edge-cv-portal/test-sandbox) ran its harness on Ubuntu 22.04's Python 3.10 and pinned Pillow 12.3.0, which the open Pillow advisories affect. Pillow 13.0.0 is the first release that fixes them; it needs Python 3.11 or later and ships no cp310 wheel. The harness moves to Python 3.11; the image keeps its Ubuntu 22.04 base and GStreamer 1.20. - test-sandbox/Dockerfile: CPython 3.11 from the deadsnakes PPA, as in src/backend/Dockerfile.jp6 on the same Ubuntu release, in a venv at /opt/dda/harness-venv, added right after the first apt layer. Ubuntu's python3-gi and python3-gst-1.0 exist only for 3.10, so pip builds pycairo 1.23.0 and then PyGObject 3.42.2 for the venv (LocalServer's pins and install order). requirements.txt goes into the venv. A new build gate fails the image unless the venv runs 3.11 with the pinned Pillow and imports boto3 and Gst. CMD runs the venv's python. - The system python3 (3.10) stays for the Triton 24.08 python-backend stub, which links libpython3.10 and runs the staged models with numpy, onnxruntime, OpenCV and scikit-learn. The venv stays off PATH, so the stub keeps that interpreter. The stub's models import neither PIL nor boto3, and the system python3 no longer gets them. - test-sandbox/requirements.txt: Pillow==13.0.0. - tests/integration/conftest.py: the slim image gets the same layers, gate and CMD. test_custom_plugin_e2e.py and test_sandbox_e2e.py start the harness with the venv's python. - README and CHANGELOG. JP6 is unchanged: its LocalServer backend stays on Python 3.10 with Pillow 12.3.0 from src/backend/requirements.txt, because the vLLM, torch, torchvision and triton wheels it installs from the Jetson AI Lab jp6/cu126 index exist only for cp310. Nothing under src/ changed. Verified on an arm64 host, local Docker only: - Unit tests (-m "not integration"), host Python 3.9: 332 passed, 12 deselected. - The same under Python 3.11.17 with Pillow 13.0.0: 332 passed, 12 deselected. - Integration suite, slim image built natively (arm64): 4 failed, 8 passed, 1 warning. The 4 failures are the same ids and reasons as on main (b30a029) and unrelated to this change: test_report_shape_enum_capture_and_blurbs (padsError/pads keys), test_harness_sources_contain_no_greengrass_references (a model_staging.py docstring), and test_e2e_sample_workflow_runs_against_test_dataset and test_harness_run_uses_only_s3_no_greengrass (the sample workflow's unknown node type camera_source). - Slim image: the venv runs Python 3.11.18 with Pillow 13.0.0, boto3 1.34.162, PyGObject 3.42.2, pycairo 1.23.0 and GStreamer 1.20.3, and loads no gst-python overrides. The system python3 is 3.10.12 without PIL or boto3. The image's only Pillow is the venv's 13.0.0. - docker build --check on the Dockerfile: no warnings, as on main. - The new RUN layers, the gate and CMD are identical in the Dockerfile and the slim Dockerfile. - Full x86_64 image, built from this tree under qemu with the staged DDA plugin set (90 min): every build gate passes. tritonserver, the python-backend stub, libgstemltriton.so and libgstemlcapture.so resolve all their libraries, and the new gate prints "harness python 3.11.18 Pillow 13.0.0 boto3 1.34.162 GStreamer 1.20.3". The only plugin warning is the expected one for libgstemlvideocapture.so, whose libavcodec.so.57, libavformat.so.57, libavutil.so.55 and libswscale.so.4 Ubuntu 22.04 does not ship. - Full image facts: CMD is the venv's python, and PATH does not contain the venv. The venv matches the slim image's. The system python3 is 3.10.12 with numpy 1.26.4, onnxruntime 1.18.1, OpenCV 4.10.0 and scikit-learn 1.3.2, without PIL or boto3. The only Pillow in the image is the venv's 13.0.0, and no python3-pil package is installed. The image grows by about 0.47 GB net (docker history): 428 MB for Python 3.11 and the bindings' build toolchain, 30 MB for the venv with its bindings, and 8 MB more for the harness requirements (44 MB in the venv, against 36 MB in the system python3 of the previous image). - Triton stub smoke test in the full image: tritonserver loads a python-backend model that imports the DDA python-backend modules, and inference returns [2.0, 4.0, 6.0, 8.0] for [1, 2, 3, 4]. The stub ran Python 3.10.12 with prefix /usr and no venv path on sys.path. - Integration suite against the full image (SANDBOX_IT_IMAGE, under qemu): 4 failed, 8 passed, 1 warning; the same 4 baseline failures. The image was not run on Fargate and is not published.
main gained PR #162 (optional NAT gateway for the Build Fleet VPC) after this branch was pushed. The only conflict was one hunk in edge-cv-portal/CHANGELOG.md, where both sides added a top section under [Unreleased]. Both sections are kept, each exactly as on its side, this branch's first: - "Security - Pillow 13.0.0 and Python 3.11 for the workflow test sandbox image" (this branch); - "Added - Build Fleet: optional NAT gateway for the build instances" (main). No other file overlaps: main changed nothing under edge-cv-portal/test-sandbox or the workflow_core layer. Verified on the merged tree: - test-sandbox unit tests: 332 passed, 12 deselected on Python 3.9, and 332 passed, 12 deselected on Python 3.11 with Pillow 13.0.0. - .github/scripts/check_windows_paths.py: all 7,588 tracked paths pass. - The diff against main is exactly this branch's change before the merge (7 files), and every other file is main's. No conflict markers; hygiene grep over the diff and this message: clean.
main gained PR #164 (RF-DETR-Seg instance segmentation) after this branch last merged main. The only conflict was one hunk in edge-cv-portal/CHANGELOG.md, where both sides added a top section under [Unreleased]. Both sections are kept, each exactly as on its side, this branch's first: - "Security - Pillow 13.0.0 and Python 3.11 for the workflow test sandbox image" (this branch); - "Added - RF-DETR-Seg instance segmentation" (main). main also changed eight files under edge-cv-portal/test-sandbox/dda_triton_resources, the Triton python-backend modules the image copies for the stub. This branch does not touch them, so they come in as on main, and nothing else overlaps: main changed nothing else under edge-cv-portal/test-sandbox and nothing in the workflow_core layer. These modules run in the stub's system python3 (3.10), which this branch leaves without Pillow and boto3. None of the 46 modules imports either, and all 46 import with that interpreter in an image built from this branch's Dockerfile. Verified on the merged tree: - test-sandbox unit tests: 332 passed, 12 deselected on Python 3.9, and 332 passed, 12 deselected on Python 3.11 with Pillow 13.0.0. - .github/scripts/check_windows_paths.py: all 7,651 tracked paths pass. - The diff against main is exactly this branch's change (7 files), and every other file is main's. No conflict markers; hygiene grep over the diff and this message: clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The workflow test sandbox image (
edge-cv-portal/test-sandbox) runs its harness on Ubuntu 22.04's Python 3.10 and pins Pillow 12.3.0. Pillow 12.3.0 is affected by 43 Pillow advisories (5 critical, 24 high, 14 medium). The most severe, GHSA-5x8w-8jj5-q52h, is critical: a heap overflow in the FlashPix decoder. Pillow 13.0.0 is the first release that fixes them. It requires Python 3.11 or later and ships no Python 3.10 wheel, so #159 left the sandbox at 12.3.0.Changes
The harness moves to Python 3.11. The image keeps its Ubuntu 22.04 base, GStreamer 1.20 and Triton 24.08.
test-sandbox/Dockerfilesrc/backend/Dockerfile.jp6does on the same Ubuntu release, and creates a venv at/opt/dda/harness-venv.python3-giandpython3-gst-1.0exist only for Python 3.10, so pip builds pycairo 1.23.0 and PyGObject 3.42.2, the versions LocalServer pins, for the venv.requirements.txtis installed into the venv. A new build gate fails the image unless the venv runs Python 3.11 with the Pillow thatrequirements.txtpins and imports boto3 and the GStreamer bindings.CMDruns the venv's python. The venv is not onPATH.python3(3.10) stays for the Triton python-backend stub. The stub links libpython3.10 and runs the staged models with numpy, onnxruntime, OpenCV and scikit-learn. That interpreter no longer gets boto3 or Pillow, which the stub's models do not import. The only Pillow left in the image is the venv's 13.0.0.test-sandbox/requirements.txt:Pillow==13.0.0.tests/integration/conftest.pygets the same layers, gate andCMD.test_custom_plugin_e2e.pyandtest_sandbox_e2e.py, which start the harness themselves, use the venv's python.edge-cv-portal/CHANGELOG.md).JP6 is held at Python 3.10
This PR does not change JP6.
src/backend/Dockerfile.jp6andsrc/backend/requirements.txtare unchanged, and nothing undersrc/changes.Pillow==12.3.0; python_version < "3.11". It runs vLLM in-process, and the vllm, torch, torchvision and triton wheels it installs from the Jetson AI Lab jp6/cu126 index exist only for Python 3.10.Testing
Everything ran on an arm64 host in local Docker: the slim test image natively, and the full x86_64 image under qemu. The image was not run on Fargate and was not pushed to any registry.
-m "not integration"), host Python 3.9main(below)SANDBOX_IT_IMAGE, under qemu)docker build --checkmainlibgstemltriton.soandlibgstemlcapture.soresolve all their libraries, and the new gate printsharness python 3.11.18 Pillow 13.0.0 boto3 1.34.162 GStreamer 1.20.3. The only plugin warning is the existing one forlibgstemlvideocapture.so, whose libavcodec.so.57, libavformat.so.57, libavutil.so.55 and libswscale.so.4 Ubuntu 22.04 does not ship.python3is 3.10.12 without PIL or boto3. In the full image it imports numpy 1.26.4, onnxruntime 1.18.1, OpenCV 4.10.0 and scikit-learn 1.3.2. Each image's only Pillow is the venv's 13.0.0, and nopython3-pilpackage is installed.CMDis the venv's python, andPATHdoes not contain the venv.[2.0, 4.0, 6.0, 8.0]for[1, 2, 3, 4]. The stub ran Python 3.10.12 with prefix/usrand no venv path onsys.path.mainand on this branch are unrelated to this change and left as they are:test_report_shape_enum_capture_and_blurbs(the report'spadsError/pads keys);test_harness_sources_contain_no_greengrass_references(amodel_staging.pydocstring);test_e2e_sample_workflow_runs_against_test_datasetandtest_harness_run_uses_only_s3_no_greengrass(the sample workflow's unknown node typecamera_source).Notes for reviewers
CMD: the test runner and node designer task definitions set only environment variables. Each environment builds and pushes the image by hand (test-sandbox/README.md, "Build and push"). Until it does, its test runs keep the image they have.maintoo. That path rests on the stub's ldd gate, the smoke test and the environment checks above.edge-cv-portal/test-sandbox/requirements.txtshould close. The JP6 backend's Pillow 12.3.0 has no alert of its own: for the marker-split pin insrc/backend/requirements.txt, GitHub's dependency graph records only the 13.0.0 line.