You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Presence of Transfer-Encoding and Content-Length headers leads to empty response #7230
When an object requested through ATS that has both Transfer-Encoding: Chunked and Content-Length headers, ATS appears to assume the object is chunked and follows those code paths accordingly. However, we observed a case on an object (<500 bytes, if relevant) that led the HttpSM to the following location:
This leads to a successful pssc (200, 206), pfsc=INTR, crc=ERR_READ_ERROR being logged, but an empty reply to the client. No response headers, no error message in the body; nothing. The only way to find the issue was to put ATS into debug, see the error message, then, armed with this knowledge, hunt for the issue. In our case, the Transfer-Encoding should not have been present.
While these headers should be used independently, it happened. If this were to occur in the future, our ideal state would be a real HTTP 5xx error response served to the client instead of nothing, and something more meaningful would be logged such that debug is no longer necessary to find the hint that this is the problem. pfsc=INTR is misleading, because the transaction completed successfully between ATS and the upstream system. Instead, ATS should have logged pfsc=FIN and, if anything, cfsc was INTR but that still is not really descriptive enough to know why the transaction was interrupted/aborted.
The system that served this object to ATS, was, itself, an ATS cache. It was able to successfully cache the object with both headers present, and presumably, the IMS process allowed this condition to remain for a prolonged period of time. A secondary aspect of this issue is that when ATS makes the request itself as a consequence of an ATS client request, it can cache the response and serve it successfully, as far as its logs are concerned. However, the downstream cache, while it is able to fully read the response and the upstream cache logs it as a success, it then aborts the request as described. One could argue that the upstream cache should have generated an error that would have propagated to the downstream cache.
Update: after further troubleshooting and testing, we now understand the cause of this issue.
Client facing ATS instance receives a request for an object that results in a cache miss
ATS proxies the request to another ATS instance, which is also is a cache miss
ATS proxies the request to the origin, receives a 200 OK and the object, fills its cache and returns the object
Client facing ATS receives this object and returns it to the client
n seconds later per Cache-Control: max-age, the object is revalidated by the ATS cache in front of the origin following a similar sequence:
Client facing ATS instance receives a request for an object that results in a cache miss
ATS proxies the request to another ATS instance that has the object in cache but it must be revalidated
ATS sends an IMS request to the origin, receives and a 304 Not Modified, however:
The origin also appends a Transfer-Encoding: chunked header that is merged into the cached headers
The origin doesn't send an accompanying 0\r\n chunk with the response
Client facing ATS receives the object from the upstream ATS cache with both a Content-Length and Transfer-Encoding header and the full body, but the chunk handling fails and lands in the block linked above and aborts the client's request
The origin's response appears to violate the intended use of Transfer-Encoding: chunked but the ATS cache that receives that response as a result of an IMS doesn't notice and caches the additional header. When that object is attempted to be served from that cache any time in the future, both headers are served, and the downstream ATS hosts are thrown off by the Transfer-Encoding: chunked header and lack of chunked response. For what it's worth, curl similarly gets confused by the presence of both headers.
This issue has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.
Activity
elsloo commentedon Oct 1, 2020
Update: after further troubleshooting and testing, we now understand the cause of this issue.
nseconds later perCache-Control: max-age, the object is revalidated by the ATS cache in front of the origin following a similar sequence:Transfer-Encoding: chunkedheader that is merged into the cached headers0\r\nchunk with the responseContent-LengthandTransfer-Encodingheader and the full body, but the chunk handling fails and lands in the block linked above and aborts the client's requestThe origin's response appears to violate the intended use of
Transfer-Encoding: chunkedbut the ATS cache that receives that response as a result of an IMS doesn't notice and caches the additional header. When that object is attempted to be served from that cache any time in the future, both headers are served, and the downstream ATS hosts are thrown off by theTransfer-Encoding: chunkedheader and lack of chunked response. For what it's worth, curl similarly gets confused by the presence of both headers.github-actions commentedon Oct 2, 2021
This issue has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.
bneradt commentedon Dec 7, 2021
@elsloo : can you please verify whether this is still an issue? I believe we no longer cache the Transfer-Encoding header and this should be fine.
elsloo commentedon Dec 7, 2021
This likely should have been closed via #7234. I don't believe this case applies since the introduction of that change.