You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "JakeChampion (via GitHub)" <gi...@apache.org> on 2026/02/23 15:51:53 UTC
[PR] fix(http): stale `skip_bytes` in cache-write consumer after 100 Continue with transform [trafficserver]
JakeChampion opened a new pull request, #12906:
URL: https://github.com/apache/trafficserver/pull/12906
When an origin sends 100 Continue before a compressible response, `setup_100_continue_transfer()` sets `client_response_hdr_bytes` to the intermediate header size. `setup_server_transfer_to_transform()` then creates the tunnel buffer with `hdr_size=0` - body only, but does not reset `client_response_hdr_bytes` for non-chunked responses. `perform_cache_write_action()` passes the stale value as `skip_bytes` to the cache-write consumer, causing `ink_release_assert` in `producer_run` when the response body is smaller than the 100 Continue headers.
Fix: Set `cache_write_skip` to `0` when a transform is present, since `setup_server_transfer_to_transform()` never writes headers into the tunnel buffer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(http): stale `skip_bytes` in cache-write consumer after 100 Continue with transform [trafficserver]
Posted by "ezelkow1 (via GitHub)" <gi...@apache.org>.
ezelkow1 commented on PR #12906:
URL: https://github.com/apache/trafficserver/pull/12906#issuecomment-3947748874
[approve ci autest 1]
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(http): stale `skip_bytes` in cache-write consumer after 100 Continue with transform [trafficserver]
Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 merged PR #12906:
URL: https://github.com/apache/trafficserver/pull/12906
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(http): stale `skip_bytes` in cache-write consumer after 100 Continue with transform [trafficserver]
Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 commented on PR #12906:
URL: https://github.com/apache/trafficserver/pull/12906#issuecomment-3981376551
[approve ci autest]
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(http): stale `skip_bytes` in cache-write consumer after 100 Continue with transform [trafficserver]
Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall commented on PR #12906:
URL: https://github.com/apache/trafficserver/pull/12906#issuecomment-3987550006
[approve ci]
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(http): stale `skip_bytes` in cache-write consumer after 100 Continue with transform [trafficserver]
Posted by "JakeChampion (via GitHub)" <gi...@apache.org>.
JakeChampion commented on PR #12906:
URL: https://github.com/apache/trafficserver/pull/12906#issuecomment-3946183725
I think AuTest 1of4 was a flakey fail
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(http): stale `skip_bytes` in cache-write consumer after 100 Continue with transform [trafficserver]
Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 commented on code in PR #12906:
URL: https://github.com/apache/trafficserver/pull/12906#discussion_r2870071986
##########
src/proxy/http/HttpSM.cc:
##########
@@ -6608,8 +6591,16 @@ HttpSM::perform_cache_write_action()
if (transform_info.entry == nullptr || t_state.api_info.cache_untransformed == true) {
cache_sm.close_read();
t_state.cache_info.write_status = HttpTransact::CacheWriteStatus_t::IN_PROGRESS;
- setup_cache_write_transfer(&cache_sm, server_entry->vc, &t_state.cache_info.object_store, client_response_hdr_bytes,
- "cache write");
+
+ // Decide how many header bytes the cache-write consumer should skip.
+ // When a transform is present, setup_server_transfer_to_transform()
+ // creates the tunnel buffer with hdr_size=0, so the buffer contains
+ // only body data - no response headers to skip. When no transform is
+ // present, setup_server_transfer() writes the response header into the
+ // buffer, so skip_bytes must equal client_response_hdr_bytes.
+ int64_t cache_write_skip = (transform_info.entry == nullptr) ? client_response_hdr_bytes : 0;
Review Comment:
Review note: `transform_info.entry` is set by `HttpSM::do_post_transform_open()` or `HttpSM::do_transform_open()`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(http): stale `skip_bytes` in cache-write consumer after 100 Continue with transform [trafficserver]
Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 commented on code in PR #12906:
URL: https://github.com/apache/trafficserver/pull/12906#discussion_r2870052206
##########
tests/gold_tests/pluginTest/compress/compress_100_continue_origin.py:
##########
@@ -0,0 +1,126 @@
+#!/usr/bin/env python3
+"""Origin server that sends 100 Continue then a compressible 200 OK.
+
+Used to reproduce the crash in HttpTunnel::producer_run when compress.so
+with cache=true is combined with a 100 Continue response from the origin.
+"""
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import argparse
+import signal
+import socket
+import sys
+
+
+def parse_args():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--port', type=int, required=True, help='Port to listen on')
+ return parser.parse_args()
+
+
+def read_request(conn):
+ """Read an HTTP request from the connection, returning the raw bytes."""
+ data = b''
+ while b'\r\n\r\n' not in data:
+ chunk = conn.recv(4096)
+ if not chunk:
+ return None
+ data += chunk
+ return data
+
+
+def handle_connection(conn, addr):
+ """Handle a single client connection."""
+ try:
+ conn.settimeout(10)
+ request = read_request(conn)
+ if request is None:
+ return
+
+ # Send 100 Continue immediately.
+ conn.sendall(b'HTTP/1.1 100 Continue\r\n\r\n')
Review Comment:
Thank you for adding this test case. But I guess Proxy-Verifier supports `100 Continue` support. ( we can merge this first and change it later )
@bneradt can we cover this case with proxy-verifier?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org