<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"><<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>></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>
> From: "Edgar Espina" <<a href="mailto:espina.edgar@gmail.com">espina.edgar@gmail.com</a>><br>
</span><div class="HOEnZb"><div class="h5">> To: "Stuart Douglas" <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>><br>
> Cc: <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> Sent: Monday, 19 January, 2015 12:10:16 PM<br>
> Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy<br>
><br>
> It is a default undertow instance with a HTTP listener, just set work<br>
> threads to 200. Is there a default idle timeout? I can' tell from javadoc<br>
> and looking at the code.<br>
><br>
><br>
> On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>> wrote:<br>
><br>
> ><br>
> ><br>
> > Edgar Espina wrote:<br>
> ><br>
> >> I'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>
> >><br>
> ><br>
> > In general if you are serving static resources you are better off setting<br>
> > the content length (slightly more efficient, and the browser can display<br>
> > progress on downloads).<br>
> ><br>
> ><br>
> >> Do I have to call .endExchange? or closing the output stream is enough?<br>
> >><br>
> ><br>
> > Closing the output stream is enough. endExchange is automatically called<br>
> > once the call stack returns anyway, unless you have dispatched the exchange<br>
> > or started async IO.<br>
> ><br>
> > The 'connection reset by peer' error in the apache log while reading the<br>
> > status like kinda indicates that the request does not even get to this<br>
> > point anyway, and the underlying TCP connection is probably being torn down<br>
> > somehow.<br>
> ><br>
> > Do you have any kind of timeouts set? If you have an idle timeout set on<br>
> > the listener there is a race where Undertow can close the channel due to<br>
> > inactivity just as the front end starts to send a request.<br>
> ><br>
> > Stuart<br>
> ><br>
> ><br>
> >> Thanks<br>
> >><br>
> >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a><br>
> >> <mailto:<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>>> 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>
> >> <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a> <mailto:<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>><br>
> >> <mailto:<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a> <mailto:<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>>>> wrote:<br>
> >><br>
> >> Also what version of Undertow are you using?<br>
> >><br>
> >> Stuart<br>
> >><br>
> >> ----- Original Message -----<br>
> >> > From: "Edgar Espina" <<a href="mailto:espina.edgar@gmail.com">espina.edgar@gmail.com</a><br>
> >> <mailto:<a href="mailto:espina.edgar@gmail.com">espina.edgar@gmail.com</a>><br>
> >> <mailto:<a href="mailto:espina.edgar@gmail.com">espina.edgar@gmail.com</a> <mailto:<a href="mailto:espina.edgar@gmail.com">espina.edgar@gmail.com</a><br>
> >> >__>><br>
> >> > To: "Stuart Douglas" <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a><br>
> >> <mailto:<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>><br>
> >> <mailto:<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a> <mailto:<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>>>><br>
> >> > Cc: <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> >> <mailto:<a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a>><br>
> >> <mailto:<a href="mailto:undertow-dev@lists.">undertow-dev@lists.</a>__<a href="http://jboss.org" target="_blank">jboss.org</a><br>
> >> <mailto:<a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a>>><br>
> >> > Sent: Monday, 19 January, 2015 11:13:21 AM<br>
> >> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP<br>
> >> Proxy<br>
> >> ><br>
> >> > found this in apache:<br>
> >> ><br>
> >> > (104) Connection reset by peer: proxy: error reading status<br>
> >> line from<br>
> >> > remote server<br>
> >> ><br>
> >> > but nothing in undertow.<br>
> >> ><br>
> >> > got 502 on HTTP GET. Sometimes while calling the home page / or<br>
> >> when page<br>
> >> > loads OK, got 502 on page resources (js, css, images).<br>
> >> ><br>
> >> > I call startBlocking and use the outputstream to write the<br>
> >> response, when<br>
> >> > everything has been written I call the "outputstream.close"<br>
> >> method. Do I<br>
> >> > need to call exchange.endExchange too?<br>
> >> ><br>
> >> > Thanks<br>
> >> ><br>
> >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas<br>
> >> <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a> <mailto:<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>><br>
> >> <mailto:<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a> <mailto:<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>>>> wrote:<br>
> >> ><br>
> >> > > Is there any info in the log? Or is there any specific type<br>
> >> of<br>
> >> request<br>
> >> > > that causes this?<br>
> >> > ><br>
> >> > > Stuart<br>
> >> > ><br>
> >> > ><br>
> >> > > ----- Original Message -----<br>
> >> > > > From: "Edgar Espina" <<a href="mailto:espina.edgar@gmail.com">espina.edgar@gmail.com</a><br>
> >> <mailto:<a href="mailto:espina.edgar@gmail.com">espina.edgar@gmail.com</a>><br>
> >> <mailto:<a href="mailto:espina.edgar@gmail.com">espina.edgar@gmail.com</a> <mailto:<a href="mailto:espina.edgar@gmail.com">espina.edgar@gmail.com</a><br>
> >> >__>><br>
> >> > > > To: <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> >> <mailto:<a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a>><br>
> >> <mailto:<a href="mailto:undertow-dev@lists.">undertow-dev@lists.</a>__<a href="http://jboss.org" target="_blank">jboss.org</a><br>
> >> <mailto:<a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a>>><br>
> >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM<br>
> >> > > > Subject: [undertow-dev] occasional 502 from Apache HTTP<br>
> >> Proxy<br>
> >> > > ><br>
> >> > > > Hi,<br>
> >> > > ><br>
> >> > > > I've an Undertow application behind apache reverse proxy,<br>
> >> trying to load<br>
> >> > > a<br>
> >> > > > page displays error 502 proxy error.<br>
> >> > > ><br>
> >> > > > Still couldn't find why so I wonder if any of you find a<br>
> >> similar problem<br>
> >> > > with<br>
> >> > > > Undertow and Apache.<br>
> >> > > ><br>
> >> > > > Please note this is our first app on top of Undertow,<br>
> >> existing apps<br>
> >> > > running<br>
> >> > > > on Tomcat/Jetty are OK.<br>
> >> > > ><br>
> >> > > > Appreciate any help.<br>
> >> > > ><br>
> >> > > > Thanks<br>
> >> > > ><br>
> >> > > > --<br>
> >> > > > edgar<br>
> >> > > ><br>
> >> > > > _________________________________________________<br>
> >> > > > undertow-dev mailing list<br>
> >> > > > <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> >> <mailto:<a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a>><br>
> >> <mailto:<a href="mailto:undertow-dev@lists.">undertow-dev@lists.</a>__<a href="http://jboss.org" target="_blank">jboss.org</a><br>
> >> <mailto:<a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a>>><br>
> >> > > > <a href="https://lists.jboss.org/__mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/__mailman/listinfo/undertow-dev</a><br>
> >> <<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a>><br>
> >> > ><br>
> >> ><br>
> >> ><br>
> >> ><br>
> >> > --<br>
> >> > edgar<br>
> >> ><br>
> >><br>
> >><br>
> >><br>
> >><br>
> >> --<br>
> >> edgar<br>
> >><br>
> >><br>
> >><br>
> >><br>
> >> --<br>
> >> edgar<br>
> >><br>
> ><br>
><br>
><br>
> --<br>
> edgar<br>
><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">edgar</div>
</div>