<div dir="ltr">It is a default undertow instance with a HTTP listener, just set work threads to 200. Is there a default idle timeout? I can&#39; tell from javadoc and looking at the code.<div><br></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas <span dir="ltr">&lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
Edgar Espina wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;m not, channel does it.<br>
<br>
Problem is present on both. For example, home page has a content-length<br>
header but jquery.js use chunked.<br>
</blockquote>
<br></span>
In general if you are serving static resources you are better off setting the content length (slightly more efficient, and the browser can display progress on downloads).<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Do I have to call .endExchange? or closing the output stream is enough?<br>
</blockquote>
<br></span>
Closing the output stream is enough. endExchange is automatically called once the call stack returns anyway, unless you have dispatched the exchange or started async IO.<br>
<br>
The &#39;connection reset by peer&#39; error in the apache log while reading the status like kinda indicates that the request does not even get to this point anyway, and the underlying TCP connection is probably being torn down somehow.<br>
<br>
Do you have any kind of timeouts set? If you have an idle timeout set on the listener there is a race where Undertow can close the channel due to inactivity just as the front end starts to send a request.<br>
<br>
Stuart<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
Thanks<br>
<br>
On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas &lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a><br></span><span class="">
&lt;mailto:<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;&gt; wrote:<br>
<br>
    Another question, are you setting a content length on the responses?<br>
    If not the channel will automatically set one if the response fits<br>
    inside a buffer, otherwise chunked encoding will be used.<br>
<br>
    It might be helpful to know if this only happens on chunked, fixed<br>
    length or both.<br>
<br>
    Stuart<br>
<br>
    Edgar Espina wrote:<br>
<br>
        latest: 1.2.0.Beta8<br>
<br>
        On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas<br>
        &lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a> &lt;mailto:<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;<br></span><span class="">
        &lt;mailto:<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a> &lt;mailto:<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;&gt;&gt; wrote:<br>
<br>
             Also what version of Undertow are you using?<br>
<br>
             Stuart<br>
<br>
             ----- Original Message -----<br>
        &gt;   From: &quot;Edgar Espina&quot; &lt;<a href="mailto:espina.edgar@gmail.com" target="_blank">espina.edgar@gmail.com</a><br>
        &lt;mailto:<a href="mailto:espina.edgar@gmail.com" target="_blank">espina.edgar@gmail.com</a><u></u>&gt;<br></span><span class="">
        &lt;mailto:<a href="mailto:espina.edgar@gmail.com" target="_blank">espina.edgar@gmail.com</a> &lt;mailto:<a href="mailto:espina.edgar@gmail.com" target="_blank">espina.edgar@gmail.com</a><u></u>&gt;__&gt;&gt;<br>
        &gt;  To: &quot;Stuart Douglas&quot; &lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a><br>
        &lt;mailto:<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;<br></span><span class="">
        &lt;mailto:<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a> &lt;mailto:<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;&gt;&gt;<br>
        &gt;  Cc: <a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
        &lt;mailto:<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.<u></u>jboss.org</a>&gt;<br></span><div><div class="h5">
        &lt;mailto:<a href="mailto:undertow-dev@lists." target="_blank">undertow-dev@lists.</a>__<a href="http://jboss.org" target="_blank">j<u></u>boss.org</a><br>
        &lt;mailto:<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.<u></u>jboss.org</a>&gt;&gt;<br>
        &gt;  Sent: Monday, 19 January, 2015 11:13:21 AM<br>
        &gt;  Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy<br>
        &gt;<br>
        &gt;  found this in apache:<br>
        &gt;<br>
        &gt;  (104) Connection reset by peer: proxy: error reading status<br>
        line from<br>
        &gt;  remote server<br>
        &gt;<br>
        &gt;  but nothing in undertow.<br>
        &gt;<br>
        &gt;  got 502 on HTTP GET. Sometimes while calling the home page / or<br>
             when page<br>
        &gt;  loads OK, got 502 on page resources (js, css, images).<br>
        &gt;<br>
        &gt;  I call startBlocking and use the outputstream to write the<br>
             response, when<br>
        &gt;  everything has been written I call the &quot;outputstream.close&quot;<br>
             method. Do I<br>
        &gt;  need to call exchange.endExchange too?<br>
        &gt;<br>
        &gt;  Thanks<br>
        &gt;<br>
        &gt;  On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas<br>
        &lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a> &lt;mailto:<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;<br></div></div><span class="">
        &lt;mailto:<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a> &lt;mailto:<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;&gt;&gt; wrote:<br>
        &gt;<br>
        &gt;  &gt; Is there any info in the log? Or is there any specific type of<br>
             request<br>
        &gt;  &gt; that causes this?<br>
        &gt;  &gt;<br>
        &gt;  &gt; Stuart<br>
        &gt;  &gt;<br>
        &gt;  &gt;<br>
        &gt;  &gt; ----- Original Message -----<br>
        &gt;  &gt; &gt; From: &quot;Edgar Espina&quot; &lt;<a href="mailto:espina.edgar@gmail.com" target="_blank">espina.edgar@gmail.com</a><br>
        &lt;mailto:<a href="mailto:espina.edgar@gmail.com" target="_blank">espina.edgar@gmail.com</a><u></u>&gt;<br></span><div><div class="h5">
        &lt;mailto:<a href="mailto:espina.edgar@gmail.com" target="_blank">espina.edgar@gmail.com</a> &lt;mailto:<a href="mailto:espina.edgar@gmail.com" target="_blank">espina.edgar@gmail.com</a><u></u>&gt;__&gt;&gt;<br>
         &gt; &gt; &gt; To: <a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
        &lt;mailto:<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.<u></u>jboss.org</a>&gt;<br>
        &lt;mailto:<a href="mailto:undertow-dev@lists." target="_blank">undertow-dev@lists.</a>__<a href="http://jboss.org" target="_blank">j<u></u>boss.org</a><br>
        &lt;mailto:<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.<u></u>jboss.org</a>&gt;&gt;<br>
         &gt; &gt; &gt; Sent: Monday, 19 January, 2015 9:42:19 AM<br>
         &gt; &gt; &gt; Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy<br>
         &gt; &gt; &gt;<br>
         &gt; &gt; &gt; Hi,<br>
         &gt; &gt; &gt;<br>
         &gt; &gt; &gt; I&#39;ve an Undertow application behind apache reverse proxy,<br>
             trying to load<br>
         &gt; &gt; a<br>
         &gt; &gt; &gt; page displays error 502 proxy error.<br>
         &gt; &gt; &gt;<br>
         &gt; &gt; &gt; Still couldn&#39;t find why so I wonder if any of you find a<br>
             similar problem<br>
         &gt; &gt; with<br>
         &gt; &gt; &gt; Undertow and Apache.<br>
         &gt; &gt; &gt;<br>
         &gt; &gt; &gt; Please note this is our first app on top of Undertow,<br>
             existing apps<br>
         &gt; &gt; running<br>
         &gt; &gt; &gt; on Tomcat/Jetty are OK.<br>
         &gt; &gt; &gt;<br>
         &gt; &gt; &gt; Appreciate any help.<br>
         &gt; &gt; &gt;<br>
         &gt; &gt; &gt; Thanks<br>
         &gt; &gt; &gt;<br>
         &gt; &gt; &gt; --<br>
         &gt; &gt; &gt; edgar<br>
         &gt; &gt; &gt;<br></div></div>
         &gt; &gt; &gt; ______________________________<u></u>___________________<span class=""><br>
         &gt; &gt; &gt; undertow-dev mailing list<br>
         &gt; &gt; &gt; <a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
        &lt;mailto:<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.<u></u>jboss.org</a>&gt;<br></span>
        &lt;mailto:<a href="mailto:undertow-dev@lists." target="_blank">undertow-dev@lists.</a>__<a href="http://jboss.org" target="_blank">j<u></u>boss.org</a><br>
        &lt;mailto:<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.<u></u>jboss.org</a>&gt;&gt;<br>
        &gt;  &gt; &gt; <a href="https://lists.jboss.org/__mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/__<u></u>mailman/listinfo/undertow-dev</a><span class=""><br>
        &lt;<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/undertow-dev</a>&gt;<br>
        &gt;  &gt;<br>
        &gt;<br>
        &gt;<br>
        &gt;<br>
        &gt;  --<br>
        &gt;  edgar<br>
        &gt;<br>
<br>
<br>
<br>
<br>
        --<br>
        edgar<br>
<br>
<br>
<br>
<br>
--<br>
edgar<br>
</span></blockquote>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">edgar</div>
</div></div></div>