Hi all,<div><br></div><div>I've got a curious problem with using ESI. We're building a JSON web service that is composed of smaller bits of JSON, and one of the requirements is that the callee can specify the number of records they get back (it's intranet facing but high load).</div>
<div><br></div><div>What we're seeing is that if a document esi:includes more than a certain number of other files, that the worker process dies and no data is returned to the browser.</div><div><br></div><div>As the "certain number" seemed to be variable using our live service, I built a quick test to find out where the limit was and to determine whether the limit had any special meaning (powers of 2, the obvious signs).</div>
<div><br></div><div>The test that I have that demonstrates the ESI processing failing requires:</div><div>1) Many unique files</div><div>2) Some files to esi:include the files in #1</div><div><br></div><div>Steps to reproduce:</div>
<div>1) Create the many unique files, bash helps here (run this in your web root):</div><div>for i in $(seq 1 1000); do echo $i > $i.htm; done </div><div><br></div><div>2) Include files that esi:includes the many unique files:</div>
<div><br></div><div>I had 4 test files:</div><div>index125.htm</div><div>index250.htm</div><div>index500.htm</div><div>index1000.htm</div><div><br></div><div>They each contained lines like these, the number of lines corresponding to the number in the index*.htm file name:</div>
<div><div>1 = <esi:include src="<a href="http://localhost/test/1.htm">http://localhost/test/1.htm</a>" />,</div><div>2 = <esi:include src="<a href="http://localhost/test/2.htm">http://localhost/test/2.htm</a>" />,</div>
<div>3 = <esi:include src="<a href="http://localhost/test/3.htm">http://localhost/test/3.htm</a>" />,</div><div>4 = <esi:include src="<a href="http://localhost/test/4.htm">http://localhost/test/4.htm</a>" />,</div>
<div>5 = <esi:include src="<a href="http://localhost/test/5.htm">http://localhost/test/5.htm</a>" />,</div><div>6 = <esi:include src="<a href="http://localhost/test/6.htm">http://localhost/test/6.htm</a>" />,</div>
<div>7 = <esi:include src="<a href="http://localhost/test/7.htm">http://localhost/test/7.htm</a>" />,</div><div>8 = <esi:include src="<a href="http://localhost/test/8.htm">http://localhost/test/8.htm</a>" />,</div>
<div>9 = <esi:include src="<a href="http://localhost/test/9.htm">http://localhost/test/9.htm</a>" />,</div><div>10 = <esi:include src="<a href="http://localhost/test/10.htm">http://localhost/test/10.htm</a>" />,</div>
</div><div><br></div><div>3) Access each index file, smallest to largest until it fails whilst logging using varnishlog.</div><div><br></div><div>For me, 125, 250 worked, 500 and 1,000 failed.</div><div><br></div><div>As soon as one of those returns no data to the browser, the problem is reproduced.</div>
<div><br></div><div><br></div><div><br></div><div>The interesting thing I found was in the logs for the failed attempts:</div><div><br></div><div><div><br></div><div>   12 Debug        c "tag {include src="<a href="http://localhost/test/207.htm">http://localhost/test/207.htm</a>" } 0 1 0"</div>
<div>   12 Debug        c "Incl " src="<a href="http://localhost/test/207.htm">http://localhost/test/207.htm</a>" ""</div><div>   12 Debug        c "tag {include src="<a href="http://localhost/test/208.htm">http://localhost/test/208.htm</a>" } 0 1 0"</div>
<div>    0 WorkThread   - 0x7f9d890afbf0 start</div><div>    0 CLI          - Rd vcl.load "boot" ./<a href="http://vcl.1P9zoqAU.so">vcl.1P9zoqAU.so</a></div><div>    0 CLI          - Wr 200 36 Loaded "./<a href="http://vcl.1P9zoqAU.so">vcl.1P9zoqAU.so</a>" as "boot"</div>
<div>    0 CLI          - Rd vcl.use "boot"</div><div>    0 CLI          - Wr 200 0 </div><div>    0 CLI          - Rd start</div><div>    0 Debug        - "Acceptor is epoll"</div><div>    0 CLI          - Wr 200 0 </div>
<div>    0 WorkThread   - 0x7f9d04bfebf0 start</div></div><div><br></div><div>It successfully processed the 250 entries file each time it was called, but when processing the 1,000 entries file it consistently and repeatedly showed that the worker process died at tag 208. Presumably this disconnected the request resulting in the symptom of "no data received" by the browser.</div>
<div><br></div><div>The question boils down to:</div><div>1) Is this behaviour a bug?</div><div>2) Is this behaviour the result of a by-design limitation? And if yes to this, what is the limitation and is it something we can change (i.e. ulimits)?</div>
<div><br></div><div>Varnish version is 2.1.4</div><div><br></div><div>Thanks in advance for any insight offered, and apologies in advance if I've jumped in and broken any mailing list etiquette by just pushing the question out there.</div>
<div><br></div><div>David</div>

<pre>[Information] -- PostMaster:
This transmission is intended solely for the addressee(s) and may be confidential. If you are not the named addressee, or if the message has been addressed to you in error, you must not read, disclose, reproduce, distribute or use this transmission. 

Delivery of this message to any person other than the named addressee is not intended in any way to waive confidentiality.  If you have received this transmission in error please contact the sender or delete the message. 

Thank you.

Yell Limited, One Reading Central, Forbury Road, Reading, Berkshire, RG1 3YL. Registered in England No. 4205228

Yellow Pages Sales Limited, One Reading Central,  Forbury Road, Reading, Berkshire, RG1 3YL. Registered in England No. 1403041