Repository navigation
[serve][release] Decode Locust worker payload before sending it - #67220
Merged
Merged
Conversation
The Locust worker subprocess received the request payload as a JSON string in argv and passed it straight to json=, so every request body was a JSON string literal and resnet_50.py failed on request.json()["uri"] with a TypeError (HTTP 500 on 100% of requests). On the ray-ml image (locust 2.18) the request listener crashed on response.text with a None encoding before recording the error, so the test passed despite every request failing. Newer locust (2.39, in the ray-torch image) records the errors and run_locust_worker raises. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: elliot-barn <[email protected]>
elliot-barn
marked this pull request as ready for review
October 26, 2026 17:29
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates release/serve_tests/workloads/locust_utils.py to parse the first command-line argument as a JSON object using json.loads instead of a raw string. There are no review comments, and I have no feedback to provide.
qishengxhe
reviewed
Oct 27, 2026
qishengxhe
left a comment
Contributor
There was a problem hiding this comment.
LGTM, this should fix the payload. I'll send a quick followup on the test not failing on request errors, which not a release blocker
qishengxhe
approved these changes
Oct 27, 2026
elliot-barn
enabled auto-merge (squash)
October 27, 2026 00:26
justinyeh1995
pushed a commit
to justinyeh1995/ray
that referenced
this pull request
Oct 28, 2026
…project#67220) ## Why `pytest_serve_autoscaling_load_test` has been sending a bad payload on every request, and the test hid it. `release/serve_tests/workloads/locust_utils.py` hands the worker subprocess its payload as a JSON string in `sys.argv[1]`. The worker passed that string straight to `json=`, so locust encoded it a second time. Every request body was a JSON *string* (`"{\"uri\": ...}"`). `resnet_50.py` then failed on `(await request.json())["uri"]` with `TypeError: string indices must be integers` and returned HTTP 500 on 100% of requests. Master's nightly still passes because of a second bug: - `run_locust_worker` raises only if `client.errors` is non-empty, and `autoscaling_load_test.py` never checks the failure rate. - On the ray-ml image (`locust==2.18.0`), the request listener crashes on `response.text`. Serve's 500 response declares no charset, and locust 2.18 calls `str(content, None)`, which raises `TypeError: str() argument 'encoding' must be str, not None`. - Locust catches handler exceptions and only logs them, so the error is never appended and the test passes. Master's nightly build 111411 shows 1,901,821 requests and 1,901,821 failures, and the test still passed. Locust 2.39 (in the ray-torch image) falls back to detecting the encoding, so the errors are recorded and the worker raises. That's how this surfaced while moving the test to ray-torch in ray-project#66880. ## Change Decode `sys.argv[1]` with `json.loads` in the worker script, so the request body is the original `{"uri": ...}` object. `replica_scalability.py` also uses this helper, with `data=None`. It now sends no body instead of `"null"`, which makes no difference to its noop app. With this fix the autoscaling test sends real ResNet inference load again, so expect its latency and RPS metrics to change. ## Duplicate check I searched open PRs for `locust` and `autoscaling_load_test` and found nothing related. ## Testing - Confirmed the root cause in the service's replica logs (`TypeError` at `resnet_50.py:38`) and the masked errors in master's job logs (repeated "Uncaught exception in event handler"). - Checked the round-trip locally: the old body is `"{\"uri\": \"x\"}"`, the new body is `{"uri": "x"}`. - pre-commit passed. - I haven't run a release test with the fix yet. Filter: ``` name:^pytest_serve_autoscaling_load_test\.aws$ name:^pytest_serve_autoscaling_load_test\.aws\.haproxy$ ``` AI assistance (Claude Code) was used to investigate and write this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: elliot-barn <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
elliot-barn
added a commit
that referenced
this pull request
Oct 30, 2026
…2/N) (#67262) Stacked on #66880 (step 1/N). Review only the top commit until #66880 merges. ## Why This is step 2 of retiring the `anyscale/ray-ml` image from release tests. It moves the data release tests to the ray-torch image (`torch-cu128`) on Python 3.11, the same target #66880 uses. ## Change - The `DEFAULTS` block in `release/release_data_tests.yaml` switches from `type: gpu` (ray-ml) to `type: torch-cu128`. `training_ingest_regression_test` set `type: gpu` explicitly and switches too. - 47 test entries move from `python: "3.10"` to `"3.11"`. - Two tests need packages ray-torch doesn't ship, so they get `python_depset`s. Like the #66880 depsets, these are expanded from `ray-torch-cu128_base_py3.11.lock` and constrained to it. I diffed each lock against the image lock: both only add packages and change no existing pin. - `read_tfrecords` and `to_tf` get `torch_cu128_data_tensorflow_py3.11.lock`, which adds tensorflow 2.19.1 and tensorflow-metadata 1.17.3. tensorflow 2.20 needs `protobuf>=5.28`, and the image pins 5.27.5. - `image_embedding_from_uris_*` and `image_embedding_from_jsonl_*` get `torch_cu128_data_image_embedding_py3.11.lock`, which adds albumentations 2.0.8 and pybase64 1.4.3. - The deltalake and pyiceberg `post_build_script`s are unchanged. Neither package touches torch or numpy. **Still on ray-ml, each with a TODO (follow-up):** - `image_classification_fixed_size` and `image_classification_from_parquet_fixed_size` pin `pyarrow==19` through `image_classification_py3.10.lock`, because the dataset uses the removed `pyarrow.PyExtensionType`. ray-torch ships pyarrow 23. These need a data-team fix to the dataset. - `distributed_training` imports `mosaicml-streaming` at module load, even though this test never uses `--use-mosaic`. Every streaming release needs torchtext (0.5.x, which pins an old torch) or `transformers<5` (0.6 through 0.13). Both conflict with ray-torch's torch 2.10 and transformers 5.11. Making the import lazy would unblock it. `text_embedding_*` already uses `cu123` and is unchanged. ## Release test filter ``` name:^(read_parquet_fixed_size|read_large_parquet_fixed_size|read_images_fixed_size|read_tfrecords|read_from_uris_fixed_size|write_parquet|write_delta|write_delta_smoke|write_delta_overwrite|write_delta_partitioned|iceberg_benchmark_[^.]+|iceberg_benchmark_overwrite|aggregate_groups_low_cardinality|aggregate_groups_high_cardinality|map_groups_high_cardinality|map_groups_low_cardinality|joins_[^.]+_[^.]+|joins_[^.]+_[^.]+_disk|wide_schema_pipeline_primitives|wide_schema_pipeline_tensors|wide_schema_pipeline_objects|wide_schema_pipeline_nested_structs|streaming_split|mix|training_ingest_benchmark|training_ingest_regression_test|chunked_tensor_take|iter_batches_[^.]+|iter_batches_pyarrow|to_tf|iter_torch_batches|map|flat_map|map_batches_fixed_size_[^.]+_[^.]+_[^.]+|worker_scaling_[^.]+_[^.]+_[^.]+ops|backpressure_fast_producer_slow_consumer|backpressure_many_tiny_objects|backpressure_training_prefetch|backpressure_heterogeneous_memory_nodes|random_shuffle|heterogeneous_memory_batch_inference_multitenancy|image_embedding_from_uris_[^.]+|image_embedding_from_jsonl_[^.]+|multi_stage_batch_inference|tpch_[^.]+|tpch_[^.]+_disk_shuffle)(\..+)?$ ``` ## Duplicate check I searched open PRs for ray-ml / ray-torch data release test changes. Only #66880 (step 1, which this stacks on) and #67220 (a serve test fix) came up. ## Testing - `bazel test //release:test_config //release:test_test` passes. - `bazel run //ci/raydepsets:raydepsets -- build --all-configs --check` passes. - pre-commit passes. - The release tests haven't run on this branch yet. The filter is above. AI assistance (Claude Code) was used to make and check this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: elliot-barn <[email protected]> Signed-off-by: Elliot Barnwell <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
Why
pytest_serve_autoscaling_load_testhas been sending a bad payload on every request, and the test hid it.release/serve_tests/workloads/locust_utils.pyhands the worker subprocess its payload as a JSON string insys.argv[1]. The worker passed that string straight tojson=, so locust encoded it a second time. Every request body was a JSON string ("{\"uri\": ...}").resnet_50.pythen failed on(await request.json())["uri"]withTypeError: string indices must be integersand returned HTTP 500 on 100% of requests.Master's nightly still passes because of a second bug:
run_locust_workerraises only ifclient.errorsis non-empty, andautoscaling_load_test.pynever checks the failure rate.locust==2.18.0), the request listener crashes onresponse.text. Serve's 500 response declares no charset, and locust 2.18 callsstr(content, None), which raisesTypeError: str() argument 'encoding' must be str, not None.Master's nightly build 111411 shows 1,901,821 requests and 1,901,821 failures, and the test still passed.
Locust 2.39 (in the ray-torch image) falls back to detecting the encoding, so the errors are recorded and the worker raises. That's how this surfaced while moving the test to ray-torch in #66880.
Change
Decode
sys.argv[1]withjson.loadsin the worker script, so the request body is the original{"uri": ...}object.replica_scalability.pyalso uses this helper, withdata=None. It now sends no body instead of"null", which makes no difference to its noop app.With this fix the autoscaling test sends real ResNet inference load again, so expect its latency and RPS metrics to change.
Duplicate check
I searched open PRs for
locustandautoscaling_load_testand found nothing related.Testing
TypeErroratresnet_50.py:38) and the masked errors in master's job logs (repeated "Uncaught exception in event handler")."{\"uri\": \"x\"}", the new body is{"uri": "x"}.AI assistance (Claude Code) was used to investigate and write this change.
🤖 Generated with Claude Code