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