<p dir="auto"><strong>Elasticsearch version</strong>: 2.3.2</p>
<p dir="auto"><strong>JVM version</strong>: openjdk-7-jre-headless:amd64   7u101-2.6.6-1~deb8u1</p>
<p dir="auto"><strong>OS version</strong>: Debian 8 64bit</p>
<p dir="auto"><strong>Description of the problem including expected versus actual behaviour</strong>:<br>
The number of file descriptors set by the Debian systemd service file mismatches Elasticsearches' startup check triggering a WARNing.</p>
<p dir="auto"><strong>Steps to reproduce</strong>:</p>
<ol dir="auto">
<li>Install elasticsearch package on Debian 8</li>
<li>Start elasticsearch</li>
<li>Watch the elasticsearch logfile</li>
</ol>
<p dir="auto"><strong>Provide logs (if relevant)</strong>:<br>
[2016-04-28 13:03:53,452][WARN ][env                      ] [node-1] max file descriptors [65535] for elasticsearch process likely too low, consider increasing to at least [65536]</p>
<p dir="auto">Using a dateHistogram query with <code class="notranslate">pre_zone</code> adjustment together with <code class="notranslate">pre_zone_adjust_large_interval = true</code> and <code class="notranslate">min_doc_count = 0</code> leads to an infinite loop and consequently OutOfMemory error.</p>
<p dir="auto">We have observed this in v1.0.2 and verified that the same issue is still in v1.3.1.</p>
<p dir="auto">To verify this, we used the <code class="notranslate">DateHistogramTests</code> test case <code class="notranslate">singleValue_WithPreZone_WithAadjustLargeInterval</code> and added the line <code class="notranslate">.minDocCount(0L)</code> to the <code class="notranslate">dateHistogram</code> builder.</p>
<p dir="auto">The issue seems to be in <code class="notranslate">InternalHistogram.reduce(ReduceContext)</code> in the <code class="notranslate">if (minDocCount == 0) {</code> branch. For the previous test case, the line <code class="notranslate">while (key != nextBucket.key) {</code> loops endlessly because the zone adjustments seem not to be taken into account.</p>
<p dir="auto">We have seen similar things with post_zone (unfortunately, I could not reproduce it with a test case).</p>