Mark Harrison created TS-2368:
---------------------------------
Summary: read while writer functionality not working
Key: TS-2368
URL: https://issues.apache.org/jira/browse/TS-2368
Project: Traffic Server
Issue Type: Bug
Components: Cache
Reporter: Mark Harrison
I'm seeing some unusual behavior when trying to use the read_while_writer
functionality in ATS 4.0.2.
My test case is a simple HTTP server that on each request will sleep for 5
seconds and then return a response (simulating a slow/overloaded origin
server). My test is to run curl against a URL and immediately (approx 1 second
later) run the same curl in another window.
Curl command: curl -v -x 127.0.0.1:80 http://foo.com/5
(a remap entry is in place for foo.com to the origin server)
The response is cacheable - I set Cache-Control: max-age headers and see cS in
the via header (or cH when there's a cache hit on subsequent requests).
I have proxy.config.cache.enable_read_while_writer set to 1 in records.config.
The expected behavior is that the second request will hang until the first
request is complete, and both with return at the same time with the data, and
that the origin server will see only one request.
The observed behavior is that both requests take 5 seconds from starting them,
and the origin server sees two requests.
After much hunting around running ATS under gdb, I spotted where I think the
issue is (although not why):
iocore/cache/CacheRead.cc line 205: if (!w->closed &&
!cache_config_read_while_writer)
ATS thinks that cache_config_read_while_writer is 0 at this point, despite it
being set in the config file. I discovered this by setting a breakpoint on
CacheVC::openReadChooseWriter and stepping through. This behavior also happens
if I compile with -O0.
If I change the code to ignore the value of cache_config_read_while_writer
(i.e. comment out that if statement), then I get the expected behavior and
read_while_writer appears to work.
My test machine is a vagrant vm, running centos 6.3, and ATS was compiled with
./configure CXXFLAGS=-O0 CFLAGS=-O0 --enable-layout=Gentoo
--enable-experimental-plugins --libdir=/usr/lib64/trafficserver
--with-tcl=/usr/lib64 --with-user=ats --with-group=ats
(I also compiled without the CXXFLAGS and CFLAGS - I added those in to make
working with gdb easier, but the behavior was the same).
--
This message was sent by Atlassian JIRA
(v6.1#6144)