From mstefaniak at choicestream.com Thu Jan 1 18:32:35 2015 From: mstefaniak at choicestream.com (Mike Stefaniak) Date: Thu, 1 Jan 2015 18:32:35 -0500 Subject: [undertow-dev] HttpServerExchange post data Message-ID: I can't figure out how to get the content of post data My server start Undertow.builder() .addHttpListener(8080, "0.0.0.0") .setHandler(Handlers.routing().post("/bid", new BidHandler())) .build() .start(); And the handler class public final class BidHandler implements HttpHandler { @Override public void handleRequest(final HttpServerExchange exchange) throws Exception { ........ } } If I make a curl request like so curl -H "Content-Type: application/json" -X POST -i -d '{"some": "value"}' http://127.0.0.1:8080/bid It gets to the handler, but I can't figure out to access the post data from the request Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150101/2cd0f197/attachment.html From antoine at team51.nl Sun Jan 4 07:06:12 2015 From: antoine at team51.nl (Antoine Girard) Date: Sun, 4 Jan 2015 13:06:12 +0100 Subject: [undertow-dev] Authentication layer in Undertow + Resteasy Message-ID: Dear fellow developers, I am building a small web framework based on Jax-rs (Resteasy) and undertow (with undertow-servlet) and I am having interrogations about authenticating requests... First of all, I know I shouldn't re-invent the wheel and build another framework from scratch, but I am doing it purely for educational purposes (my education!) The setup is very simple: an embedded servlet container (undertow), bootstrapping one single jax-rs servlet (resteasy), with little glue around all of this et voil?! The user (person using the framework) only has to focus on his jax-rs resources. The servlet api already specifies how authentication should be done, and undertow implements it and I am not here to question that. However, what I want to achieve is to delegate all the authentication logic to the Jax-rs layer. I see two advantages in this: - The user has full control over the login / user management system, without having to tweak the servlet deployment... He can decide to do logins against a DB, a remote web service etc... all programatically. - Use the Jax-rs "DynamicFeature" feature.. to control what resources have to be secured. To illustrate it, here is a code sample of how I intend to use the DynamicFeature: *@Provider* *public class AuthenticationNeededFeature implements DynamicFeature {* * @Inject* * private AuthenticationFilter authenticationFilter;* * @Override* * public void configure(ResourceInfo resourceInfo, FeatureContext context) {* * /* If resource is not public then we add the authentication filter */* * if (!resourceInfo.getResourceMethod().isAnnotationPresent(Public.class)) {* * context.register(authenticationFilter);* * }* * }* *}* This simply checks if the targeted resource method has the annotation Public on it (custom annotation). If not, the resource must then be authenticated and a ContainerRequestFilter is registered, to apply the authentication logic. The user can do anything he wants to authenticate the request inside the filter: - Look in a custom Authorization header for a bearer token - Validate the token against a db or a cache - Play with cookies And more importantly, the securityContext, can be set here, as the Request object is available. The user can manufacture a securityContext containing the current user's principal and roles (after a successful authentication of the request) and therefore enable the role based access control in the resources (@RolesAllowed). I had a little try with adding a ServletExtension into the deployment, with a custom AuthenticationMechanism, but I couldn't achieve what is described above, as it is really jax-rs specific. I haven't seen a lot of people on the internet doing what I have described above... that's why I am not that confident! I am indeed bypassing all the security layer already available in Undertow. I feel I am missing the elephant in the room... What do you think about that approach? Thank you all in advance. Best regards, Antoine -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150104/86233a8c/attachment.html From sdouglas at redhat.com Sun Jan 4 18:19:37 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Sun, 4 Jan 2015 18:19:37 -0500 (EST) Subject: [undertow-dev] HttpServerExchange post data In-Reply-To: References: Message-ID: <697395340.2832798.1420413577580.JavaMail.zimbra@redhat.com> If you just want access to the raw data you have a 2 options: HttpServerExchange.getRequestChannel() HttpServerExchange.getInputStream() (exchange should have startBlocking called, and you need to dispatch to a worker thread so as not to block an IO thread) If you want access to parsed form/multipart data then you can use io.undertow.server.handlers.form.EagerFormParsingHandler, and the use exchange.gutAttachment(FormDataParser.FORM_DATA) to get access to the parsed data. Stuart ----- Original Message ----- > From: "Mike Stefaniak" > To: undertow-dev at lists.jboss.org > Sent: Friday, 2 January, 2015 10:32:35 AM > Subject: [undertow-dev] HttpServerExchange post data > > I can't figure out how to get the content of post data > > My server start > > Undertow.builder() > .addHttpListener(8080, "0.0.0.0") > .setHandler(Handlers.routing().post("/bid", new BidHandler())) > .build() > .start(); > > And the handler class > > public final class BidHandler implements HttpHandler { > > @Override > public void handleRequest(final HttpServerExchange exchange) throws Exception > { > ........ > } > } > > > If I make a curl request like so > > curl -H "Content-Type: application/json" -X POST -i -d '{"some": "value"}' > http://127.0.0.1:8080/bid > > It gets to the handler, but I can't figure out to access the post data from > the request > > Thanks > > > > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From sdouglas at redhat.com Sun Jan 4 20:20:40 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Sun, 4 Jan 2015 20:20:40 -0500 (EST) Subject: [undertow-dev] SEVERE: UT000004: getResponseChannel() has already been called In-Reply-To: <775551943.700459.1419466712403.JavaMail.yahoo@jws10078.mail.ne1.yahoo.com> References: <775551943.700459.1419466712403.JavaMail.yahoo@jws10078.mail.ne1.yahoo.com> Message-ID: <1600655132.2842828.1420420840639.JavaMail.zimbra@redhat.com> Yes, if you are using dispatch(HttpHandler) you need to call dispatch() every time, as otherwise the exchange will be ended when the call stack returns. If you call dispatch with no parameters or dispatch(Runnable) then you only need to call it once. Stuart ----- Original Message ----- > From: "Karthick V.J." > To: undertow-dev at lists.jboss.org > Sent: Thursday, 25 December, 2014 11:18:31 AM > Subject: [undertow-dev] SEVERE: UT000004: getResponseChannel() has already been called > > Hi Undertow Devs, > > I was getting the below error in my application. I created a sample > application which throws the same error (Attached is the sample applicaiton) > When I added the exchange.dispatch() statement at line 158, the problem > resolves. Is it required to dispatch () every time the context is switched > to a new thread. Am I doing it right? > > > Thank You - Karthick > > Error: > > ------------ > SEVERE: UT000004: getResponseChannel() has already been called > java.lang.IllegalStateException: UT000004: getResponseChannel() has already > been called > at io.undertow.io.AsyncSenderImpl.send(AsyncSenderImpl.java:208) > at io.undertow.io.AsyncSenderImpl.send(AsyncSenderImpl.java:294) > at io.undertow.io.AsyncSenderImpl.send(AsyncSenderImpl.java:270) > at io.undertow.io.AsyncSenderImpl.send(AsyncSenderImpl.java:300) > ..... > ..... > ..... > ..... > at com.google.common.util.concurrent.Futures$4.run(Futures.java:1181) > at > com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) > at > com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156) > at > com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145) > at > com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:185) > at > com.google.common.util.concurrent.Futures$ChainingListenableFuture$1.run(Futures.java:872) > at > com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) > at > com.google.common.util.concurrent.Futures$ImmediateFuture.addListener(Futures.java:102) > at > com.google.common.util.concurrent.Futures$ChainingListenableFuture.run(Futures.java:868) > at > com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) > at > com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156) > at > com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145) > at > com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:185) > at > com.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:105) > at > com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:246) > at com.datastax.driver.core.RequestHandler.onSet(RequestHandler.java:278) > at > com.datastax.driver.core.Connection$Dispatcher.messageReceived(Connection.java:661) > at > org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) > at > org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) > at > org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) > at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) > at > org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:70) > at > org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) > at > org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) > at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) > at > org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462) > at > org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443) > at > org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303) > at > org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) > at > org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) > at > org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) > at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) > at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) > at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) > at > org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) > at > org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318) > at > org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) > at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) > at > org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) > at > org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > at java.lang.Thread.run(Thread.java:745) > ------------ > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From y_lalo at yahoo.com Mon Jan 5 11:11:55 2015 From: y_lalo at yahoo.com (Kovacs Lajos) Date: Mon, 5 Jan 2015 16:11:55 +0000 (UTC) Subject: [undertow-dev] invalidate session Message-ID: <1811652347.4696969.1420474315113.JavaMail.yahoo@jws10641.mail.bf1.yahoo.com> Hidevelopers! ?? I recently changed to WildFly so to undertowtoo. Unfortunately I got an issue?and I hopethis dev list is the right place to questions regarding undertow.?? The issue occurs when there are two sessionsand I want to invalidate from one session A?the anotherone B. The session B is ?invalidated but unfortunately a new request fromsession A will create a new session C and Session A will remain in the memory.Digging alittle bit in the source code, I found that when the session B is invalidated, HttpSessionImpl.invalidate()function is called, where the 'exchange' object is got and passed to thesession.invalidate: ServletRequestContextcurrent = SecurityActions.currentServletRequestContext(); ? if (current == null) { ? ? ??session.invalidate(null); ? } else { ? ? ??session.invalidate(current.getOriginalRequest().getExchange()); ? } Then the session B instance InMemorySessionManager.invalidate () ?line 415 the following is called: ? if(exchange != null) { ? ? ??sessionCookieConfig.clearSession(exchange, this.getId()); ? } where theold session's?(Session B)?id ?what was removed, destroyed is placed as cookie with expired date onto the exchange(the response)? Cookie cookie = new CookieImpl(cookieName, sessionId) ? ...? exchange.setResponseCookie(cookie); So the nextrequest will not contain the right cookie so the session will not be found anda new session will be created (ServletContextImpl.getSession()). That's the main cause what I see. I checkedissue UNDERTOW-261 what is sounds very similar, but this is not the casebecause the session remains active in the memory but a new one still created. Usedundertow 1.1.x branch for sources, as WildFly 8.2.0 with undertow 1.1.0.Final. ?I?m doingsomething wrong or it is a bug? Any feedback is appreciated. Thanks in advance! Best Regards,lalo -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150105/6b163316/attachment-0001.html From arjan.tijms at gmail.com Mon Jan 5 13:28:20 2015 From: arjan.tijms at gmail.com (arjan tijms) Date: Mon, 5 Jan 2015 19:28:20 +0100 Subject: [undertow-dev] Authentication layer in Undertow + Resteasy In-Reply-To: References: Message-ID: Hi, On Sunday, January 4, 2015, Antoine Girard wrote: > I had a little try with adding a ServletExtension into the deployment, > with a custom AuthenticationMechanism, but I couldn't achieve what is > described above, as it is really jax-rs specific. > > I haven't seen a lot of people on the internet doing what I have described > above... that's why I am not that confident! I am indeed bypassing all the > security layer already available in Undertow. I feel I am missing the > elephant in the room... > Maybe the name of that elephant is JASPIC ;) Take a look at http://arjan-tijms.omnifaces.org/2014/11/header-based-stateless-token.html It's an authentication module that integrates fully with container security, and can be registered either from within the app (as the sample in the link above demonstrates) or more traditionally at the container level. Undertow has really good support for JASPIC and the default stateless mode makes it ideal to be used with JAX-RS. Kind regards, Arjan Tijms > > What do you think about that approach? > > Thank you all in advance. > > Best regards, > Antoine > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150105/85ecb586/attachment.html From sdouglas at redhat.com Mon Jan 5 20:15:36 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Mon, 5 Jan 2015 20:15:36 -0500 (EST) Subject: [undertow-dev] invalidate session In-Reply-To: <1811652347.4696969.1420474315113.JavaMail.yahoo@jws10641.mail.bf1.yahoo.com> References: <1811652347.4696969.1420474315113.JavaMail.yahoo@jws10641.mail.bf1.yahoo.com> Message-ID: <1152635109.3350423.1420506936453.JavaMail.zimbra@redhat.com> I have pushed a potential solution into the 1.1.x branch. Stuart ----- Original Message ----- > From: "Kovacs Lajos" > To: undertow-dev at lists.jboss.org > Sent: Tuesday, 6 January, 2015 3:11:55 AM > Subject: [undertow-dev] invalidate session > > Hi developers! > I recently changed to WildFly so to undertow too. Unfortunately I got an > issue and I hope this dev list is the right place to questions regarding > undertow. > The issue occurs when there are two sessions and I want to invalidate from > one session A the another one B. The session B is invalidated but > unfortunately a new request from session A will create a new session C and > Session A will remain in the memory. > Digging a little bit in the source code, I found that when the session B is > invalidated, HttpSessionImpl.invalidate() function is called, where the > 'exchange' object is got and passed to the session.invalidate: > > ServletRequestContext current = > SecurityActions.currentServletRequestContext(); > if (current == null) { > session.invalidate(null); > } else { > session.invalidate(current.getOriginalRequest().getExchange()); > } > > Then the session B instance InMemorySessionManager.invalidate () line 415 the > following is called: > if (exchange != null) { > sessionCookieConfig.clearSession(exchange, this.getId()); > } > > where the old session's (Session B) id what was removed, destroyed is placed > as cookie with expired date onto the exchange (the response) > Cookie cookie = new CookieImpl (cookieName, sessionId) > ... > exchange . setResponseCookie(cookie); > > So the next request will not contain the right cookie so the session will not > be found and a new session will be created > (ServletContextImpl.getSession()). That's the main cause what I see. > > I checked issue UNDERTOW-261 what is sounds very similar, but this is not the > case because the session remains active in the memory but a new one still > created. > > Used undertow 1.1.x branch for sources, as WildFly 8.2.0 with undertow > 1.1.0.Final. > I?m doing something wrong or it is a bug? Any feedback is appreciated. Thanks > in advance! > > Best Regards, > lalo > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From sdouglas at redhat.com Mon Jan 5 20:25:13 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Mon, 5 Jan 2015 20:25:13 -0500 (EST) Subject: [undertow-dev] Authentication layer in Undertow + Resteasy In-Reply-To: References: Message-ID: <1359114632.3351839.1420507513138.JavaMail.zimbra@redhat.com> It sounds a bit like you want a custom authentication mechanism, and the filter just calls HttpServletRequest.authenticate(). The mechanism has fill access to the exchange, so if you need to propagate some JAX-RS specific information you could just add it to a servlet request attribute. Stuart ----- Original Message ----- > From: "Antoine Girard" > To: resteasy-developers at lists.sourceforge.net, undertow-dev at lists.jboss.org > Sent: Sunday, 4 January, 2015 11:06:12 PM > Subject: [undertow-dev] Authentication layer in Undertow + Resteasy > > Dear fellow developers, > > I am building a small web framework based on Jax-rs (Resteasy) and undertow > (with undertow-servlet) and I am having interrogations about authenticating > requests... > First of all, I know I shouldn't re-invent the wheel and build another > framework from scratch, but I am doing it purely for educational purposes > (my education!) > > The setup is very simple: an embedded servlet container (undertow), > bootstrapping one single jax-rs servlet (resteasy), with little glue around > all of this et voil?! The user (person using the framework) only has to > focus on his jax-rs resources. > > The servlet api already specifies how authentication should be done, and > undertow implements it and I am not here to question that. > However, what I want to achieve is to delegate all the authentication logic > to the Jax-rs layer. > I see two advantages in this: > - The user has full control over the login / user management system, without > having to tweak the servlet deployment... He can decide to do logins against > a DB, a remote web service etc... all programatically. > - Use the Jax-rs "DynamicFeature" feature.. to control what resources have to > be secured. To illustrate it, here is a code sample of how I intend to use > the DynamicFeature: > > @Provider > public class AuthenticationNeededFeature implements DynamicFeature { > > @Inject > private AuthenticationFilter authenticationFilter; > @Override > public void configure(ResourceInfo resourceInfo, FeatureContext context) { > > /* If resource is not public then we add the authentication filter */ > if (!resourceInfo.getResourceMethod().isAnnotationPresent(Public.class)) { > context.register(authenticationFilter); > } > } > } > > This simply checks if the targeted resource method has the annotation Public > on it (custom annotation). If not, the resource must then be authenticated > and a ContainerRequestFilter is registered, to apply the authentication > logic. > > The user can do anything he wants to authenticate the request inside the > filter: > - Look in a custom Authorization header for a bearer token > - Validate the token against a db or a cache > - Play with cookies > > And more importantly, the securityContext, can be set here, as the Request > object is available. > The user can manufacture a securityContext containing the current user's > principal and roles (after a successful authentication of the request) and > therefore enable the role based access control in the resources > (@RolesAllowed). > > I had a little try with adding a ServletExtension into the deployment, with a > custom AuthenticationMechanism, but I couldn't achieve what is described > above, as it is really jax-rs specific. > > I haven't seen a lot of people on the internet doing what I have described > above... that's why I am not that confident! I am indeed bypassing all the > security layer already available in Undertow. I feel I am missing the > elephant in the room... > > What do you think about that approach? > > Thank you all in advance. > > Best regards, > Antoine > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From mstefaniak at choicestream.com Mon Jan 5 23:26:30 2015 From: mstefaniak at choicestream.com (Mike Stefaniak) Date: Mon, 5 Jan 2015 23:26:30 -0500 Subject: [undertow-dev] HttpServerExchange post data In-Reply-To: <697395340.2832798.1420413577580.JavaMail.zimbra@redhat.com> References: <697395340.2832798.1420413577580.JavaMail.zimbra@redhat.com> Message-ID: Thanks, I ended up figuring out how to do the second method you listed. Is there any advantage to one verse the other? On Sun, Jan 4, 2015 at 6:19 PM, Stuart Douglas wrote: > If you just want access to the raw data you have a 2 options: > > HttpServerExchange.getRequestChannel() > HttpServerExchange.getInputStream() (exchange should have startBlocking > called, and you need to dispatch to a worker thread so as not to block an > IO thread) > > If you want access to parsed form/multipart data then you can use > io.undertow.server.handlers.form.EagerFormParsingHandler, and the use > exchange.gutAttachment(FormDataParser.FORM_DATA) to get access to the > parsed data. > > Stuart > > > ----- Original Message ----- > > From: "Mike Stefaniak" > > To: undertow-dev at lists.jboss.org > > Sent: Friday, 2 January, 2015 10:32:35 AM > > Subject: [undertow-dev] HttpServerExchange post data > > > > I can't figure out how to get the content of post data > > > > My server start > > > > Undertow.builder() > > .addHttpListener(8080, "0.0.0.0") > > .setHandler(Handlers.routing().post("/bid", new BidHandler())) > > .build() > > .start(); > > > > And the handler class > > > > public final class BidHandler implements HttpHandler { > > > > @Override > > public void handleRequest(final HttpServerExchange exchange) throws > Exception > > { > > ........ > > } > > } > > > > > > If I make a curl request like so > > > > curl -H "Content-Type: application/json" -X POST -i -d '{"some": > "value"}' > > http://127.0.0.1:8080/bid > > > > It gets to the handler, but I can't figure out to access the post data > from > > the request > > > > Thanks > > > > > > > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150105/d2f214d5/attachment.html From sdouglas at redhat.com Tue Jan 6 00:07:30 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Tue, 6 Jan 2015 00:07:30 -0500 (EST) Subject: [undertow-dev] HttpServerExchange post data In-Reply-To: References: <697395340.2832798.1420413577580.JavaMail.zimbra@redhat.com> Message-ID: <1325032340.3437198.1420520850061.JavaMail.zimbra@redhat.com> By second method do you mean the input stream or the parsers? If you just want form data just use the built in parsers, if you need access to the raw bytes then you need the input stream or the channel. The channel lets you use non-blocking IO which can perform better, however it is a bit harder to use that the input stream as you need to register callbacks. Stuart ----- Original Message ----- > From: "Mike Stefaniak" > To: "Stuart Douglas" > Cc: undertow-dev at lists.jboss.org > Sent: Tuesday, 6 January, 2015 3:26:30 PM > Subject: Re: [undertow-dev] HttpServerExchange post data > > Thanks, I ended up figuring out how to do the second method you listed. Is > there any advantage to one verse the other? > > On Sun, Jan 4, 2015 at 6:19 PM, Stuart Douglas wrote: > > > If you just want access to the raw data you have a 2 options: > > > > HttpServerExchange.getRequestChannel() > > HttpServerExchange.getInputStream() (exchange should have startBlocking > > called, and you need to dispatch to a worker thread so as not to block an > > IO thread) > > > > If you want access to parsed form/multipart data then you can use > > io.undertow.server.handlers.form.EagerFormParsingHandler, and the use > > exchange.gutAttachment(FormDataParser.FORM_DATA) to get access to the > > parsed data. > > > > Stuart > > > > > > ----- Original Message ----- > > > From: "Mike Stefaniak" > > > To: undertow-dev at lists.jboss.org > > > Sent: Friday, 2 January, 2015 10:32:35 AM > > > Subject: [undertow-dev] HttpServerExchange post data > > > > > > I can't figure out how to get the content of post data > > > > > > My server start > > > > > > Undertow.builder() > > > .addHttpListener(8080, "0.0.0.0") > > > .setHandler(Handlers.routing().post("/bid", new BidHandler())) > > > .build() > > > .start(); > > > > > > And the handler class > > > > > > public final class BidHandler implements HttpHandler { > > > > > > @Override > > > public void handleRequest(final HttpServerExchange exchange) throws > > Exception > > > { > > > ........ > > > } > > > } > > > > > > > > > If I make a curl request like so > > > > > > curl -H "Content-Type: application/json" -X POST -i -d '{"some": > > "value"}' > > > http://127.0.0.1:8080/bid > > > > > > It gets to the handler, but I can't figure out to access the post data > > from > > > the request > > > > > > Thanks > > > > > > > > > > > > > > > _______________________________________________ > > > undertow-dev mailing list > > > undertow-dev at lists.jboss.org > > > https://lists.jboss.org/mailman/listinfo/undertow-dev > > > From mstefaniak at choicestream.com Tue Jan 6 00:30:08 2015 From: mstefaniak at choicestream.com (Mike Stefaniak) Date: Tue, 6 Jan 2015 00:30:08 -0500 Subject: [undertow-dev] HttpServerExchange post data In-Reply-To: <1325032340.3437198.1420520850061.JavaMail.zimbra@redhat.com> References: <697395340.2832798.1420413577580.JavaMail.zimbra@redhat.com> <1325032340.3437198.1420520850061.JavaMail.zimbra@redhat.com> Message-ID: I ended up dispatching to a worker thread and using input stream. I do need access to the raw post data. Do you have an example of how to use channel so I could try it for comparison sake? On Tue, Jan 6, 2015 at 12:07 AM, Stuart Douglas wrote: > By second method do you mean the input stream or the parsers? > > If you just want form data just use the built in parsers, if you need > access to the raw bytes then you need the input stream or the channel. The > channel lets you use non-blocking IO which can perform better, however it > is a bit harder to use that the input stream as you need to register > callbacks. > > Stuart > > ----- Original Message ----- > > From: "Mike Stefaniak" > > To: "Stuart Douglas" > > Cc: undertow-dev at lists.jboss.org > > Sent: Tuesday, 6 January, 2015 3:26:30 PM > > Subject: Re: [undertow-dev] HttpServerExchange post data > > > > Thanks, I ended up figuring out how to do the second method you listed. > Is > > there any advantage to one verse the other? > > > > On Sun, Jan 4, 2015 at 6:19 PM, Stuart Douglas > wrote: > > > > > If you just want access to the raw data you have a 2 options: > > > > > > HttpServerExchange.getRequestChannel() > > > HttpServerExchange.getInputStream() (exchange should have startBlocking > > > called, and you need to dispatch to a worker thread so as not to block > an > > > IO thread) > > > > > > If you want access to parsed form/multipart data then you can use > > > io.undertow.server.handlers.form.EagerFormParsingHandler, and the use > > > exchange.gutAttachment(FormDataParser.FORM_DATA) to get access to the > > > parsed data. > > > > > > Stuart > > > > > > > > > ----- Original Message ----- > > > > From: "Mike Stefaniak" > > > > To: undertow-dev at lists.jboss.org > > > > Sent: Friday, 2 January, 2015 10:32:35 AM > > > > Subject: [undertow-dev] HttpServerExchange post data > > > > > > > > I can't figure out how to get the content of post data > > > > > > > > My server start > > > > > > > > Undertow.builder() > > > > .addHttpListener(8080, "0.0.0.0") > > > > .setHandler(Handlers.routing().post("/bid", new BidHandler())) > > > > .build() > > > > .start(); > > > > > > > > And the handler class > > > > > > > > public final class BidHandler implements HttpHandler { > > > > > > > > @Override > > > > public void handleRequest(final HttpServerExchange exchange) throws > > > Exception > > > > { > > > > ........ > > > > } > > > > } > > > > > > > > > > > > If I make a curl request like so > > > > > > > > curl -H "Content-Type: application/json" -X POST -i -d '{"some": > > > "value"}' > > > > http://127.0.0.1:8080/bid > > > > > > > > It gets to the handler, but I can't figure out to access the post > data > > > from > > > > the request > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > undertow-dev mailing list > > > > undertow-dev at lists.jboss.org > > > > https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150106/a88231c6/attachment-0001.html From sdouglas at redhat.com Tue Jan 6 00:34:56 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Tue, 06 Jan 2015 16:34:56 +1100 Subject: [undertow-dev] HttpServerExchange post data In-Reply-To: References: <697395340.2832798.1420413577580.JavaMail.zimbra@redhat.com> <1325032340.3437198.1420520850061.JavaMail.zimbra@redhat.com> Message-ID: <54AB7400.4070708@redhat.com> io.undertow.util.StringReadChannelListener is probably the simples example. Basically the idea is you keep calling read() until it returns 0 (or -1 if the stream is done), then when it returns 0 you call channel.getReadSetter().set(myReadListener) channel.resumeReads() your listener will be notified when more data is available and you can attempt to read again. We have been talking about adding some kind of simpler async reader API, however we are not sure yet exactly what form this will take. Stuart Mike Stefaniak wrote: > I ended up dispatching to a worker thread and using input stream. I do > need access to the raw post data. Do you have an example of how to use > channel so I could try it for comparison sake? > > On Tue, Jan 6, 2015 at 12:07 AM, Stuart Douglas > wrote: > > By second method do you mean the input stream or the parsers? > > If you just want form data just use the built in parsers, if you > need access to the raw bytes then you need the input stream or the > channel. The channel lets you use non-blocking IO which can perform > better, however it is a bit harder to use that the input stream as > you need to register callbacks. > > Stuart > > ----- Original Message ----- > > From: "Mike Stefaniak" > > > To: "Stuart Douglas" > > > Cc: undertow-dev at lists.jboss.org > > > Sent: Tuesday, 6 January, 2015 3:26:30 PM > > Subject: Re: [undertow-dev] HttpServerExchange post data > > > > Thanks, I ended up figuring out how to do the second method you > listed. Is > > there any advantage to one verse the other? > > > > On Sun, Jan 4, 2015 at 6:19 PM, Stuart Douglas > > wrote: > > > > > If you just want access to the raw data you have a 2 options: > > > > > > HttpServerExchange.getRequestChannel() > > > HttpServerExchange.getInputStream() (exchange should have > startBlocking > > > called, and you need to dispatch to a worker thread so as not > to block an > > > IO thread) > > > > > > If you want access to parsed form/multipart data then you can use > > > io.undertow.server.handlers.form.EagerFormParsingHandler, and > the use > > > exchange.gutAttachment(FormDataParser.FORM_DATA) to get access > to the > > > parsed data. > > > > > > Stuart > > > > > > > > > ----- Original Message ----- > > > > From: "Mike Stefaniak" > > > > > To: undertow-dev at lists.jboss.org > > > > > Sent: Friday, 2 January, 2015 10:32:35 AM > > > > Subject: [undertow-dev] HttpServerExchange post data > > > > > > > > I can't figure out how to get the content of post data > > > > > > > > My server start > > > > > > > > Undertow.builder() > > > > .addHttpListener(8080, "0.0.0.0") > > > > .setHandler(Handlers.routing().post("/bid", new BidHandler())) > > > > .build() > > > > .start(); > > > > > > > > And the handler class > > > > > > > > public final class BidHandler implements HttpHandler { > > > > > > > > @Override > > > > public void handleRequest(final HttpServerExchange exchange) > throws > > > Exception > > > > { > > > > ........ > > > > } > > > > } > > > > > > > > > > > > If I make a curl request like so > > > > > > > > curl -H "Content-Type: application/json" -X POST -i -d '{"some": > > > "value"}' > > > > http://127.0.0.1:8080/bid > > > > > > > > It gets to the handler, but I can't figure out to access the > post data > > > from > > > > the request > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > undertow-dev mailing list > > > > undertow-dev at lists.jboss.org > > > > > https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > > > > From antoine at team51.nl Tue Jan 6 05:40:09 2015 From: antoine at team51.nl (Antoine Girard) Date: Tue, 6 Jan 2015 11:40:09 +0100 Subject: [undertow-dev] Authentication layer in Undertow + Resteasy In-Reply-To: <1359114632.3351839.1420507513138.JavaMail.zimbra@redhat.com> References: <1359114632.3351839.1420507513138.JavaMail.zimbra@redhat.com> Message-ID: Hi Arjan, Stuart, Thanks for your replies. It's getting clearer and Jaspic is indeed a good name for an elephant! The documentation on Jaspic seems to be sparse, and I am not sure I want to tackle it for my little "proof of concept." I have had a deeper look at Undertow's authentication layer, and what Stuart suggested is indeed the way to go. It's in fact pretty much similar to what I had in mind with my custom solution with the Jax-RS filter. So in that respect, I am reassured to see that I was not doing something totally insane. I am using Resteasy with the Guice extension, so I believe I will have troubles to make the custom IdentityManager and AuthenticationMechanism being guice managed beans, but also to have them available before the servlet container starts (when the guice container is bootstrapped), to register then in the DeploymentInfo! But that's something that I can solve, I believe! Thanks agains for your answers. Best regards, Antoine On 6 January 2015 at 02:25, Stuart Douglas wrote: > It sounds a bit like you want a custom authentication mechanism, and the > filter just calls HttpServletRequest.authenticate(). The mechanism has fill > access to the exchange, so if you need to propagate some JAX-RS specific > information you could just add it to a servlet request attribute. > > Stuart > > ----- Original Message ----- > > From: "Antoine Girard" > > To: resteasy-developers at lists.sourceforge.net, > undertow-dev at lists.jboss.org > > Sent: Sunday, 4 January, 2015 11:06:12 PM > > Subject: [undertow-dev] Authentication layer in Undertow + Resteasy > > > > Dear fellow developers, > > > > I am building a small web framework based on Jax-rs (Resteasy) and > undertow > > (with undertow-servlet) and I am having interrogations about > authenticating > > requests... > > First of all, I know I shouldn't re-invent the wheel and build another > > framework from scratch, but I am doing it purely for educational purposes > > (my education!) > > > > The setup is very simple: an embedded servlet container (undertow), > > bootstrapping one single jax-rs servlet (resteasy), with little glue > around > > all of this et voil?! The user (person using the framework) only has to > > focus on his jax-rs resources. > > > > The servlet api already specifies how authentication should be done, and > > undertow implements it and I am not here to question that. > > However, what I want to achieve is to delegate all the authentication > logic > > to the Jax-rs layer. > > I see two advantages in this: > > - The user has full control over the login / user management system, > without > > having to tweak the servlet deployment... He can decide to do logins > against > > a DB, a remote web service etc... all programatically. > > - Use the Jax-rs "DynamicFeature" feature.. to control what resources > have to > > be secured. To illustrate it, here is a code sample of how I intend to > use > > the DynamicFeature: > > > > @Provider > > public class AuthenticationNeededFeature implements DynamicFeature { > > > > @Inject > > private AuthenticationFilter authenticationFilter; > > @Override > > public void configure(ResourceInfo resourceInfo, FeatureContext context) > { > > > > /* If resource is not public then we add the authentication filter */ > > if (!resourceInfo.getResourceMethod().isAnnotationPresent(Public.class)) > { > > context.register(authenticationFilter); > > } > > } > > } > > > > This simply checks if the targeted resource method has the annotation > Public > > on it (custom annotation). If not, the resource must then be > authenticated > > and a ContainerRequestFilter is registered, to apply the authentication > > logic. > > > > The user can do anything he wants to authenticate the request inside the > > filter: > > - Look in a custom Authorization header for a bearer token > > - Validate the token against a db or a cache > > - Play with cookies > > > > And more importantly, the securityContext, can be set here, as the > Request > > object is available. > > The user can manufacture a securityContext containing the current user's > > principal and roles (after a successful authentication of the request) > and > > therefore enable the role based access control in the resources > > (@RolesAllowed). > > > > I had a little try with adding a ServletExtension into the deployment, > with a > > custom AuthenticationMechanism, but I couldn't achieve what is described > > above, as it is really jax-rs specific. > > > > I haven't seen a lot of people on the internet doing what I have > described > > above... that's why I am not that confident! I am indeed bypassing all > the > > security layer already available in Undertow. I feel I am missing the > > elephant in the room... > > > > What do you think about that approach? > > > > Thank you all in advance. > > > > Best regards, > > Antoine > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > -- *Antoine Girard // A-91* *T. +31(0)20 737 01 88* *Team51 B.V.*Vlaardingenlaan 15 1062 HM Amsterdam -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150106/56c79083/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: T-51 Antoine.png Type: image/png Size: 4748 bytes Desc: not available Url : http://lists.jboss.org/pipermail/undertow-dev/attachments/20150106/56c79083/attachment.png From y_lalo at yahoo.com Tue Jan 6 09:46:27 2015 From: y_lalo at yahoo.com (Kovacs Lajos) Date: Tue, 6 Jan 2015 14:46:27 +0000 (UTC) Subject: [undertow-dev] invalidate session In-Reply-To: <1152635109.3350423.1420506936453.JavaMail.zimbra@redhat.com> References: <1152635109.3350423.1420506936453.JavaMail.zimbra@redhat.com> Message-ID: <951165327.5259761.1420555587423.JavaMail.yahoo@jws106149.mail.bf1.yahoo.com> ? Hi! ? ? ?I tested with the latest version from the branch and it is working correctly now. :)? ? ?Thank you a lot! ? Best Regards,? Lalo From: Stuart Douglas To: Kovacs Lajos Cc: undertow-dev at lists.jboss.org Sent: Tuesday, January 6, 2015 3:15 AM Subject: Re: [undertow-dev] invalidate session I have pushed a potential solution into the 1.1.x branch. Stuart ----- Original Message ----- > From: "Kovacs Lajos" > To: undertow-dev at lists.jboss.org > Sent: Tuesday, 6 January, 2015 3:11:55 AM > Subject: [undertow-dev] invalidate session > > Hi developers! > I recently changed to WildFly so to undertow too. Unfortunately I got an > issue and I hope this dev list is the right place to questions regarding > undertow. > The issue occurs when there are two sessions and I want to invalidate from > one session A the another one B. The session B is invalidated but > unfortunately a new request from session A will create a new session C and > Session A will remain in the memory. > Digging a little bit in the source code, I found that when the session B is > invalidated, HttpSessionImpl.invalidate() function is called, where the > 'exchange' object is got and passed to the session.invalidate: > > ServletRequestContext current = > SecurityActions.currentServletRequestContext(); > if (current == null) { > session.invalidate(null); > } else { > session.invalidate(current.getOriginalRequest().getExchange()); > } > > Then the session B instance InMemorySessionManager.invalidate () line 415 the > following is called: > if (exchange != null) { > sessionCookieConfig.clearSession(exchange, this.getId()); > } > > where the old session's (Session B) id what was removed, destroyed is placed > as cookie with expired date onto the exchange (the response) > Cookie cookie = new CookieImpl (cookieName, sessionId) > ... > exchange . setResponseCookie(cookie); > > So the next request will not contain the right cookie so the session will not > be found and a new session will be created > (ServletContextImpl.getSession()). That's the main cause what I see. > > I checked issue UNDERTOW-261 what is sounds very similar, but this is not the > case because the session remains active in the memory but a new one still > created. > > Used undertow 1.1.x branch for sources, as WildFly 8.2.0 with undertow > 1.1.0.Final. > I?m doing something wrong or it is a bug? Any feedback is appreciated. Thanks > in advance! > > Best Regards, > lalo > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150106/ff17ffe0/attachment-0001.html From toby at tcrawley.org Tue Jan 6 17:38:36 2015 From: toby at tcrawley.org (Toby Crawley) Date: Tue, 6 Jan 2015 17:38:36 -0500 Subject: [undertow-dev] Closing an UndertowOutputStream on broken pipe Message-ID: I'm streaming data by writing it to an UndertowOutputStream in chunks, and when the the client disconnects before the data is fully sent, I get a Broken pipe IOException when calling .write() (which is expected). I catch that error, then call .close() on the UndertowOutputStream, which throws "java.io.IOException: UT000029: Channel was closed mid chunk, if you have attempted to write chunked data you cannot shutdown the channel until after it has all been written." Is this expected behavior? It seems like it wouldn't be, since none of that pending data can be written. Do I even need to close the OutputStream in this case? Would not doing so leak any resources? Currently, I'm catching and ignoring the IOException thrown by .close(). The full stack traces of the two errors are available at: https://gist.github.com/21d111980352d04816c7 - Toby From sdouglas at redhat.com Tue Jan 6 17:56:27 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Tue, 6 Jan 2015 17:56:27 -0500 (EST) Subject: [undertow-dev] Closing an UndertowOutputStream on broken pipe In-Reply-To: References: Message-ID: <353025897.3943732.1420584987599.JavaMail.zimbra@redhat.com> You are correct, this is a bug. I think the channel should probably take note of the first exception, and then not do anything on close, or maybe the chunked stream should not throw an exception on close, as even though it is an error condition it will generally only happen when something else has already gone wrote, so throwing an exception is not overly helpful. Stuart ----- Original Message ----- > From: "Toby Crawley" > To: undertow-dev at lists.jboss.org > Sent: Wednesday, 7 January, 2015 9:38:36 AM > Subject: [undertow-dev] Closing an UndertowOutputStream on broken pipe > > I'm streaming data by writing it to an UndertowOutputStream in chunks, > and when the the client disconnects before the data is fully sent, I > get a Broken pipe IOException when calling .write() (which is > expected). I catch that error, then call .close() on the > UndertowOutputStream, which throws "java.io.IOException: UT000029: > Channel was closed mid chunk, if you have attempted to write chunked > data you cannot shutdown the channel until after it has all been > written." > > Is this expected behavior? It seems like it wouldn't be, since none of > that pending data can be written. > > Do I even need to close the OutputStream in this case? Would not doing > so leak any resources? > > Currently, I'm catching and ignoring the IOException thrown by .close(). > > The full stack traces of the two errors are available at: > https://gist.github.com/21d111980352d04816c7 > > - Toby > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev > From jason.greene at redhat.com Tue Jan 6 18:02:26 2015 From: jason.greene at redhat.com (Jason T. Greene) Date: Tue, 6 Jan 2015 18:02:26 -0500 (EST) Subject: [undertow-dev] Closing an UndertowOutputStream on broken pipe In-Reply-To: <353025897.3943732.1420584987599.JavaMail.zimbra@redhat.com> References: <353025897.3943732.1420584987599.JavaMail.zimbra@redhat.com> Message-ID: Yeah I think if anything it should be a log message and not an exception, and only when its certainly an error (connection is still good etc) Sent from my iPhone > On Jan 6, 2015, at 4:56 PM, Stuart Douglas wrote: > > You are correct, this is a bug. > > I think the channel should probably take note of the first exception, and then not do anything on close, or maybe the chunked stream should not throw an exception on close, as even though it is an error condition it will generally only happen when something else has already gone wrote, so throwing an exception is not overly helpful. > > Stuart > > ----- Original Message ----- >> From: "Toby Crawley" >> To: undertow-dev at lists.jboss.org >> Sent: Wednesday, 7 January, 2015 9:38:36 AM >> Subject: [undertow-dev] Closing an UndertowOutputStream on broken pipe >> >> I'm streaming data by writing it to an UndertowOutputStream in chunks, >> and when the the client disconnects before the data is fully sent, I >> get a Broken pipe IOException when calling .write() (which is >> expected). I catch that error, then call .close() on the >> UndertowOutputStream, which throws "java.io.IOException: UT000029: >> Channel was closed mid chunk, if you have attempted to write chunked >> data you cannot shutdown the channel until after it has all been >> written." >> >> Is this expected behavior? It seems like it wouldn't be, since none of >> that pending data can be written. >> >> Do I even need to close the OutputStream in this case? Would not doing >> so leak any resources? >> >> Currently, I'm catching and ignoring the IOException thrown by .close(). >> >> The full stack traces of the two errors are available at: >> https://gist.github.com/21d111980352d04816c7 >> >> - Toby >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From toby at tcrawley.org Wed Jan 7 10:00:22 2015 From: toby at tcrawley.org (Toby Crawley) Date: Wed, 7 Jan 2015 10:00:22 -0500 Subject: [undertow-dev] Closing an UndertowOutputStream on broken pipe In-Reply-To: References: <353025897.3943732.1420584987599.JavaMail.zimbra@redhat.com> Message-ID: Thanks guys. JIRA filed: https://issues.jboss.org/browse/UNDERTOW-368 On Tue, Jan 6, 2015 at 6:02 PM, Jason T. Greene wrote: > Yeah I think if anything it should be a log message and not an exception, and only when its certainly an error (connection is still good etc) > > Sent from my iPhone > >> On Jan 6, 2015, at 4:56 PM, Stuart Douglas wrote: >> >> You are correct, this is a bug. >> >> I think the channel should probably take note of the first exception, and then not do anything on close, or maybe the chunked stream should not throw an exception on close, as even though it is an error condition it will generally only happen when something else has already gone wrote, so throwing an exception is not overly helpful. >> >> Stuart >> >> ----- Original Message ----- >>> From: "Toby Crawley" >>> To: undertow-dev at lists.jboss.org >>> Sent: Wednesday, 7 January, 2015 9:38:36 AM >>> Subject: [undertow-dev] Closing an UndertowOutputStream on broken pipe >>> >>> I'm streaming data by writing it to an UndertowOutputStream in chunks, >>> and when the the client disconnects before the data is fully sent, I >>> get a Broken pipe IOException when calling .write() (which is >>> expected). I catch that error, then call .close() on the >>> UndertowOutputStream, which throws "java.io.IOException: UT000029: >>> Channel was closed mid chunk, if you have attempted to write chunked >>> data you cannot shutdown the channel until after it has all been >>> written." >>> >>> Is this expected behavior? It seems like it wouldn't be, since none of >>> that pending data can be written. >>> >>> Do I even need to close the OutputStream in this case? Would not doing >>> so leak any resources? >>> >>> Currently, I'm catching and ignoring the IOException thrown by .close(). >>> >>> The full stack traces of the two errors are available at: >>> https://gist.github.com/21d111980352d04816c7 >>> >>> - Toby >>> _______________________________________________ >>> undertow-dev mailing list >>> undertow-dev at lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/undertow-dev >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev From guidrouet at gmail.com Mon Jan 12 16:52:38 2015 From: guidrouet at gmail.com (Guillaume Drouet) Date: Mon, 12 Jan 2015 22:52:38 +0100 Subject: [undertow-dev] [SPDY/HTTP2] How to use server push Message-ID: Hi, I'm curious to know if Undertow already provides an API which allows to push static resources thanks to SPDY and/or HTTP2 protocol. For example, jetty provides this kind of API for SPDY: http://www.eclipse.org/jetty/documentation/9.2.2.v20140723/spdy-implementing-push.html I did not find any equivalent for Undertow. Thanks! -- Guillaume DROUET -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150112/7404619f/attachment.html From sdouglas at redhat.com Mon Jan 12 17:00:24 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Mon, 12 Jan 2015 17:00:24 -0500 (EST) Subject: [undertow-dev] [SPDY/HTTP2] How to use server push In-Reply-To: References: Message-ID: <1980616535.6374944.1421100024233.JavaMail.zimbra@redhat.com> This is implemented in Undertow 1.2: https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/ServerConnection.java#L230 The reverse proxy also supports this, so pushed responses from the back end will be pushed onwards to the client. We also have a handler that attempts to learn what resources are needed for each request and push automatically: https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/LearningPushHandler.java Stuart ----- Original Message ----- > From: "Guillaume Drouet" > To: undertow-dev at lists.jboss.org > Sent: Tuesday, 13 January, 2015 8:52:38 AM > Subject: [undertow-dev] [SPDY/HTTP2] How to use server push > > Hi, > > I'm curious to know if Undertow already provides an API which allows to push > static resources thanks to SPDY and/or HTTP2 protocol. > > For example, jetty provides this kind of API for SPDY: > http://www.eclipse.org/jetty/documentation/9.2.2.v20140723/spdy-implementing-push.html > > I did not find any equivalent for Undertow. > > Thanks! > > -- > Guillaume DROUET > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From guidrouet at gmail.com Mon Jan 12 17:12:48 2015 From: guidrouet at gmail.com (Guillaume Drouet) Date: Mon, 12 Jan 2015 23:12:48 +0100 Subject: [undertow-dev] [SPDY/HTTP2] How to use server push In-Reply-To: <1980616535.6374944.1421100024233.JavaMail.zimbra@redhat.com> References: <1980616535.6374944.1421100024233.JavaMail.zimbra@redhat.com> Message-ID: Thanks! Is it related to HTTP2, SPDY or both protocols? 2015-01-12 23:00 GMT+01:00 Stuart Douglas : > This is implemented in Undertow 1.2: > > > https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/ServerConnection.java#L230 > > The reverse proxy also supports this, so pushed responses from the back > end will be pushed onwards to the client. > > We also have a handler that attempts to learn what resources are needed > for each request and push automatically: > > > https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/LearningPushHandler.java > > Stuart > > ----- Original Message ----- > > From: "Guillaume Drouet" > > To: undertow-dev at lists.jboss.org > > Sent: Tuesday, 13 January, 2015 8:52:38 AM > > Subject: [undertow-dev] [SPDY/HTTP2] How to use server push > > > > Hi, > > > > I'm curious to know if Undertow already provides an API which allows to > push > > static resources thanks to SPDY and/or HTTP2 protocol. > > > > For example, jetty provides this kind of API for SPDY: > > > http://www.eclipse.org/jetty/documentation/9.2.2.v20140723/spdy-implementing-push.html > > > > I did not find any equivalent for Undertow. > > > > Thanks! > > > > -- > > Guillaume DROUET > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > -- Guillaume DROUET -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150112/f1bfee5b/attachment.html From sdouglas at redhat.com Mon Jan 12 17:13:31 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Tue, 13 Jan 2015 09:13:31 +1100 Subject: [undertow-dev] [SPDY/HTTP2] How to use server push In-Reply-To: References: <1980616535.6374944.1421100024233.JavaMail.zimbra@redhat.com> Message-ID: <54B4470B.6060406@redhat.com> Both, although with SPDY the request header map will be ignored, as the underlying protocol does not support it. Stuart Guillaume Drouet wrote: > Thanks! Is it related to HTTP2, SPDY or both protocols? > > 2015-01-12 23:00 GMT+01:00 Stuart Douglas >: > > This is implemented in Undertow 1.2: > > https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/ServerConnection.java#L230 > > The reverse proxy also supports this, so pushed responses from the > back end will be pushed onwards to the client. > > We also have a handler that attempts to learn what resources are > needed for each request and push automatically: > > https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/LearningPushHandler.java > > Stuart > > ----- Original Message ----- > > From: "Guillaume Drouet" > > > To: undertow-dev at lists.jboss.org > > > Sent: Tuesday, 13 January, 2015 8:52:38 AM > > Subject: [undertow-dev] [SPDY/HTTP2] How to use server push > > > > Hi, > > > > I'm curious to know if Undertow already provides an API which > allows to push > > static resources thanks to SPDY and/or HTTP2 protocol. > > > > For example, jetty provides this kind of API for SPDY: > > > http://www.eclipse.org/jetty/documentation/9.2.2.v20140723/spdy-implementing-push.html > > > > I did not find any equivalent for Undertow. > > > > Thanks! > > > > -- > > Guillaume DROUET > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > > -- > Guillaume DROUET From cody.lerum at gmail.com Tue Jan 13 14:47:28 2015 From: cody.lerum at gmail.com (Cody Lerum) Date: Tue, 13 Jan 2015 12:47:28 -0700 Subject: [undertow-dev] Multipart File Upload on Rewritten URL Message-ID: I'm encountering an issue with JSF file uploads and ocpsoft Rewrite where a native JSF 2.1 h:inputFile will not work if the URL it is posting to is a rewritten URL. This is somewhat known behavior per http://www.ocpsoft.org/rewrite/docs/faq Which says: "According to the Servlet spec HttpServletRequest.getParameter*() and HttpServletRequest.getPart*() can only be called from special Servlets for multipart/form-data request. Using these methods outside of such Servlets results in undefined behavior." The Rewrite FAQ suggests a setting in Tomcat that allows "Casual Multipart Parsing" allowCasualMultipartParsing="true" http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Common_Attributes Is there a similar option for Undertow, or is this just a case where multipart/form-data requests will not work on a rewritten URL? Thanks -C From sdouglas at redhat.com Tue Jan 13 15:55:28 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Tue, 13 Jan 2015 15:55:28 -0500 (EST) Subject: [undertow-dev] Multipart File Upload on Rewritten URL In-Reply-To: References: Message-ID: <624883014.7235684.1421182528287.JavaMail.zimbra@redhat.com> There is no such Undertow option, however if you file a JIRA it should not be hard to add. Stuart ----- Original Message ----- > From: "Cody Lerum" > To: undertow-dev at lists.jboss.org > Sent: Wednesday, 14 January, 2015 6:47:28 AM > Subject: [undertow-dev] Multipart File Upload on Rewritten URL > > I'm encountering an issue with JSF file uploads and ocpsoft Rewrite > where a native JSF 2.1 h:inputFile will not work if the URL it is > posting to is a rewritten URL. > > This is somewhat known behavior per > http://www.ocpsoft.org/rewrite/docs/faq Which says: > > "According to the Servlet spec HttpServletRequest.getParameter*() and > HttpServletRequest.getPart*() can only be called from special Servlets > for multipart/form-data request. Using these methods outside of such > Servlets results in undefined behavior." > > The Rewrite FAQ suggests a setting in Tomcat that allows "Casual > Multipart Parsing" allowCasualMultipartParsing="true" > > http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Common_Attributes > > Is there a similar option for Undertow, or is this just a case where > multipart/form-data requests will not work on a rewritten URL? > > Thanks > > -C > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev > From cody.lerum at gmail.com Tue Jan 13 16:05:08 2015 From: cody.lerum at gmail.com (Cody Lerum) Date: Tue, 13 Jan 2015 14:05:08 -0700 Subject: [undertow-dev] Multipart File Upload on Rewritten URL In-Reply-To: <624883014.7235684.1421182528287.JavaMail.zimbra@redhat.com> References: <624883014.7235684.1421182528287.JavaMail.zimbra@redhat.com> Message-ID: Perfect. https://issues.jboss.org/browse/UNDERTOW-369 On Tue, Jan 13, 2015 at 1:55 PM, Stuart Douglas wrote: > There is no such Undertow option, however if you file a JIRA it should not be hard to add. > > Stuart > > ----- Original Message ----- >> From: "Cody Lerum" >> To: undertow-dev at lists.jboss.org >> Sent: Wednesday, 14 January, 2015 6:47:28 AM >> Subject: [undertow-dev] Multipart File Upload on Rewritten URL >> >> I'm encountering an issue with JSF file uploads and ocpsoft Rewrite >> where a native JSF 2.1 h:inputFile will not work if the URL it is >> posting to is a rewritten URL. >> >> This is somewhat known behavior per >> http://www.ocpsoft.org/rewrite/docs/faq Which says: >> >> "According to the Servlet spec HttpServletRequest.getParameter*() and >> HttpServletRequest.getPart*() can only be called from special Servlets >> for multipart/form-data request. Using these methods outside of such >> Servlets results in undefined behavior." >> >> The Rewrite FAQ suggests a setting in Tomcat that allows "Casual >> Multipart Parsing" allowCasualMultipartParsing="true" >> >> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Common_Attributes >> >> Is there a similar option for Undertow, or is this just a case where >> multipart/form-data requests will not work on a rewritten URL? >> >> Thanks >> >> -C >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev >> From espina.edgar at gmail.com Wed Jan 14 15:40:38 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Wed, 14 Jan 2015 17:40:38 -0300 Subject: [undertow-dev] web socket timeout Message-ID: Hi, I would like to set a timeout to wait before closing an idle websocket. How can I do this? Thanks. -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150114/67567cc5/attachment.html From sdouglas at redhat.com Wed Jan 14 16:24:53 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Wed, 14 Jan 2015 16:24:53 -0500 (EST) Subject: [undertow-dev] web socket timeout In-Reply-To: References: Message-ID: <1724509347.7991561.1421270693595.JavaMail.zimbra@redhat.com> Using native Undertow websockets or JSR-356? Native: WebSocketChannel.setIdleTimeout() JSR: javax.websocket.Session#setMaxIdleTimeout() Stuart ----- Original Message ----- > From: "Edgar Espina" > To: undertow-dev at lists.jboss.org > Sent: Thursday, 15 January, 2015 7:40:38 AM > Subject: [undertow-dev] web socket timeout > > Hi, > > I would like to set a timeout to wait before closing an idle websocket. How > can I do this? > > Thanks. > > -- > edgar > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From espina.edgar at gmail.com Wed Jan 14 16:29:40 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Wed, 14 Jan 2015 18:29:40 -0300 Subject: [undertow-dev] web socket timeout In-Reply-To: <1724509347.7991561.1421270693595.JavaMail.zimbra@redhat.com> References: <1724509347.7991561.1421270693595.JavaMail.zimbra@redhat.com> Message-ID: native! Thank you, Stuart. On Wed, Jan 14, 2015 at 6:24 PM, Stuart Douglas wrote: > Using native Undertow websockets or JSR-356? > > Native: > > WebSocketChannel.setIdleTimeout() > > JSR: > > javax.websocket.Session#setMaxIdleTimeout() > > Stuart > > ----- Original Message ----- > > From: "Edgar Espina" > > To: undertow-dev at lists.jboss.org > > Sent: Thursday, 15 January, 2015 7:40:38 AM > > Subject: [undertow-dev] web socket timeout > > > > Hi, > > > > I would like to set a timeout to wait before closing an idle websocket. > How > > can I do this? > > > > Thanks. > > > > -- > > edgar > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150114/642535f3/attachment.html From mclarkson at eyeota.com Fri Jan 16 23:42:34 2015 From: mclarkson at eyeota.com (Matt Clarkson) Date: Sat, 17 Jan 2015 12:42:34 +0800 Subject: [undertow-dev] Help, please: Observing low Undertow throughput under heavy loads Message-ID: Hi Undertow Team, We recently deployed a large platform for processing high-frequency http signals from around the Internet. We are using undertow as our embedded http server and are experiencing some serious throughput issues. Hoping you can help us to remedy them. Here are our findings so far. -When we dump thread stacks using jstack for a loaded server, we observe that the I/O threads (1/core) are all blockng at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method). -At the same time we see large numbers of TCP Timeouts, TCP Listen Drops, and TCP Overflows, which would seem to imply that we are not processing connections fast enough -There are large numbers of sockets int TIME_WAIT status -TaskWorker threads are underutilized and most are in WAITING state sitting at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) We've observed this situation even against a no-op end point which basically dispatches a handler, so we've eliminated almost all of our code from the equation. We also removed HTTPS traffic to take SSL out of the equation. CPU utilization on the boxes is very low and memory is fine as well. Disk I/O is also not an issue... we don't write to disk when hitting the no-op endpoint We're currently runnning on c2-xlarge EC2 instances (8 gb ram/4 cores) in 7 amazon regions. We've tried tuning keepalive, IO thread count (currently set to 4) and core/max task worker count (40) to no avail. We decided to move our compute instances behind haproxy, which has improved the tcp failure rates but we are still seeing very low throughput (roughly 200-300 request/sec max) We are using 1.1.0-Final version of undertow. We tried 1.2.0-Beta 6 but after deploying our servers froze after about 10 minutes so we had to roll back. Do you have any tips on other things we can look at ? Thanks in advance, Matt C. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150117/002f908d/attachment.html From ecki at zusammenkunft.net Sat Jan 17 02:58:32 2015 From: ecki at zusammenkunft.net (Bernd Eckenfels) Date: Sat, 17 Jan 2015 08:58:32 +0100 Subject: [undertow-dev] Help, please: Observing low Undertow throughput under heavy loads In-Reply-To: References: Message-ID: <20150117085832.00002409.ecki@zusammenkunft.net> Hello, cant help with specific Undertow experience in this issue, but in an other NIO service we had seen similar lockups beeing resolved by reverting to the Poll based selector provider. -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider (I guess for XNIO it would be -Dxnio.nio.selector.provider) Maybe you can give it a try, even if it isnt the most desireable solution . BTW: what OS and JVM you are using? Gruss Bernd Am Sat, 17 Jan 2015 12:42:34 +0800 schrieb Matt Clarkson : > Hi Undertow Team, > > We recently deployed a large platform for processing high-frequency > http signals from around the Internet. We are using undertow as our > embedded http server and are experiencing some serious throughput > issues. Hoping you can help us to remedy them. Here are our > findings so far. > > -When we dump thread stacks using jstack for a loaded server, we > observe that the I/O threads (1/core) are all blockng at > sun.nio.ch.EPollArrayWrapper.epollWait(Native Method). > -At the same time we see large numbers of TCP Timeouts, TCP Listen > Drops, and TCP Overflows, which would seem to imply that we are not > processing connections fast enough > -There are large numbers of sockets int TIME_WAIT status > -TaskWorker threads are underutilized and most are in WAITING state > sitting at > java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) > > We've observed this situation even against a no-op end point which > basically dispatches a handler, so we've eliminated almost all of our > code from the equation. We also removed HTTPS traffic to take SSL > out of the equation. CPU utilization on the boxes is very low and > memory is fine as well. Disk I/O is also not an issue... we don't > write to disk when hitting the no-op endpoint > > We're currently runnning on c2-xlarge EC2 instances (8 gb ram/4 > cores) in 7 amazon regions. We've tried tuning keepalive, IO thread > count (currently set to 4) and core/max task worker count (40) to no > avail. We decided to move our compute instances behind haproxy, > which has improved the tcp failure rates but we are still seeing very > low throughput (roughly 200-300 request/sec max) > > We are using 1.1.0-Final version of undertow. We tried 1.2.0-Beta 6 > but after deploying our servers froze after about 10 minutes so we > had to roll back. > > Do you have any tips on other things we can look at ? > > Thanks in advance, > > Matt C. > From tomaz.cerar at gmail.com Sat Jan 17 05:05:36 2015 From: tomaz.cerar at gmail.com (=?utf-8?Q?Toma=C5=BE_Cerar?=) Date: Sat, 17 Jan 2015 11:05:36 +0100 Subject: [undertow-dev] Help, please: Observing low Undertow throughput underheavy loads In-Reply-To: References: Message-ID: <54ba33f2.0cbbb40a.7178.0da0@mx.google.com> 1 io thread / core is on a low side. I would start with at least 2 theads / core. Keep in mind also HT with that cpus Sent from my Phone -----Original Message----- From: "Matt Clarkson" Sent: ?17.?1.?2015 5:43 To: "undertow-dev at lists.jboss.org" Subject: [undertow-dev] Help, please: Observing low Undertow throughput underheavy loads Hi Undertow Team, We recently deployed a large platform for processing high-frequency http signals from around the Internet. We are using undertow as our embedded http server and are experiencing some serious throughput issues. Hoping you can help us to remedy them. Here are our findings so far. -When we dump thread stacks using jstack for a loaded server, we observe that the I/O threads (1/core) are all blockng at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method). -At the same time we see large numbers of TCP Timeouts, TCP Listen Drops, and TCP Overflows, which would seem to imply that we are not processing connections fast enough -There are large numbers of sockets int TIME_WAIT status -TaskWorker threads are underutilized and most are in WAITING state sitting at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) We've observed this situation even against a no-op end point which basically dispatches a handler, so we've eliminated almost all of our code from the equation. We also removed HTTPS traffic to take SSL out of the equation. CPU utilization on the boxes is very low and memory is fine as well. Disk I/O is also not an issue... we don't write to disk when hitting the no-op endpoint We're currently runnning on c2-xlarge EC2 instances (8 gb ram/4 cores) in 7 amazon regions. We've tried tuning keepalive, IO thread count (currently set to 4) and core/max task worker count (40) to no avail. We decided to move our compute instances behind haproxy, which has improved the tcp failure rates but we are still seeing very low throughput (roughly 200-300 request/sec max) We are using 1.1.0-Final version of undertow. We tried 1.2.0-Beta 6 but after deploying our servers froze after about 10 minutes so we had to roll back. Do you have any tips on other things we can look at ? Thanks in advance, Matt C. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150117/e44e8da9/attachment-0001.html From jason.greene at redhat.com Sat Jan 17 10:50:36 2015 From: jason.greene at redhat.com (jason.greene at redhat.com) Date: Sat, 17 Jan 2015 09:50:36 -0600 Subject: [undertow-dev] Help, please: Observing low Undertow throughput under heavy loads In-Reply-To: References: Message-ID: <273CD18B-A8BD-4AA6-BA9E-4C5AA58738C2@redhat.com> Hi Matt, Thank you for posting the problem you are running into. We definitely want to help. A couple of questions, with just undertow in the picture (no haproxy): - Are you seeing a message like this in dmesg /var/log/messages: "possible SYN flooding on port 80. Sending cookies.? - Can you paste an output of netstat -S when things are going wrong? If you are seeing listen drops, then the first thing to do would be to raise the Options.BACKLOG setting to a high value (e.g. 16384), so that if the I/O threads aren?t accepting as fast as the connections come in they queue instead of drop. Can you give us an approximation of how many connections a node is typically handling? If you are in the 100k+ connection count range, have you done any TCP tuning? (e.g. tuning or removing netfilter contracting, setting net.core.netdev_max_backlog, ), as that can also lead to TCP timeouts/drops/delays. In any case just start with setting Options.BACKLOG, and seeing if failures decrease. Haproxy might set a higher backlog by default, explaining the difference in failure rates. It could also act as a throttle, by purposefully limiting how much it proxies to undertow. If I understand correctly your no-op endpoint is using a dispatch, so utilizing the worker pool, which I imagine models your app? If so your worker pool will need to be sized to account for the wait time it spends not using CPU cycles, but waiting for something like a database, or the file system. If your use case has lots of wait/blocking like this, then a very large worker pool would improve throughput (64+ threads for a 4 core). Thanks! On Jan 16, 2015, at 10:43 PM, Matt Clarkson > wrote: > Hi Undertow Team, > > We recently deployed a large platform for processing high-frequency http signals from around the Internet. We are using undertow as our embedded http server and are experiencing some serious throughput issues. Hoping you can help us to remedy them. Here are our findings so far. > > -When we dump thread stacks using jstack for a loaded server, we observe that the I/O threads (1/core) are all blockng at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method). > -At the same time we see large numbers of TCP Timeouts, TCP Listen Drops, and TCP Overflows, which would seem to imply that we are not processing connections fast enough > -There are large numbers of sockets int TIME_WAIT status > -TaskWorker threads are underutilized and most are in WAITING state sitting at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) > > We've observed this situation even against a no-op end point which basically dispatches a handler, so we've eliminated almost all of our code from the equation. We also removed HTTPS traffic to take SSL out of the equation. CPU utilization on the boxes is very low and memory is fine as well. Disk I/O is also not an issue... we don't write to disk when hitting the no-op endpoint > > We're currently runnning on c2-xlarge EC2 instances (8 gb ram/4 cores) in 7 amazon regions. We've tried tuning keepalive, IO thread count (currently set to 4) and core/max task worker count (40) to no avail. We decided to move our compute instances behind haproxy, which has improved the tcp failure rates but we are still seeing very low throughput (roughly 200-300 request/sec max) > > We are using 1.1.0-Final version of undertow. We tried 1.2.0-Beta 6 but after deploying our servers froze after about 10 minutes so we had to roll back. > > Do you have any tips on other things we can look at ? > > Thanks in advance, > > Matt C. > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev -- Jason T. Greene WildFly Lead / JBoss EAP Platform Architect JBoss, a division of Red Hat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150117/6d90df38/attachment.html From jason.greene at redhat.com Sat Jan 17 11:01:09 2015 From: jason.greene at redhat.com (Jason Greene) Date: Sat, 17 Jan 2015 10:01:09 -0600 Subject: [undertow-dev] Help, please: Observing low Undertow throughput under heavy loads In-Reply-To: <273CD18B-A8BD-4AA6-BA9E-4C5AA58738C2@redhat.com> References: <273CD18B-A8BD-4AA6-BA9E-4C5AA58738C2@redhat.com> Message-ID: <1684690D-BF37-4870-B2EE-479D4C32E495@redhat.com> > On Jan 17, 2015, at 9:50 AM, jason.greene at redhat.com wrote: > > Hi Matt, > > Thank you for posting the problem you are running into. We definitely want to help. > > A couple of questions, with just undertow in the picture (no haproxy): > > - Are you seeing a message like this in dmesg /var/log/messages: > > "possible SYN flooding on port 80. Sending cookies.? > > - Can you paste an output of netstat -S when things are going wrong? > > If you are seeing listen drops, then the first thing to do would be to raise the Options.BACKLOG setting to a high value (e.g. 16384), so that if the I/O threads aren?t accepting as fast as the connections come in they queue instead of drop. Can you give us an approximation of how many connections a node is typically handling? If you are in the 100k+ connection count range, have you done any TCP tuning? (e.g. tuning or removing netfilter contracting, setting net.core.netdev_max_backlog, ), as that can also lead to TCP timeouts/drops/delays. > > In any case just start with setting Options.BACKLOG, and seeing if failures decrease. > > Haproxy might set a higher backlog by default, explaining the difference in failure rates. It could also act as a throttle, by purposefully limiting how much it proxies to undertow. Just to clarify, what I mean is that with haproxy in the picture, it probably needs to be tuned to pass on more load. > > If I understand correctly your no-op endpoint is using a dispatch, so utilizing the worker pool, which I imagine models your app? If so your worker pool will need to be sized to account for the wait time it spends not using CPU cycles, but waiting for something like a database, or the file system. If your use case has lots of wait/blocking like this, then a very large worker pool would improve throughput (64+ threads for a 4 core). > > Thanks! > > On Jan 16, 2015, at 10:43 PM, Matt Clarkson wrote: > >> Hi Undertow Team, >> >> We recently deployed a large platform for processing high-frequency http signals from around the Internet. We are using undertow as our embedded http server and are experiencing some serious throughput issues. Hoping you can help us to remedy them. Here are our findings so far. >> >> -When we dump thread stacks using jstack for a loaded server, we observe that the I/O threads (1/core) are all blockng at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method). >> -At the same time we see large numbers of TCP Timeouts, TCP Listen Drops, and TCP Overflows, which would seem to imply that we are not processing connections fast enough >> -There are large numbers of sockets int TIME_WAIT status >> -TaskWorker threads are underutilized and most are in WAITING state sitting at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) >> >> We've observed this situation even against a no-op end point which basically dispatches a handler, so we've eliminated almost all of our code from the equation. We also removed HTTPS traffic to take SSL out of the equation. CPU utilization on the boxes is very low and memory is fine as well. Disk I/O is also not an issue... we don't write to disk when hitting the no-op endpoint >> >> We're currently runnning on c2-xlarge EC2 instances (8 gb ram/4 cores) in 7 amazon regions. We've tried tuning keepalive, IO thread count (currently set to 4) and core/max task worker count (40) to no avail. We decided to move our compute instances behind haproxy, which has improved the tcp failure rates but we are still seeing very low throughput (roughly 200-300 request/sec max) >> >> We are using 1.1.0-Final version of undertow. We tried 1.2.0-Beta 6 but after deploying our servers froze after about 10 minutes so we had to roll back. >> >> Do you have any tips on other things we can look at ? >> >> Thanks in advance, >> >> Matt C. >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev > > > -- > Jason T. Greene > WildFly Lead / JBoss EAP Platform Architect > JBoss, a division of Red Hat > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev -- Jason T. Greene WildFly Lead / JBoss EAP Platform Architect JBoss, a division of Red Hat From sdouglas at redhat.com Sat Jan 17 15:57:37 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Sat, 17 Jan 2015 15:57:37 -0500 (EST) Subject: [undertow-dev] Help, please: Observing low Undertow throughput under heavy loads In-Reply-To: References: Message-ID: <1161622301.9486300.1421528257895.JavaMail.zimbra@redhat.com> ----- Original Message ----- > From: "Matt Clarkson" > To: undertow-dev at lists.jboss.org > Sent: Saturday, 17 January, 2015 3:42:34 PM > Subject: [undertow-dev] Help, please: Observing low Undertow throughput under heavy loads > > Hi Undertow Team, > > We recently deployed a large platform for processing high-frequency http > signals from around the Internet. We are using undertow as our embedded http > server and are experiencing some serious throughput issues. Hoping you can > help us to remedy them. Here are our findings so far. > > -When we dump thread stacks using jstack for a loaded server, we observe that > the I/O threads (1/core) are all blockng at > sun.nio.ch.EPollArrayWrapper.epollWait(Native Method). > -At the same time we see large numbers of TCP Timeouts, TCP Listen Drops, and > TCP Overflows, which would seem to imply that we are not processing > connections fast enough > -There are large numbers of sockets int TIME_WAIT status > -TaskWorker threads are underutilized and most are in WAITING state sitting > at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) > > We've observed this situation even against a no-op end point which basically > dispatches a handler, so we've eliminated almost all of our code from the > equation. We also removed HTTPS traffic to take SSL out of the equation. CPU > utilization on the boxes is very low and memory is fine as well. Disk I/O is > also not an issue... we don't write to disk when hitting the no-op endpoint > What JVM and OS version are you using? This sounds like it might be an NIO issue, or some kind of NIO/TCP tuning issue. > We're currently runnning on c2-xlarge EC2 instances (8 gb ram/4 cores) in 7 > amazon regions. We've tried tuning keepalive, IO thread count (currently set > to 4) and core/max task worker count (40) to no avail. We decided to move > our compute instances behind haproxy, which has improved the tcp failure > rates but we are still seeing very low throughput (roughly 200-300 > request/sec max) Is it this low even with the empty endpoint? > > We are using 1.1.0-Final version of undertow. We tried 1.2.0-Beta 6 but after > deploying our servers froze after about 10 minutes so we had to roll back. Did you happen to get a thread dump or any info from 1.2.0.Beta6 when it locked up? Thanks, Stuart > > Do you have any tips on other things we can look at ? > > Thanks in advance, > > Matt C. > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From mclarkson at eyeota.com Sun Jan 18 08:41:21 2015 From: mclarkson at eyeota.com (Matt Clarkson) Date: Sun, 18 Jan 2015 21:41:21 +0800 Subject: [undertow-dev] Help, please: Observing low Undertow throughput under heavy loads In-Reply-To: <1161622301.9486300.1421528257895.JavaMail.zimbra@redhat.com> References: <1161622301.9486300.1421528257895.JavaMail.zimbra@redhat.com> Message-ID: Hi Stuart, Thanks for your reply: > We've observed this situation even against a no-op end point which basically > dispatches a handler, so we've eliminated almost all of our code from the > equation. We also removed HTTPS traffic to take SSL out of the equation. CPU > utilization on the boxes is very low and memory is fine as well. Disk I/O is > also not an issue... we don't write to disk when hitting the no-op endpoint > What JVM and OS version are you using? This sounds like it might be an NIO issue, or some kind of NIO/TCP tuning issue. >> We're running 1.7.0_45-b18 on Amazon Linux (amzn-ami-hvm-2014.09.1.x86_64-ebs (ami-4b6f650e)) > We're currently runnning on c2-xlarge EC2 instances (8 gb ram/4 cores) in 7 > amazon regions. We've tried tuning keepalive, IO thread count (currently set > to 4) and core/max task worker count (40) to no avail. We decided to move > our compute instances behind haproxy, which has improved the tcp failure > rates but we are still seeing very low throughput (roughly 200-300 > request/sec max) Is it this low even with the empty endpoint? We took those measurements with our normal endpoints. We're in the process of setting up some new tests against a more highly instrumented build to get some fresh numbers. Will post when we have them. > We are using 1.1.0-Final version of undertow. We tried 1.2.0-Beta 6 but after > deploying our servers froze after about 10 minutes so we had to roll back. Did you happen to get a thread dump or any info from 1.2.0.Beta6 when it locked up? >I did but sadly I didn't keep it :-(. As I recall though, it was similar to the others...IO threads sitting on epoll and task workers parked waiting for jobs. I've upgraded one of our servers with Beta 6 tonight and am running it, but so far it is performing normally. It's sitting behind HA Proxy, which seems to be smoothing out the traffic so I may not be able to replicate the issue until I can get it redeployed from behind HAP. Will advise further when I've done that. many thanks, Matt On Sun, Jan 18, 2015 at 4:57 AM, Stuart Douglas wrote: > > > ----- Original Message ----- > > From: "Matt Clarkson" > > To: undertow-dev at lists.jboss.org > > Sent: Saturday, 17 January, 2015 3:42:34 PM > > Subject: [undertow-dev] Help, please: Observing low Undertow throughput > under heavy loads > > > > Hi Undertow Team, > > > > We recently deployed a large platform for processing high-frequency http > > signals from around the Internet. We are using undertow as our embedded > http > > server and are experiencing some serious throughput issues. Hoping you > can > > help us to remedy them. Here are our findings so far. > > > > -When we dump thread stacks using jstack for a loaded server, we observe > that > > the I/O threads (1/core) are all blockng at > > sun.nio.ch.EPollArrayWrapper.epollWait(Native Method). > > -At the same time we see large numbers of TCP Timeouts, TCP Listen > Drops, and > > TCP Overflows, which would seem to imply that we are not processing > > connections fast enough > > -There are large numbers of sockets int TIME_WAIT status > > -TaskWorker threads are underutilized and most are in WAITING state > sitting > > at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) > > > > We've observed this situation even against a no-op end point which > basically > > dispatches a handler, so we've eliminated almost all of our code from the > > equation. We also removed HTTPS traffic to take SSL out of the equation. > CPU > > utilization on the boxes is very low and memory is fine as well. Disk > I/O is > > also not an issue... we don't write to disk when hitting the no-op > endpoint > > > > What JVM and OS version are you using? This sounds like it might be an NIO > issue, or some kind of NIO/TCP tuning issue. > > > We're currently runnning on c2-xlarge EC2 instances (8 gb ram/4 cores) > in 7 > > amazon regions. We've tried tuning keepalive, IO thread count (currently > set > > to 4) and core/max task worker count (40) to no avail. We decided to move > > our compute instances behind haproxy, which has improved the tcp failure > > rates but we are still seeing very low throughput (roughly 200-300 > > request/sec max) > > Is it this low even with the empty endpoint? > > > > > We are using 1.1.0-Final version of undertow. We tried 1.2.0-Beta 6 but > after > > deploying our servers froze after about 10 minutes so we had to roll > back. > > Did you happen to get a thread dump or any info from 1.2.0.Beta6 when it > locked up? > > Thanks, > > Stuart > > > > > Do you have any tips on other things we can look at ? > > > > Thanks in advance, > > > > Matt C. > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150118/4c34cdc3/attachment-0001.html From mclarkson at eyeota.com Sun Jan 18 08:46:06 2015 From: mclarkson at eyeota.com (Matt Clarkson) Date: Sun, 18 Jan 2015 21:46:06 +0800 Subject: [undertow-dev] Help, please: Observing low Undertow throughput under heavy loads In-Reply-To: <1684690D-BF37-4870-B2EE-479D4C32E495@redhat.com> References: <273CD18B-A8BD-4AA6-BA9E-4C5AA58738C2@redhat.com> <1684690D-BF37-4870-B2EE-479D4C32E495@redhat.com> Message-ID: Hi Jason, Thanks much for your great response... I've done some recoding to set the BACKLOG parameter and will test it out tomorrow with some of your other tuning recommendations. In order to answer your other questions, I'll need to get a node reconfigured out from behind the load balancer. Will advise when I've got some updates in the next 24 hours or so. many thanks, MTC On Sun, Jan 18, 2015 at 12:01 AM, Jason Greene wrote: > > > On Jan 17, 2015, at 9:50 AM, jason.greene at redhat.com wrote: > > > > Hi Matt, > > > > Thank you for posting the problem you are running into. We definitely > want to help. > > > > A couple of questions, with just undertow in the picture (no haproxy): > > > > - Are you seeing a message like this in dmesg /var/log/messages: > > > > "possible SYN flooding on port 80. Sending cookies.? > > > > - Can you paste an output of netstat -S when things are going wrong? > > > > If you are seeing listen drops, then the first thing to do would be to > raise the Options.BACKLOG setting to a high value (e.g. 16384), so that if > the I/O threads aren?t accepting as fast as the connections come in they > queue instead of drop. Can you give us an approximation of how many > connections a node is typically handling? If you are in the 100k+ > connection count range, have you done any TCP tuning? (e.g. tuning or > removing netfilter contracting, setting net.core.netdev_max_backlog, ), as > that can also lead to TCP timeouts/drops/delays. > > > > In any case just start with setting Options.BACKLOG, and seeing if > failures decrease. > > > > Haproxy might set a higher backlog by default, explaining the difference > in failure rates. It could also act as a throttle, by purposefully limiting > how much it proxies to undertow. > > Just to clarify, what I mean is that with haproxy in the picture, it > probably needs to be tuned to pass on more load. > > > > > If I understand correctly your no-op endpoint is using a dispatch, so > utilizing the worker pool, which I imagine models your app? If so your > worker pool will need to be sized to account for the wait time it spends > not using CPU cycles, but waiting for something like a database, or the > file system. If your use case has lots of wait/blocking like this, then a > very large worker pool would improve throughput (64+ threads for a 4 core). > > > > Thanks! > > > > On Jan 16, 2015, at 10:43 PM, Matt Clarkson > wrote: > > > >> Hi Undertow Team, > >> > >> We recently deployed a large platform for processing high-frequency > http signals from around the Internet. We are using undertow as our > embedded http server and are experiencing some serious throughput issues. > Hoping you can help us to remedy them. Here are our findings so far. > >> > >> -When we dump thread stacks using jstack for a loaded server, we > observe that the I/O threads (1/core) are all blockng at > sun.nio.ch.EPollArrayWrapper.epollWait(Native Method). > >> -At the same time we see large numbers of TCP Timeouts, TCP Listen > Drops, and TCP Overflows, which would seem to imply that we are not > processing connections fast enough > >> -There are large numbers of sockets int TIME_WAIT status > >> -TaskWorker threads are underutilized and most are in WAITING state > sitting at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) > >> > >> We've observed this situation even against a no-op end point which > basically dispatches a handler, so we've eliminated almost all of our code > from the equation. We also removed HTTPS traffic to take SSL out of the > equation. CPU utilization on the boxes is very low and memory is fine as > well. Disk I/O is also not an issue... we don't write to disk when hitting > the no-op endpoint > >> > >> We're currently runnning on c2-xlarge EC2 instances (8 gb ram/4 cores) > in 7 amazon regions. We've tried tuning keepalive, IO thread count > (currently set to 4) and core/max task worker count (40) to no avail. We > decided to move our compute instances behind haproxy, which has improved > the tcp failure rates but we are still seeing very low throughput (roughly > 200-300 request/sec max) > >> > >> We are using 1.1.0-Final version of undertow. We tried 1.2.0-Beta 6 > but after deploying our servers froze after about 10 minutes so we had to > roll back. > >> > >> Do you have any tips on other things we can look at ? > >> > >> Thanks in advance, > >> > >> Matt C. > >> _______________________________________________ > >> undertow-dev mailing list > >> undertow-dev at lists.jboss.org > >> https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > > > -- > > Jason T. Greene > > WildFly Lead / JBoss EAP Platform Architect > > JBoss, a division of Red Hat > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > > -- > Jason T. Greene > WildFly Lead / JBoss EAP Platform Architect > JBoss, a division of Red Hat > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150118/e005f4e4/attachment.html From espina.edgar at gmail.com Sun Jan 18 17:42:19 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Sun, 18 Jan 2015 19:42:19 -0300 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy Message-ID: Hi, I've an Undertow application behind apache reverse proxy, trying to load a page displays error 502 proxy error. Still couldn't find why so I wonder if any of you find a similar problem with Undertow and Apache. Please note this is our first app on top of Undertow, existing apps running on Tomcat/Jetty are OK. Appreciate any help. Thanks -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150118/9b40f477/attachment.html From sdouglas at redhat.com Sun Jan 18 18:52:07 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Sun, 18 Jan 2015 18:52:07 -0500 (EST) Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: Message-ID: <278068504.9598826.1421625127123.JavaMail.zimbra@redhat.com> Is there any info in the log? Or is there any specific type of request that causes this? Stuart ----- Original Message ----- > From: "Edgar Espina" > To: undertow-dev at lists.jboss.org > Sent: Monday, 19 January, 2015 9:42:19 AM > Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy > > Hi, > > I've an Undertow application behind apache reverse proxy, trying to load a > page displays error 502 proxy error. > > Still couldn't find why so I wonder if any of you find a similar problem with > Undertow and Apache. > > Please note this is our first app on top of Undertow, existing apps running > on Tomcat/Jetty are OK. > > Appreciate any help. > > Thanks > > -- > edgar > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From espina.edgar at gmail.com Sun Jan 18 19:13:21 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Sun, 18 Jan 2015 21:13:21 -0300 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: <278068504.9598826.1421625127123.JavaMail.zimbra@redhat.com> References: <278068504.9598826.1421625127123.JavaMail.zimbra@redhat.com> Message-ID: found this in apache: (104) Connection reset by peer: proxy: error reading status line from remote server but nothing in undertow. got 502 on HTTP GET. Sometimes while calling the home page / or when page loads OK, got 502 on page resources (js, css, images). I call startBlocking and use the outputstream to write the response, when everything has been written I call the "outputstream.close" method. Do I need to call exchange.endExchange too? Thanks On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas wrote: > Is there any info in the log? Or is there any specific type of request > that causes this? > > Stuart > > > ----- Original Message ----- > > From: "Edgar Espina" > > To: undertow-dev at lists.jboss.org > > Sent: Monday, 19 January, 2015 9:42:19 AM > > Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > Hi, > > > > I've an Undertow application behind apache reverse proxy, trying to load > a > > page displays error 502 proxy error. > > > > Still couldn't find why so I wonder if any of you find a similar problem > with > > Undertow and Apache. > > > > Please note this is our first app on top of Undertow, existing apps > running > > on Tomcat/Jetty are OK. > > > > Appreciate any help. > > > > Thanks > > > > -- > > edgar > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150118/0baa6cb9/attachment.html From sdouglas at redhat.com Sun Jan 18 19:42:00 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Sun, 18 Jan 2015 19:42:00 -0500 (EST) Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <278068504.9598826.1421625127123.JavaMail.zimbra@redhat.com> Message-ID: <2108662223.9604758.1421628120959.JavaMail.zimbra@redhat.com> Also what version of Undertow are you using? Stuart ----- Original Message ----- > From: "Edgar Espina" > To: "Stuart Douglas" > Cc: undertow-dev at lists.jboss.org > Sent: Monday, 19 January, 2015 11:13:21 AM > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > found this in apache: > > (104) Connection reset by peer: proxy: error reading status line from > remote server > > but nothing in undertow. > > got 502 on HTTP GET. Sometimes while calling the home page / or when page > loads OK, got 502 on page resources (js, css, images). > > I call startBlocking and use the outputstream to write the response, when > everything has been written I call the "outputstream.close" method. Do I > need to call exchange.endExchange too? > > Thanks > > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas wrote: > > > Is there any info in the log? Or is there any specific type of request > > that causes this? > > > > Stuart > > > > > > ----- Original Message ----- > > > From: "Edgar Espina" > > > To: undertow-dev at lists.jboss.org > > > Sent: Monday, 19 January, 2015 9:42:19 AM > > > Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > > > Hi, > > > > > > I've an Undertow application behind apache reverse proxy, trying to load > > a > > > page displays error 502 proxy error. > > > > > > Still couldn't find why so I wonder if any of you find a similar problem > > with > > > Undertow and Apache. > > > > > > Please note this is our first app on top of Undertow, existing apps > > running > > > on Tomcat/Jetty are OK. > > > > > > Appreciate any help. > > > > > > Thanks > > > > > > -- > > > edgar > > > > > > _______________________________________________ > > > undertow-dev mailing list > > > undertow-dev at lists.jboss.org > > > https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > > > -- > edgar > From espina.edgar at gmail.com Sun Jan 18 19:46:30 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Sun, 18 Jan 2015 21:46:30 -0300 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: <2108662223.9604758.1421628120959.JavaMail.zimbra@redhat.com> References: <278068504.9598826.1421625127123.JavaMail.zimbra@redhat.com> <2108662223.9604758.1421628120959.JavaMail.zimbra@redhat.com> Message-ID: latest: 1.2.0.Beta8 On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas wrote: > Also what version of Undertow are you using? > > Stuart > > ----- Original Message ----- > > From: "Edgar Espina" > > To: "Stuart Douglas" > > Cc: undertow-dev at lists.jboss.org > > Sent: Monday, 19 January, 2015 11:13:21 AM > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > found this in apache: > > > > (104) Connection reset by peer: proxy: error reading status line from > > remote server > > > > but nothing in undertow. > > > > got 502 on HTTP GET. Sometimes while calling the home page / or when page > > loads OK, got 502 on page resources (js, css, images). > > > > I call startBlocking and use the outputstream to write the response, when > > everything has been written I call the "outputstream.close" method. Do I > > need to call exchange.endExchange too? > > > > Thanks > > > > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas > wrote: > > > > > Is there any info in the log? Or is there any specific type of request > > > that causes this? > > > > > > Stuart > > > > > > > > > ----- Original Message ----- > > > > From: "Edgar Espina" > > > > To: undertow-dev at lists.jboss.org > > > > Sent: Monday, 19 January, 2015 9:42:19 AM > > > > Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > > > > > Hi, > > > > > > > > I've an Undertow application behind apache reverse proxy, trying to > load > > > a > > > > page displays error 502 proxy error. > > > > > > > > Still couldn't find why so I wonder if any of you find a similar > problem > > > with > > > > Undertow and Apache. > > > > > > > > Please note this is our first app on top of Undertow, existing apps > > > running > > > > on Tomcat/Jetty are OK. > > > > > > > > Appreciate any help. > > > > > > > > Thanks > > > > > > > > -- > > > > edgar > > > > > > > > _______________________________________________ > > > > undertow-dev mailing list > > > > undertow-dev at lists.jboss.org > > > > https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > > > > > > > > -- > > edgar > > > -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150118/5a19ab99/attachment-0001.html From sdouglas at redhat.com Sun Jan 18 19:48:26 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Mon, 19 Jan 2015 11:48:26 +1100 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <278068504.9598826.1421625127123.JavaMail.zimbra@redhat.com> <2108662223.9604758.1421628120959.JavaMail.zimbra@redhat.com> Message-ID: <54BC545A.9020701@redhat.com> Another question, are you setting a content length on the responses? If not the channel will automatically set one if the response fits inside a buffer, otherwise chunked encoding will be used. It might be helpful to know if this only happens on chunked, fixed length or both. Stuart Edgar Espina wrote: > latest: 1.2.0.Beta8 > > On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > wrote: > > Also what version of Undertow are you using? > > Stuart > > ----- Original Message ----- > > From: "Edgar Espina" > > > To: "Stuart Douglas" > > > Cc: undertow-dev at lists.jboss.org > > > Sent: Monday, 19 January, 2015 11:13:21 AM > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > found this in apache: > > > > (104) Connection reset by peer: proxy: error reading status line from > > remote server > > > > but nothing in undertow. > > > > got 502 on HTTP GET. Sometimes while calling the home page / or > when page > > loads OK, got 502 on page resources (js, css, images). > > > > I call startBlocking and use the outputstream to write the > response, when > > everything has been written I call the "outputstream.close" > method. Do I > > need to call exchange.endExchange too? > > > > Thanks > > > > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas > > wrote: > > > > > Is there any info in the log? Or is there any specific type of > request > > > that causes this? > > > > > > Stuart > > > > > > > > > ----- Original Message ----- > > > > From: "Edgar Espina" > > > > > To: undertow-dev at lists.jboss.org > > > > > Sent: Monday, 19 January, 2015 9:42:19 AM > > > > Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > > > > > Hi, > > > > > > > > I've an Undertow application behind apache reverse proxy, > trying to load > > > a > > > > page displays error 502 proxy error. > > > > > > > > Still couldn't find why so I wonder if any of you find a > similar problem > > > with > > > > Undertow and Apache. > > > > > > > > Please note this is our first app on top of Undertow, > existing apps > > > running > > > > on Tomcat/Jetty are OK. > > > > > > > > Appreciate any help. > > > > > > > > Thanks > > > > > > > > -- > > > > edgar > > > > > > > > _______________________________________________ > > > > undertow-dev mailing list > > > > undertow-dev at lists.jboss.org > > > > > https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > > > > > > > > -- > > edgar > > > > > > > -- > edgar From espina.edgar at gmail.com Sun Jan 18 19:53:55 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Sun, 18 Jan 2015 21:53:55 -0300 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: <54BC545A.9020701@redhat.com> References: <278068504.9598826.1421625127123.JavaMail.zimbra@redhat.com> <2108662223.9604758.1421628120959.JavaMail.zimbra@redhat.com> <54BC545A.9020701@redhat.com> Message-ID: I'm not, channel does it. Problem is present on both. For example, home page has a content-length header but jquery.js use chunked. Do I have to call .endExchange? or closing the output stream is enough? Thanks On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas wrote: > Another question, are you setting a content length on the responses? If > not the channel will automatically set one if the response fits inside a > buffer, otherwise chunked encoding will be used. > > It might be helpful to know if this only happens on chunked, fixed length > or both. > > Stuart > > Edgar Espina wrote: > >> latest: 1.2.0.Beta8 >> >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > > wrote: >> >> Also what version of Undertow are you using? >> >> Stuart >> >> ----- Original Message ----- >> > From: "Edgar Espina" > > >> > To: "Stuart Douglas" > > >> > Cc: undertow-dev at lists.jboss.org >> >> > Sent: Monday, 19 January, 2015 11:13:21 AM >> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy >> > >> > found this in apache: >> > >> > (104) Connection reset by peer: proxy: error reading status line >> from >> > remote server >> > >> > but nothing in undertow. >> > >> > got 502 on HTTP GET. Sometimes while calling the home page / or >> when page >> > loads OK, got 502 on page resources (js, css, images). >> > >> > I call startBlocking and use the outputstream to write the >> response, when >> > everything has been written I call the "outputstream.close" >> method. Do I >> > need to call exchange.endExchange too? >> > >> > Thanks >> > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas >> > wrote: >> > >> > > Is there any info in the log? Or is there any specific type of >> request >> > > that causes this? >> > > >> > > Stuart >> > > >> > > >> > > ----- Original Message ----- >> > > > From: "Edgar Espina" > > >> > > > To: undertow-dev at lists.jboss.org >> >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM >> > > > Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy >> > > > >> > > > Hi, >> > > > >> > > > I've an Undertow application behind apache reverse proxy, >> trying to load >> > > a >> > > > page displays error 502 proxy error. >> > > > >> > > > Still couldn't find why so I wonder if any of you find a >> similar problem >> > > with >> > > > Undertow and Apache. >> > > > >> > > > Please note this is our first app on top of Undertow, >> existing apps >> > > running >> > > > on Tomcat/Jetty are OK. >> > > > >> > > > Appreciate any help. >> > > > >> > > > Thanks >> > > > >> > > > -- >> > > > edgar >> > > > >> > > > _______________________________________________ >> > > > undertow-dev mailing list >> > > > undertow-dev at lists.jboss.org >> >> > > > https://lists.jboss.org/mailman/listinfo/undertow-dev >> > > >> > >> > >> > >> > -- >> > edgar >> > >> >> >> >> >> -- >> edgar >> > -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150118/2f68b12b/attachment.html From sdouglas at redhat.com Sun Jan 18 19:59:15 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Mon, 19 Jan 2015 11:59:15 +1100 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <278068504.9598826.1421625127123.JavaMail.zimbra@redhat.com> <2108662223.9604758.1421628120959.JavaMail.zimbra@redhat.com> <54BC545A.9020701@redhat.com> Message-ID: <54BC56E3.80602@redhat.com> Edgar Espina wrote: > I'm not, channel does it. > > Problem is present on both. For example, home page has a content-length > header but jquery.js use chunked. 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). > > Do I have to call .endExchange? or closing the output stream is enough? 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. The 'connection reset by peer' 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. 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. Stuart > > Thanks > > On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas > wrote: > > Another question, are you setting a content length on the responses? > If not the channel will automatically set one if the response fits > inside a buffer, otherwise chunked encoding will be used. > > It might be helpful to know if this only happens on chunked, fixed > length or both. > > Stuart > > Edgar Espina wrote: > > latest: 1.2.0.Beta8 > > On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > > >> wrote: > > Also what version of Undertow are you using? > > Stuart > > ----- Original Message ----- > > From: "Edgar Espina" > __>> > > To: "Stuart Douglas" > >> > > Cc: undertow-dev at lists.jboss.org > > > > > Sent: Monday, 19 January, 2015 11:13:21 AM > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > found this in apache: > > > > (104) Connection reset by peer: proxy: error reading status > line from > > remote server > > > > but nothing in undertow. > > > > got 502 on HTTP GET. Sometimes while calling the home page / or > when page > > loads OK, got 502 on page resources (js, css, images). > > > > I call startBlocking and use the outputstream to write the > response, when > > everything has been written I call the "outputstream.close" > method. Do I > > need to call exchange.endExchange too? > > > > Thanks > > > > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas > > >> wrote: > > > > > Is there any info in the log? Or is there any specific type of > request > > > that causes this? > > > > > > Stuart > > > > > > > > > ----- Original Message ----- > > > > From: "Edgar Espina" > __>> > > > > To: undertow-dev at lists.jboss.org > > > > > > > Sent: Monday, 19 January, 2015 9:42:19 AM > > > > Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > > > > > Hi, > > > > > > > > I've an Undertow application behind apache reverse proxy, > trying to load > > > a > > > > page displays error 502 proxy error. > > > > > > > > Still couldn't find why so I wonder if any of you find a > similar problem > > > with > > > > Undertow and Apache. > > > > > > > > Please note this is our first app on top of Undertow, > existing apps > > > running > > > > on Tomcat/Jetty are OK. > > > > > > > > Appreciate any help. > > > > > > > > Thanks > > > > > > > > -- > > > > edgar > > > > > > > > _________________________________________________ > > > > undertow-dev mailing list > > > > undertow-dev at lists.jboss.org > > > > > > > https://lists.jboss.org/__mailman/listinfo/undertow-dev > > > > > > > > > > > > -- > > edgar > > > > > > > -- > edgar > > > > > -- > edgar From espina.edgar at gmail.com Sun Jan 18 20:10:16 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Sun, 18 Jan 2015 22:10:16 -0300 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: <54BC56E3.80602@redhat.com> References: <278068504.9598826.1421625127123.JavaMail.zimbra@redhat.com> <2108662223.9604758.1421628120959.JavaMail.zimbra@redhat.com> <54BC545A.9020701@redhat.com> <54BC56E3.80602@redhat.com> Message-ID: It is a default undertow instance with a HTTP listener, just set work threads to 200. Is there a default idle timeout? I can' tell from javadoc and looking at the code. On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas wrote: > > > Edgar Espina wrote: > >> I'm not, channel does it. >> >> Problem is present on both. For example, home page has a content-length >> header but jquery.js use chunked. >> > > 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). > > >> Do I have to call .endExchange? or closing the output stream is enough? >> > > 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. > > The 'connection reset by peer' 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. > > 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. > > Stuart > > >> Thanks >> >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas > > wrote: >> >> Another question, are you setting a content length on the responses? >> If not the channel will automatically set one if the response fits >> inside a buffer, otherwise chunked encoding will be used. >> >> It might be helpful to know if this only happens on chunked, fixed >> length or both. >> >> Stuart >> >> Edgar Espina wrote: >> >> latest: 1.2.0.Beta8 >> >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas >> >> >> wrote: >> >> Also what version of Undertow are you using? >> >> Stuart >> >> ----- Original Message ----- >> > From: "Edgar Espina" > >> > >__>> >> > To: "Stuart Douglas" > >> >> >> > Cc: undertow-dev at lists.jboss.org >> >> > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM >> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP >> Proxy >> > >> > found this in apache: >> > >> > (104) Connection reset by peer: proxy: error reading status >> line from >> > remote server >> > >> > but nothing in undertow. >> > >> > got 502 on HTTP GET. Sometimes while calling the home page / or >> when page >> > loads OK, got 502 on page resources (js, css, images). >> > >> > I call startBlocking and use the outputstream to write the >> response, when >> > everything has been written I call the "outputstream.close" >> method. Do I >> > need to call exchange.endExchange too? >> > >> > Thanks >> > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas >> >> >> wrote: >> > >> > > Is there any info in the log? Or is there any specific type >> of >> request >> > > that causes this? >> > > >> > > Stuart >> > > >> > > >> > > ----- Original Message ----- >> > > > From: "Edgar Espina" > >> > >__>> >> > > > To: undertow-dev at lists.jboss.org >> >> > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM >> > > > Subject: [undertow-dev] occasional 502 from Apache HTTP >> Proxy >> > > > >> > > > Hi, >> > > > >> > > > I've an Undertow application behind apache reverse proxy, >> trying to load >> > > a >> > > > page displays error 502 proxy error. >> > > > >> > > > Still couldn't find why so I wonder if any of you find a >> similar problem >> > > with >> > > > Undertow and Apache. >> > > > >> > > > Please note this is our first app on top of Undertow, >> existing apps >> > > running >> > > > on Tomcat/Jetty are OK. >> > > > >> > > > Appreciate any help. >> > > > >> > > > Thanks >> > > > >> > > > -- >> > > > edgar >> > > > >> > > > _________________________________________________ >> > > > undertow-dev mailing list >> > > > undertow-dev at lists.jboss.org >> >> > > >> > > > https://lists.jboss.org/__mailman/listinfo/undertow-dev >> >> > > >> > >> > >> > >> > -- >> > edgar >> > >> >> >> >> >> -- >> edgar >> >> >> >> >> -- >> edgar >> > -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150118/24dea505/attachment-0001.html From sdouglas at redhat.com Sun Jan 18 20:36:30 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Sun, 18 Jan 2015 20:36:30 -0500 (EST) Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <2108662223.9604758.1421628120959.JavaMail.zimbra@redhat.com> <54BC545A.9020701@redhat.com> <54BC56E3.80602@redhat.com> Message-ID: <851325714.9614036.1421631390792.JavaMail.zimbra@redhat.com> ----- Original Message ----- > From: "Edgar Espina" > To: "Stuart Douglas" > Cc: undertow-dev at lists.jboss.org > Sent: Monday, 19 January, 2015 12:10:16 PM > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > It is a default undertow instance with a HTTP listener, just set work > threads to 200. Is there a default idle timeout? I can' tell from javadoc > and looking at the code. > There is no default idle timeout. Stuart > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas wrote: > > > > > > > Edgar Espina wrote: > > > >> I'm not, channel does it. > >> > >> Problem is present on both. For example, home page has a content-length > >> header but jquery.js use chunked. > >> > > > > 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). > > > > > >> Do I have to call .endExchange? or closing the output stream is enough? > >> > > > > 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. > > > > The 'connection reset by peer' 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. > > > > 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. > > > > Stuart > > > > > >> Thanks > >> > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas >> > wrote: > >> > >> Another question, are you setting a content length on the responses? > >> If not the channel will automatically set one if the response fits > >> inside a buffer, otherwise chunked encoding will be used. > >> > >> It might be helpful to know if this only happens on chunked, fixed > >> length or both. > >> > >> Stuart > >> > >> Edgar Espina wrote: > >> > >> latest: 1.2.0.Beta8 > >> > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > >> > >> >> wrote: > >> > >> Also what version of Undertow are you using? > >> > >> Stuart > >> > >> ----- Original Message ----- > >> > From: "Edgar Espina" >> > >> >> >__>> > >> > To: "Stuart Douglas" >> > >> >> > >> > Cc: undertow-dev at lists.jboss.org > >> > >> >> > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM > >> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP > >> Proxy > >> > > >> > found this in apache: > >> > > >> > (104) Connection reset by peer: proxy: error reading status > >> line from > >> > remote server > >> > > >> > but nothing in undertow. > >> > > >> > got 502 on HTTP GET. Sometimes while calling the home page / or > >> when page > >> > loads OK, got 502 on page resources (js, css, images). > >> > > >> > I call startBlocking and use the outputstream to write the > >> response, when > >> > everything has been written I call the "outputstream.close" > >> method. Do I > >> > need to call exchange.endExchange too? > >> > > >> > Thanks > >> > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas > >> > >> >> wrote: > >> > > >> > > Is there any info in the log? Or is there any specific type > >> of > >> request > >> > > that causes this? > >> > > > >> > > Stuart > >> > > > >> > > > >> > > ----- Original Message ----- > >> > > > From: "Edgar Espina" >> > >> >> >__>> > >> > > > To: undertow-dev at lists.jboss.org > >> > >> >> > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM > >> > > > Subject: [undertow-dev] occasional 502 from Apache HTTP > >> Proxy > >> > > > > >> > > > Hi, > >> > > > > >> > > > I've an Undertow application behind apache reverse proxy, > >> trying to load > >> > > a > >> > > > page displays error 502 proxy error. > >> > > > > >> > > > Still couldn't find why so I wonder if any of you find a > >> similar problem > >> > > with > >> > > > Undertow and Apache. > >> > > > > >> > > > Please note this is our first app on top of Undertow, > >> existing apps > >> > > running > >> > > > on Tomcat/Jetty are OK. > >> > > > > >> > > > Appreciate any help. > >> > > > > >> > > > Thanks > >> > > > > >> > > > -- > >> > > > edgar > >> > > > > >> > > > _________________________________________________ > >> > > > undertow-dev mailing list > >> > > > undertow-dev at lists.jboss.org > >> > >> >> > > >> > > > https://lists.jboss.org/__mailman/listinfo/undertow-dev > >> > >> > > > >> > > >> > > >> > > >> > -- > >> > edgar > >> > > >> > >> > >> > >> > >> -- > >> edgar > >> > >> > >> > >> > >> -- > >> edgar > >> > > > > > -- > edgar > From sdouglas at redhat.com Sun Jan 18 21:13:41 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Sun, 18 Jan 2015 21:13:41 -0500 (EST) Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <2108662223.9604758.1421628120959.JavaMail.zimbra@redhat.com> <54BC545A.9020701@redhat.com> <54BC56E3.80602@redhat.com> Message-ID: <560157572.9618468.1421633621833.JavaMail.zimbra@redhat.com> 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. Can you try adding: undertow.setSocketOption(Options.BACKLOG, 1000) To your Undertow builder? I am going to increase this in our default config upstream. Hopefully this is the issue that you are running into. Stuart ----- Original Message ----- > From: "Edgar Espina" > To: "Stuart Douglas" > Cc: undertow-dev at lists.jboss.org > Sent: Monday, 19 January, 2015 12:10:16 PM > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > It is a default undertow instance with a HTTP listener, just set work > threads to 200. Is there a default idle timeout? I can' tell from javadoc > and looking at the code. > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas wrote: > > > > > > > Edgar Espina wrote: > > > >> I'm not, channel does it. > >> > >> Problem is present on both. For example, home page has a content-length > >> header but jquery.js use chunked. > >> > > > > 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). > > > > > >> Do I have to call .endExchange? or closing the output stream is enough? > >> > > > > 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. > > > > The 'connection reset by peer' 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. > > > > 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. > > > > Stuart > > > > > >> Thanks > >> > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas >> > wrote: > >> > >> Another question, are you setting a content length on the responses? > >> If not the channel will automatically set one if the response fits > >> inside a buffer, otherwise chunked encoding will be used. > >> > >> It might be helpful to know if this only happens on chunked, fixed > >> length or both. > >> > >> Stuart > >> > >> Edgar Espina wrote: > >> > >> latest: 1.2.0.Beta8 > >> > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > >> > >> >> wrote: > >> > >> Also what version of Undertow are you using? > >> > >> Stuart > >> > >> ----- Original Message ----- > >> > From: "Edgar Espina" >> > >> >> >__>> > >> > To: "Stuart Douglas" >> > >> >> > >> > Cc: undertow-dev at lists.jboss.org > >> > >> >> > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM > >> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP > >> Proxy > >> > > >> > found this in apache: > >> > > >> > (104) Connection reset by peer: proxy: error reading status > >> line from > >> > remote server > >> > > >> > but nothing in undertow. > >> > > >> > got 502 on HTTP GET. Sometimes while calling the home page / or > >> when page > >> > loads OK, got 502 on page resources (js, css, images). > >> > > >> > I call startBlocking and use the outputstream to write the > >> response, when > >> > everything has been written I call the "outputstream.close" > >> method. Do I > >> > need to call exchange.endExchange too? > >> > > >> > Thanks > >> > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas > >> > >> >> wrote: > >> > > >> > > Is there any info in the log? Or is there any specific type > >> of > >> request > >> > > that causes this? > >> > > > >> > > Stuart > >> > > > >> > > > >> > > ----- Original Message ----- > >> > > > From: "Edgar Espina" >> > >> >> >__>> > >> > > > To: undertow-dev at lists.jboss.org > >> > >> >> > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM > >> > > > Subject: [undertow-dev] occasional 502 from Apache HTTP > >> Proxy > >> > > > > >> > > > Hi, > >> > > > > >> > > > I've an Undertow application behind apache reverse proxy, > >> trying to load > >> > > a > >> > > > page displays error 502 proxy error. > >> > > > > >> > > > Still couldn't find why so I wonder if any of you find a > >> similar problem > >> > > with > >> > > > Undertow and Apache. > >> > > > > >> > > > Please note this is our first app on top of Undertow, > >> existing apps > >> > > running > >> > > > on Tomcat/Jetty are OK. > >> > > > > >> > > > Appreciate any help. > >> > > > > >> > > > Thanks > >> > > > > >> > > > -- > >> > > > edgar > >> > > > > >> > > > _________________________________________________ > >> > > > undertow-dev mailing list > >> > > > undertow-dev at lists.jboss.org > >> > >> >> > > >> > > > https://lists.jboss.org/__mailman/listinfo/undertow-dev > >> > >> > > > >> > > >> > > >> > > >> > -- > >> > edgar > >> > > >> > >> > >> > >> > >> -- > >> edgar > >> > >> > >> > >> > >> -- > >> edgar > >> > > > > > -- > edgar > From espina.edgar at gmail.com Sun Jan 18 22:53:06 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Mon, 19 Jan 2015 00:53:06 -0300 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: <560157572.9618468.1421633621833.JavaMail.zimbra@redhat.com> References: <2108662223.9604758.1421628120959.JavaMail.zimbra@redhat.com> <54BC545A.9020701@redhat.com> <54BC56E3.80602@redhat.com> <560157572.9618468.1421633621833.JavaMail.zimbra@redhat.com> Message-ID: Done, but makes no difference. Still got the 502 random errors :S On Sun, Jan 18, 2015 at 11:13 PM, Stuart Douglas wrote: > 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. > > Can you try adding: > > undertow.setSocketOption(Options.BACKLOG, 1000) > > To your Undertow builder? I am going to increase this in our default > config upstream. > > Hopefully this is the issue that you are running into. > > Stuart > > > ----- Original Message ----- > > From: "Edgar Espina" > > To: "Stuart Douglas" > > Cc: undertow-dev at lists.jboss.org > > Sent: Monday, 19 January, 2015 12:10:16 PM > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > It is a default undertow instance with a HTTP listener, just set work > > threads to 200. Is there a default idle timeout? I can' tell from javadoc > > and looking at the code. > > > > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas > wrote: > > > > > > > > > > > Edgar Espina wrote: > > > > > >> I'm not, channel does it. > > >> > > >> Problem is present on both. For example, home page has a > content-length > > >> header but jquery.js use chunked. > > >> > > > > > > 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). > > > > > > > > >> Do I have to call .endExchange? or closing the output stream is > enough? > > >> > > > > > > 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. > > > > > > The 'connection reset by peer' 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. > > > > > > 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. > > > > > > Stuart > > > > > > > > >> Thanks > > >> > > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas > >> > wrote: > > >> > > >> Another question, are you setting a content length on the > responses? > > >> If not the channel will automatically set one if the response fits > > >> inside a buffer, otherwise chunked encoding will be used. > > >> > > >> It might be helpful to know if this only happens on chunked, fixed > > >> length or both. > > >> > > >> Stuart > > >> > > >> Edgar Espina wrote: > > >> > > >> latest: 1.2.0.Beta8 > > >> > > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > > >> > > >> >> > wrote: > > >> > > >> Also what version of Undertow are you using? > > >> > > >> Stuart > > >> > > >> ----- Original Message ----- > > >> > From: "Edgar Espina" > >> > > >> > >> >__>> > > >> > To: "Stuart Douglas" > >> > > >> >> > > >> > Cc: undertow-dev at lists.jboss.org > > >> > > >> > >> > > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM > > >> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP > > >> Proxy > > >> > > > >> > found this in apache: > > >> > > > >> > (104) Connection reset by peer: proxy: error reading status > > >> line from > > >> > remote server > > >> > > > >> > but nothing in undertow. > > >> > > > >> > got 502 on HTTP GET. Sometimes while calling the home page > / or > > >> when page > > >> > loads OK, got 502 on page resources (js, css, images). > > >> > > > >> > I call startBlocking and use the outputstream to write the > > >> response, when > > >> > everything has been written I call the "outputstream.close" > > >> method. Do I > > >> > need to call exchange.endExchange too? > > >> > > > >> > Thanks > > >> > > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas > > >> > > >> >> > wrote: > > >> > > > >> > > Is there any info in the log? Or is there any specific > type > > >> of > > >> request > > >> > > that causes this? > > >> > > > > >> > > Stuart > > >> > > > > >> > > > > >> > > ----- Original Message ----- > > >> > > > From: "Edgar Espina" > >> > > >> > >> >__>> > > >> > > > To: undertow-dev at lists.jboss.org > > >> > > >> > >> > > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM > > >> > > > Subject: [undertow-dev] occasional 502 from Apache HTTP > > >> Proxy > > >> > > > > > >> > > > Hi, > > >> > > > > > >> > > > I've an Undertow application behind apache reverse > proxy, > > >> trying to load > > >> > > a > > >> > > > page displays error 502 proxy error. > > >> > > > > > >> > > > Still couldn't find why so I wonder if any of you find > a > > >> similar problem > > >> > > with > > >> > > > Undertow and Apache. > > >> > > > > > >> > > > Please note this is our first app on top of Undertow, > > >> existing apps > > >> > > running > > >> > > > on Tomcat/Jetty are OK. > > >> > > > > > >> > > > Appreciate any help. > > >> > > > > > >> > > > Thanks > > >> > > > > > >> > > > -- > > >> > > > edgar > > >> > > > > > >> > > > _________________________________________________ > > >> > > > undertow-dev mailing list > > >> > > > undertow-dev at lists.jboss.org > > >> > > >> > >> > > > >> > > > > https://lists.jboss.org/__mailman/listinfo/undertow-dev > > >> > > >> > > > > >> > > > >> > > > >> > > > >> > -- > > >> > edgar > > >> > > > >> > > >> > > >> > > >> > > >> -- > > >> edgar > > >> > > >> > > >> > > >> > > >> -- > > >> edgar > > >> > > > > > > > > > -- > > edgar > > > -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150119/4c8a0a5a/attachment-0001.html From sdouglas at redhat.com Mon Jan 19 00:12:12 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Mon, 19 Jan 2015 00:12:12 -0500 (EST) Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <54BC545A.9020701@redhat.com> <54BC56E3.80602@redhat.com> <560157572.9618468.1421633621833.JavaMail.zimbra@redhat.com> Message-ID: <1010163216.9639599.1421644332425.JavaMail.zimbra@redhat.com> My best guess as to what is happening is that Undertow closing a connection after a request is done for some reason, and the apache attempts to re-use this connection without realising that it is dead. In general this should not happen, Undertow should only forcibly close a connection if it knows that it is broken (e.g. a content length is set and the full amount of content is not written). For a normal graceful close Undertow should be sending Connection:close headers. I am going to investigate some more, and see if I can figure out what is going on. It seems unlikely but is there any chance your code forcibly closes the ServerConnection (HttpServerExchange.getConnection()) because that could potentially cause this issue. Setting the exchange to non-persistent after headers have been sent could also cause it. Stuart ----- Original Message ----- > From: "Edgar Espina" > To: "Stuart Douglas" > Cc: undertow-dev at lists.jboss.org > Sent: Monday, 19 January, 2015 2:53:06 PM > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > Done, but makes no difference. Still got the 502 random errors :S > > On Sun, Jan 18, 2015 at 11:13 PM, Stuart Douglas > wrote: > > > 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. > > > > Can you try adding: > > > > undertow.setSocketOption(Options.BACKLOG, 1000) > > > > To your Undertow builder? I am going to increase this in our default > > config upstream. > > > > Hopefully this is the issue that you are running into. > > > > Stuart > > > > > > ----- Original Message ----- > > > From: "Edgar Espina" > > > To: "Stuart Douglas" > > > Cc: undertow-dev at lists.jboss.org > > > Sent: Monday, 19 January, 2015 12:10:16 PM > > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > > > It is a default undertow instance with a HTTP listener, just set work > > > threads to 200. Is there a default idle timeout? I can' tell from javadoc > > > and looking at the code. > > > > > > > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas > > wrote: > > > > > > > > > > > > > > > Edgar Espina wrote: > > > > > > > >> I'm not, channel does it. > > > >> > > > >> Problem is present on both. For example, home page has a > > content-length > > > >> header but jquery.js use chunked. > > > >> > > > > > > > > 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). > > > > > > > > > > > >> Do I have to call .endExchange? or closing the output stream is > > enough? > > > >> > > > > > > > > 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. > > > > > > > > The 'connection reset by peer' 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. > > > > > > > > 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. > > > > > > > > Stuart > > > > > > > > > > > >> Thanks > > > >> > > > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas > > >> > wrote: > > > >> > > > >> Another question, are you setting a content length on the > > responses? > > > >> If not the channel will automatically set one if the response fits > > > >> inside a buffer, otherwise chunked encoding will be used. > > > >> > > > >> It might be helpful to know if this only happens on chunked, fixed > > > >> length or both. > > > >> > > > >> Stuart > > > >> > > > >> Edgar Espina wrote: > > > >> > > > >> latest: 1.2.0.Beta8 > > > >> > > > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > > > >> > > > >> >> > > wrote: > > > >> > > > >> Also what version of Undertow are you using? > > > >> > > > >> Stuart > > > >> > > > >> ----- Original Message ----- > > > >> > From: "Edgar Espina" > > >> > > > >> > > >> >__>> > > > >> > To: "Stuart Douglas" > > >> > > > >> >> > > > >> > Cc: undertow-dev at lists.jboss.org > > > >> > > > >> > > >> > > > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM > > > >> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP > > > >> Proxy > > > >> > > > > >> > found this in apache: > > > >> > > > > >> > (104) Connection reset by peer: proxy: error reading status > > > >> line from > > > >> > remote server > > > >> > > > > >> > but nothing in undertow. > > > >> > > > > >> > got 502 on HTTP GET. Sometimes while calling the home page > > / or > > > >> when page > > > >> > loads OK, got 502 on page resources (js, css, images). > > > >> > > > > >> > I call startBlocking and use the outputstream to write the > > > >> response, when > > > >> > everything has been written I call the "outputstream.close" > > > >> method. Do I > > > >> > need to call exchange.endExchange too? > > > >> > > > > >> > Thanks > > > >> > > > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas > > > >> > > > >> >> > > wrote: > > > >> > > > > >> > > Is there any info in the log? Or is there any specific > > type > > > >> of > > > >> request > > > >> > > that causes this? > > > >> > > > > > >> > > Stuart > > > >> > > > > > >> > > > > > >> > > ----- Original Message ----- > > > >> > > > From: "Edgar Espina" > > >> > > > >> > > >> >__>> > > > >> > > > To: undertow-dev at lists.jboss.org > > > >> > > > >> > > >> > > > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM > > > >> > > > Subject: [undertow-dev] occasional 502 from Apache HTTP > > > >> Proxy > > > >> > > > > > > >> > > > Hi, > > > >> > > > > > > >> > > > I've an Undertow application behind apache reverse > > proxy, > > > >> trying to load > > > >> > > a > > > >> > > > page displays error 502 proxy error. > > > >> > > > > > > >> > > > Still couldn't find why so I wonder if any of you find > > a > > > >> similar problem > > > >> > > with > > > >> > > > Undertow and Apache. > > > >> > > > > > > >> > > > Please note this is our first app on top of Undertow, > > > >> existing apps > > > >> > > running > > > >> > > > on Tomcat/Jetty are OK. > > > >> > > > > > > >> > > > Appreciate any help. > > > >> > > > > > > >> > > > Thanks > > > >> > > > > > > >> > > > -- > > > >> > > > edgar > > > >> > > > > > > >> > > > _________________________________________________ > > > >> > > > undertow-dev mailing list > > > >> > > > undertow-dev at lists.jboss.org > > > >> > > > >> > > >> > > > > >> > > > > > https://lists.jboss.org/__mailman/listinfo/undertow-dev > > > >> > > > >> > > > > > >> > > > > >> > > > > >> > > > > >> > -- > > > >> > edgar > > > >> > > > > >> > > > >> > > > >> > > > >> > > > >> -- > > > >> edgar > > > >> > > > >> > > > >> > > > >> > > > >> -- > > > >> edgar > > > >> > > > > > > > > > > > > > -- > > > edgar > > > > > > > > > -- > edgar > From espina.edgar at gmail.com Mon Jan 19 07:15:48 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Mon, 19 Jan 2015 09:15:48 -0300 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: <1010163216.9639599.1421644332425.JavaMail.zimbra@redhat.com> References: <54BC545A.9020701@redhat.com> <54BC56E3.80602@redhat.com> <560157572.9618468.1421633621833.JavaMail.zimbra@redhat.com> <1010163216.9639599.1421644332425.JavaMail.zimbra@redhat.com> Message-ID: The source code can be found here: https://github.com/jooby-project/jooby Undertow related classes are here: https://github.com/jooby-project/jooby/tree/master/jooby/src/main/java/org/jooby/internal/undertow . Server is built here: https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowServer.java Response is sent here: https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowResponse.java#L336-382 My microweb-framework was built on top of Jetty, so for now I used the blocking API and follow more or less what we usually do with Servlets (acquire an outstream). I will review what I'm doing and try to figure it out what is going on too. Thanks for your help, Stuart. On Mon, Jan 19, 2015 at 2:12 AM, Stuart Douglas wrote: > My best guess as to what is happening is that Undertow closing a > connection after a request is done for some reason, and the apache attempts > to re-use this connection without realising that it is dead. > > In general this should not happen, Undertow should only forcibly close a > connection if it knows that it is broken (e.g. a content length is set and > the full amount of content is not written). For a normal graceful close > Undertow should be sending Connection:close headers. > > I am going to investigate some more, and see if I can figure out what is > going on. It seems unlikely but is there any chance your code forcibly > closes the ServerConnection (HttpServerExchange.getConnection()) because > that could potentially cause this issue. Setting the exchange to > non-persistent after headers have been sent could also cause it. > > Stuart > > ----- Original Message ----- > > From: "Edgar Espina" > > To: "Stuart Douglas" > > Cc: undertow-dev at lists.jboss.org > > Sent: Monday, 19 January, 2015 2:53:06 PM > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > Done, but makes no difference. Still got the 502 random errors :S > > > > On Sun, Jan 18, 2015 at 11:13 PM, Stuart Douglas > > wrote: > > > > > 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. > > > > > > Can you try adding: > > > > > > undertow.setSocketOption(Options.BACKLOG, 1000) > > > > > > To your Undertow builder? I am going to increase this in our default > > > config upstream. > > > > > > Hopefully this is the issue that you are running into. > > > > > > Stuart > > > > > > > > > ----- Original Message ----- > > > > From: "Edgar Espina" > > > > To: "Stuart Douglas" > > > > Cc: undertow-dev at lists.jboss.org > > > > Sent: Monday, 19 January, 2015 12:10:16 PM > > > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > > > > > It is a default undertow instance with a HTTP listener, just set work > > > > threads to 200. Is there a default idle timeout? I can' tell from > javadoc > > > > and looking at the code. > > > > > > > > > > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas > > > > wrote: > > > > > > > > > > > > > > > > > > > Edgar Espina wrote: > > > > > > > > > >> I'm not, channel does it. > > > > >> > > > > >> Problem is present on both. For example, home page has a > > > content-length > > > > >> header but jquery.js use chunked. > > > > >> > > > > > > > > > > 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). > > > > > > > > > > > > > > >> Do I have to call .endExchange? or closing the output stream is > > > enough? > > > > >> > > > > > > > > > > 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. > > > > > > > > > > The 'connection reset by peer' 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. > > > > > > > > > > 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. > > > > > > > > > > Stuart > > > > > > > > > > > > > > >> Thanks > > > > >> > > > > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas < > sdouglas at redhat.com > > > > >> > wrote: > > > > >> > > > > >> Another question, are you setting a content length on the > > > responses? > > > > >> If not the channel will automatically set one if the response > fits > > > > >> inside a buffer, otherwise chunked encoding will be used. > > > > >> > > > > >> It might be helpful to know if this only happens on chunked, > fixed > > > > >> length or both. > > > > >> > > > > >> Stuart > > > > >> > > > > >> Edgar Espina wrote: > > > > >> > > > > >> latest: 1.2.0.Beta8 > > > > >> > > > > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > > > > >> > > > > >> >>> > > > wrote: > > > > >> > > > > >> Also what version of Undertow are you using? > > > > >> > > > > >> Stuart > > > > >> > > > > >> ----- Original Message ----- > > > > >> > From: "Edgar Espina" > > > >> > > > > >> espina.edgar at gmail.com > > > > >> >__>> > > > > >> > To: "Stuart Douglas" > > > >> > > > > >> >>> > > > > >> > Cc: undertow-dev at lists.jboss.org > > > > >> > > > > >> > > > >> > > > > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM > > > > >> > Subject: Re: [undertow-dev] occasional 502 from Apache > HTTP > > > > >> Proxy > > > > >> > > > > > >> > found this in apache: > > > > >> > > > > > >> > (104) Connection reset by peer: proxy: error reading > status > > > > >> line from > > > > >> > remote server > > > > >> > > > > > >> > but nothing in undertow. > > > > >> > > > > > >> > got 502 on HTTP GET. Sometimes while calling the home > page > > > / or > > > > >> when page > > > > >> > loads OK, got 502 on page resources (js, css, images). > > > > >> > > > > > >> > I call startBlocking and use the outputstream to write > the > > > > >> response, when > > > > >> > everything has been written I call the > "outputstream.close" > > > > >> method. Do I > > > > >> > need to call exchange.endExchange too? > > > > >> > > > > > >> > Thanks > > > > >> > > > > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas > > > > >> > > > > >> >>> > > > wrote: > > > > >> > > > > > >> > > Is there any info in the log? Or is there any > specific > > > type > > > > >> of > > > > >> request > > > > >> > > that causes this? > > > > >> > > > > > > >> > > Stuart > > > > >> > > > > > > >> > > > > > > >> > > ----- Original Message ----- > > > > >> > > > From: "Edgar Espina" > > > >> > > > > >> espina.edgar at gmail.com > > > > >> >__>> > > > > >> > > > To: undertow-dev at lists.jboss.org > > > > >> > > > > >> > > > >> > > > > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM > > > > >> > > > Subject: [undertow-dev] occasional 502 from Apache > HTTP > > > > >> Proxy > > > > >> > > > > > > > >> > > > Hi, > > > > >> > > > > > > > >> > > > I've an Undertow application behind apache reverse > > > proxy, > > > > >> trying to load > > > > >> > > a > > > > >> > > > page displays error 502 proxy error. > > > > >> > > > > > > > >> > > > Still couldn't find why so I wonder if any of you > find > > > a > > > > >> similar problem > > > > >> > > with > > > > >> > > > Undertow and Apache. > > > > >> > > > > > > > >> > > > Please note this is our first app on top of > Undertow, > > > > >> existing apps > > > > >> > > running > > > > >> > > > on Tomcat/Jetty are OK. > > > > >> > > > > > > > >> > > > Appreciate any help. > > > > >> > > > > > > > >> > > > Thanks > > > > >> > > > > > > > >> > > > -- > > > > >> > > > edgar > > > > >> > > > > > > > >> > > > _________________________________________________ > > > > >> > > > undertow-dev mailing list > > > > >> > > > undertow-dev at lists.jboss.org > > > > >> > > > > >> > > > >> > > > > > >> > > > > > > https://lists.jboss.org/__mailman/listinfo/undertow-dev > > > > >> > > > > >> > > > > > > >> > > > > > >> > > > > > >> > > > > > >> > -- > > > > >> > edgar > > > > >> > > > > > >> > > > > >> > > > > >> > > > > >> > > > > >> -- > > > > >> edgar > > > > >> > > > > >> > > > > >> > > > > >> > > > > >> -- > > > > >> edgar > > > > >> > > > > > > > > > > > > > > > > > -- > > > > edgar > > > > > > > > > > > > > > > -- > > edgar > > > -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150119/dda1b0c6/attachment-0001.html From tomaz.cerar at gmail.com Mon Jan 19 07:29:12 2015 From: tomaz.cerar at gmail.com (=?UTF-8?B?VG9tYcW+IENlcmFy?=) Date: Mon, 19 Jan 2015 13:29:12 +0100 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <54BC545A.9020701@redhat.com> <54BC56E3.80602@redhat.com> <560157572.9618468.1421633621833.JavaMail.zimbra@redhat.com> <1010163216.9639599.1421644332425.JavaMail.zimbra@redhat.com> Message-ID: Edgar, what is the version of Apache and mod_proxy module you are using. maybe it will be easier to reproduce with exact version you have.. -- tomaz On Mon, Jan 19, 2015 at 1:15 PM, Edgar Espina wrote: > The source code can be found here: https://github.com/jooby-project/jooby > > Undertow related classes are here: > https://github.com/jooby-project/jooby/tree/master/jooby/src/main/java/org/jooby/internal/undertow > . > Server is built here: > https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowServer.java > Response is sent here: > https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowResponse.java#L336-382 > > My microweb-framework was built on top of Jetty, so for now I used the > blocking API and follow more or less what we usually do with Servlets > (acquire an outstream). > > I will review what I'm doing and try to figure it out what is going on too. > > Thanks for your help, Stuart. > > > > > On Mon, Jan 19, 2015 at 2:12 AM, Stuart Douglas > wrote: > >> My best guess as to what is happening is that Undertow closing a >> connection after a request is done for some reason, and the apache attempts >> to re-use this connection without realising that it is dead. >> >> In general this should not happen, Undertow should only forcibly close a >> connection if it knows that it is broken (e.g. a content length is set and >> the full amount of content is not written). For a normal graceful close >> Undertow should be sending Connection:close headers. >> >> I am going to investigate some more, and see if I can figure out what is >> going on. It seems unlikely but is there any chance your code forcibly >> closes the ServerConnection (HttpServerExchange.getConnection()) because >> that could potentially cause this issue. Setting the exchange to >> non-persistent after headers have been sent could also cause it. >> >> Stuart >> >> ----- Original Message ----- >> > From: "Edgar Espina" >> > To: "Stuart Douglas" >> > Cc: undertow-dev at lists.jboss.org >> > Sent: Monday, 19 January, 2015 2:53:06 PM >> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy >> > >> > Done, but makes no difference. Still got the 502 random errors :S >> > >> > On Sun, Jan 18, 2015 at 11:13 PM, Stuart Douglas >> > wrote: >> > >> > > 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. >> > > >> > > Can you try adding: >> > > >> > > undertow.setSocketOption(Options.BACKLOG, 1000) >> > > >> > > To your Undertow builder? I am going to increase this in our default >> > > config upstream. >> > > >> > > Hopefully this is the issue that you are running into. >> > > >> > > Stuart >> > > >> > > >> > > ----- Original Message ----- >> > > > From: "Edgar Espina" >> > > > To: "Stuart Douglas" >> > > > Cc: undertow-dev at lists.jboss.org >> > > > Sent: Monday, 19 January, 2015 12:10:16 PM >> > > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy >> > > > >> > > > It is a default undertow instance with a HTTP listener, just set >> work >> > > > threads to 200. Is there a default idle timeout? I can' tell from >> javadoc >> > > > and looking at the code. >> > > > >> > > > >> > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas < >> sdouglas at redhat.com> >> > > wrote: >> > > > >> > > > > >> > > > > >> > > > > Edgar Espina wrote: >> > > > > >> > > > >> I'm not, channel does it. >> > > > >> >> > > > >> Problem is present on both. For example, home page has a >> > > content-length >> > > > >> header but jquery.js use chunked. >> > > > >> >> > > > > >> > > > > 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). >> > > > > >> > > > > >> > > > >> Do I have to call .endExchange? or closing the output stream is >> > > enough? >> > > > >> >> > > > > >> > > > > 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. >> > > > > >> > > > > The 'connection reset by peer' 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. >> > > > > >> > > > > 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. >> > > > > >> > > > > Stuart >> > > > > >> > > > > >> > > > >> Thanks >> > > > >> >> > > > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas < >> sdouglas at redhat.com >> > > > >> > wrote: >> > > > >> >> > > > >> Another question, are you setting a content length on the >> > > responses? >> > > > >> If not the channel will automatically set one if the >> response fits >> > > > >> inside a buffer, otherwise chunked encoding will be used. >> > > > >> >> > > > >> It might be helpful to know if this only happens on chunked, >> fixed >> > > > >> length or both. >> > > > >> >> > > > >> Stuart >> > > > >> >> > > > >> Edgar Espina wrote: >> > > > >> >> > > > >> latest: 1.2.0.Beta8 >> > > > >> >> > > > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas >> > > > >> >> > > > >> > >>> >> > > wrote: >> > > > >> >> > > > >> Also what version of Undertow are you using? >> > > > >> >> > > > >> Stuart >> > > > >> >> > > > >> ----- Original Message ----- >> > > > >> > From: "Edgar Espina" > > > > >> >> > > > >> > espina.edgar at gmail.com >> > > > >> >__>> >> > > > >> > To: "Stuart Douglas" > > > > >> >> > > > >> > >>> >> > > > >> > Cc: undertow-dev at lists.jboss.org >> > > > >> >> > > > >> > > > > >> > >> > > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM >> > > > >> > Subject: Re: [undertow-dev] occasional 502 from >> Apache HTTP >> > > > >> Proxy >> > > > >> > >> > > > >> > found this in apache: >> > > > >> > >> > > > >> > (104) Connection reset by peer: proxy: error reading >> status >> > > > >> line from >> > > > >> > remote server >> > > > >> > >> > > > >> > but nothing in undertow. >> > > > >> > >> > > > >> > got 502 on HTTP GET. Sometimes while calling the home >> page >> > > / or >> > > > >> when page >> > > > >> > loads OK, got 502 on page resources (js, css, images). >> > > > >> > >> > > > >> > I call startBlocking and use the outputstream to >> write the >> > > > >> response, when >> > > > >> > everything has been written I call the >> "outputstream.close" >> > > > >> method. Do I >> > > > >> > need to call exchange.endExchange too? >> > > > >> > >> > > > >> > Thanks >> > > > >> > >> > > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas >> > > > >> >> > > > >> > >>> >> > > wrote: >> > > > >> > >> > > > >> > > Is there any info in the log? Or is there any >> specific >> > > type >> > > > >> of >> > > > >> request >> > > > >> > > that causes this? >> > > > >> > > >> > > > >> > > Stuart >> > > > >> > > >> > > > >> > > >> > > > >> > > ----- Original Message ----- >> > > > >> > > > From: "Edgar Espina" > > > > >> >> > > > >> > espina.edgar at gmail.com >> > > > >> >__>> >> > > > >> > > > To: undertow-dev at lists.jboss.org >> > > > >> >> > > > >> > > > > >> > >> > > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM >> > > > >> > > > Subject: [undertow-dev] occasional 502 from >> Apache HTTP >> > > > >> Proxy >> > > > >> > > > >> > > > >> > > > Hi, >> > > > >> > > > >> > > > >> > > > I've an Undertow application behind apache reverse >> > > proxy, >> > > > >> trying to load >> > > > >> > > a >> > > > >> > > > page displays error 502 proxy error. >> > > > >> > > > >> > > > >> > > > Still couldn't find why so I wonder if any of you >> find >> > > a >> > > > >> similar problem >> > > > >> > > with >> > > > >> > > > Undertow and Apache. >> > > > >> > > > >> > > > >> > > > Please note this is our first app on top of >> Undertow, >> > > > >> existing apps >> > > > >> > > running >> > > > >> > > > on Tomcat/Jetty are OK. >> > > > >> > > > >> > > > >> > > > Appreciate any help. >> > > > >> > > > >> > > > >> > > > Thanks >> > > > >> > > > >> > > > >> > > > -- >> > > > >> > > > edgar >> > > > >> > > > >> > > > >> > > > _________________________________________________ >> > > > >> > > > undertow-dev mailing list >> > > > >> > > > undertow-dev at lists.jboss.org >> > > > >> >> > > > >> > > > > >> > >> > > > >> > > > >> > > https://lists.jboss.org/__mailman/listinfo/undertow-dev >> > > > >> >> > > > >> > > >> > > > >> > >> > > > >> > >> > > > >> > >> > > > >> > -- >> > > > >> > edgar >> > > > >> > >> > > > >> >> > > > >> >> > > > >> >> > > > >> >> > > > >> -- >> > > > >> edgar >> > > > >> >> > > > >> >> > > > >> >> > > > >> >> > > > >> -- >> > > > >> edgar >> > > > >> >> > > > > >> > > > >> > > > >> > > > -- >> > > > edgar >> > > > >> > > >> > >> > >> > >> > -- >> > edgar >> > >> > > > > -- > edgar > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150119/1d42a0dd/attachment-0001.html From espina.edgar at gmail.com Mon Jan 19 07:33:13 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Mon, 19 Jan 2015 09:33:13 -0300 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <54BC545A.9020701@redhat.com> <54BC56E3.80602@redhat.com> <560157572.9618468.1421633621833.JavaMail.zimbra@redhat.com> <1010163216.9639599.1421644332425.JavaMail.zimbra@redhat.com> Message-ID: Sure, it is 2.2.15. On Mon, Jan 19, 2015 at 9:29 AM, Toma? Cerar wrote: > Edgar, > > what is the version of Apache and mod_proxy module you are using. > maybe it will be easier to reproduce with exact version you have.. > > -- > tomaz > > On Mon, Jan 19, 2015 at 1:15 PM, Edgar Espina > wrote: > >> The source code can be found here: https://github.com/jooby-project/jooby >> >> Undertow related classes are here: >> https://github.com/jooby-project/jooby/tree/master/jooby/src/main/java/org/jooby/internal/undertow >> . >> Server is built here: >> https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowServer.java >> Response is sent here: >> https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowResponse.java#L336-382 >> >> My microweb-framework was built on top of Jetty, so for now I used the >> blocking API and follow more or less what we usually do with Servlets >> (acquire an outstream). >> >> I will review what I'm doing and try to figure it out what is going on >> too. >> >> Thanks for your help, Stuart. >> >> >> >> >> On Mon, Jan 19, 2015 at 2:12 AM, Stuart Douglas >> wrote: >> >>> My best guess as to what is happening is that Undertow closing a >>> connection after a request is done for some reason, and the apache attempts >>> to re-use this connection without realising that it is dead. >>> >>> In general this should not happen, Undertow should only forcibly close a >>> connection if it knows that it is broken (e.g. a content length is set and >>> the full amount of content is not written). For a normal graceful close >>> Undertow should be sending Connection:close headers. >>> >>> I am going to investigate some more, and see if I can figure out what is >>> going on. It seems unlikely but is there any chance your code forcibly >>> closes the ServerConnection (HttpServerExchange.getConnection()) because >>> that could potentially cause this issue. Setting the exchange to >>> non-persistent after headers have been sent could also cause it. >>> >>> Stuart >>> >>> ----- Original Message ----- >>> > From: "Edgar Espina" >>> > To: "Stuart Douglas" >>> > Cc: undertow-dev at lists.jboss.org >>> > Sent: Monday, 19 January, 2015 2:53:06 PM >>> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy >>> > >>> > Done, but makes no difference. Still got the 502 random errors :S >>> > >>> > On Sun, Jan 18, 2015 at 11:13 PM, Stuart Douglas >>> > wrote: >>> > >>> > > 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. >>> > > >>> > > Can you try adding: >>> > > >>> > > undertow.setSocketOption(Options.BACKLOG, 1000) >>> > > >>> > > To your Undertow builder? I am going to increase this in our default >>> > > config upstream. >>> > > >>> > > Hopefully this is the issue that you are running into. >>> > > >>> > > Stuart >>> > > >>> > > >>> > > ----- Original Message ----- >>> > > > From: "Edgar Espina" >>> > > > To: "Stuart Douglas" >>> > > > Cc: undertow-dev at lists.jboss.org >>> > > > Sent: Monday, 19 January, 2015 12:10:16 PM >>> > > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy >>> > > > >>> > > > It is a default undertow instance with a HTTP listener, just set >>> work >>> > > > threads to 200. Is there a default idle timeout? I can' tell from >>> javadoc >>> > > > and looking at the code. >>> > > > >>> > > > >>> > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas < >>> sdouglas at redhat.com> >>> > > wrote: >>> > > > >>> > > > > >>> > > > > >>> > > > > Edgar Espina wrote: >>> > > > > >>> > > > >> I'm not, channel does it. >>> > > > >> >>> > > > >> Problem is present on both. For example, home page has a >>> > > content-length >>> > > > >> header but jquery.js use chunked. >>> > > > >> >>> > > > > >>> > > > > 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). >>> > > > > >>> > > > > >>> > > > >> Do I have to call .endExchange? or closing the output stream is >>> > > enough? >>> > > > >> >>> > > > > >>> > > > > 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. >>> > > > > >>> > > > > The 'connection reset by peer' 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. >>> > > > > >>> > > > > 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. >>> > > > > >>> > > > > Stuart >>> > > > > >>> > > > > >>> > > > >> Thanks >>> > > > >> >>> > > > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas < >>> sdouglas at redhat.com >>> > > > >> > wrote: >>> > > > >> >>> > > > >> Another question, are you setting a content length on the >>> > > responses? >>> > > > >> If not the channel will automatically set one if the >>> response fits >>> > > > >> inside a buffer, otherwise chunked encoding will be used. >>> > > > >> >>> > > > >> It might be helpful to know if this only happens on >>> chunked, fixed >>> > > > >> length or both. >>> > > > >> >>> > > > >> Stuart >>> > > > >> >>> > > > >> Edgar Espina wrote: >>> > > > >> >>> > > > >> latest: 1.2.0.Beta8 >>> > > > >> >>> > > > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas >>> > > > >> >>> > > > >> >> >>> >>> > > wrote: >>> > > > >> >>> > > > >> Also what version of Undertow are you using? >>> > > > >> >>> > > > >> Stuart >>> > > > >> >>> > > > >> ----- Original Message ----- >>> > > > >> > From: "Edgar Espina" >> > > > >> >>> > > > >> >> espina.edgar at gmail.com >>> > > > >> >__>> >>> > > > >> > To: "Stuart Douglas" >> > > > >> >>> > > > >> >> >>> >>> > > > >> > Cc: undertow-dev at lists.jboss.org >>> > > > >> >>> > > > >> >> > > > >> > >>> > > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM >>> > > > >> > Subject: Re: [undertow-dev] occasional 502 from >>> Apache HTTP >>> > > > >> Proxy >>> > > > >> > >>> > > > >> > found this in apache: >>> > > > >> > >>> > > > >> > (104) Connection reset by peer: proxy: error reading >>> status >>> > > > >> line from >>> > > > >> > remote server >>> > > > >> > >>> > > > >> > but nothing in undertow. >>> > > > >> > >>> > > > >> > got 502 on HTTP GET. Sometimes while calling the >>> home page >>> > > / or >>> > > > >> when page >>> > > > >> > loads OK, got 502 on page resources (js, css, >>> images). >>> > > > >> > >>> > > > >> > I call startBlocking and use the outputstream to >>> write the >>> > > > >> response, when >>> > > > >> > everything has been written I call the >>> "outputstream.close" >>> > > > >> method. Do I >>> > > > >> > need to call exchange.endExchange too? >>> > > > >> > >>> > > > >> > Thanks >>> > > > >> > >>> > > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas >>> > > > >> >>> > > > >> >> >>> >>> > > wrote: >>> > > > >> > >>> > > > >> > > Is there any info in the log? Or is there any >>> specific >>> > > type >>> > > > >> of >>> > > > >> request >>> > > > >> > > that causes this? >>> > > > >> > > >>> > > > >> > > Stuart >>> > > > >> > > >>> > > > >> > > >>> > > > >> > > ----- Original Message ----- >>> > > > >> > > > From: "Edgar Espina" >> > > > >> >>> > > > >> >> espina.edgar at gmail.com >>> > > > >> >__>> >>> > > > >> > > > To: undertow-dev at lists.jboss.org >>> > > > >> >>> > > > >> >> > > > >> > >>> > > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM >>> > > > >> > > > Subject: [undertow-dev] occasional 502 from >>> Apache HTTP >>> > > > >> Proxy >>> > > > >> > > > >>> > > > >> > > > Hi, >>> > > > >> > > > >>> > > > >> > > > I've an Undertow application behind apache >>> reverse >>> > > proxy, >>> > > > >> trying to load >>> > > > >> > > a >>> > > > >> > > > page displays error 502 proxy error. >>> > > > >> > > > >>> > > > >> > > > Still couldn't find why so I wonder if any of >>> you find >>> > > a >>> > > > >> similar problem >>> > > > >> > > with >>> > > > >> > > > Undertow and Apache. >>> > > > >> > > > >>> > > > >> > > > Please note this is our first app on top of >>> Undertow, >>> > > > >> existing apps >>> > > > >> > > running >>> > > > >> > > > on Tomcat/Jetty are OK. >>> > > > >> > > > >>> > > > >> > > > Appreciate any help. >>> > > > >> > > > >>> > > > >> > > > Thanks >>> > > > >> > > > >>> > > > >> > > > -- >>> > > > >> > > > edgar >>> > > > >> > > > >>> > > > >> > > > _________________________________________________ >>> > > > >> > > > undertow-dev mailing list >>> > > > >> > > > undertow-dev at lists.jboss.org >>> > > > >> >>> > > > >> >> > > > >> > >>> > > > >> > > > >>> > > https://lists.jboss.org/__mailman/listinfo/undertow-dev >>> > > > >> >>> > > > >> > > >>> > > > >> > >>> > > > >> > >>> > > > >> > >>> > > > >> > -- >>> > > > >> > edgar >>> > > > >> > >>> > > > >> >>> > > > >> >>> > > > >> >>> > > > >> >>> > > > >> -- >>> > > > >> edgar >>> > > > >> >>> > > > >> >>> > > > >> >>> > > > >> >>> > > > >> -- >>> > > > >> edgar >>> > > > >> >>> > > > > >>> > > > >>> > > > >>> > > > -- >>> > > > edgar >>> > > > >>> > > >>> > >>> > >>> > >>> > -- >>> > edgar >>> > >>> >> >> >> >> -- >> edgar >> >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev >> > > -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150119/eef7a250/attachment-0001.html From tomaz.cerar at gmail.com Mon Jan 19 07:57:41 2015 From: tomaz.cerar at gmail.com (=?UTF-8?B?VG9tYcW+IENlcmFy?=) Date: Mon, 19 Jan 2015 13:57:41 +0100 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <54BC545A.9020701@redhat.com> <54BC56E3.80602@redhat.com> <560157572.9618468.1421633621833.JavaMail.zimbra@redhat.com> <1010163216.9639599.1421644332425.JavaMail.zimbra@redhat.com> Message-ID: Maybe related to http://stackoverflow.com/questions/169453/bad-gateway-502-error-with-apache-mod-proxy-and-tomcat or http://qnalist.com/questions/4502641/users-httpd-mod-proxy-ignores-incompleteness-of-chunked-coding-response-from-backend On Mon, Jan 19, 2015 at 1:33 PM, Edgar Espina wrote: > Sure, it is 2.2.15. > > > > On Mon, Jan 19, 2015 at 9:29 AM, Toma? Cerar > wrote: > >> Edgar, >> >> what is the version of Apache and mod_proxy module you are using. >> maybe it will be easier to reproduce with exact version you have.. >> >> -- >> tomaz >> >> On Mon, Jan 19, 2015 at 1:15 PM, Edgar Espina >> wrote: >> >>> The source code can be found here: >>> https://github.com/jooby-project/jooby >>> >>> Undertow related classes are here: >>> https://github.com/jooby-project/jooby/tree/master/jooby/src/main/java/org/jooby/internal/undertow >>> . >>> Server is built here: >>> https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowServer.java >>> Response is sent here: >>> https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowResponse.java#L336-382 >>> >>> My microweb-framework was built on top of Jetty, so for now I used the >>> blocking API and follow more or less what we usually do with Servlets >>> (acquire an outstream). >>> >>> I will review what I'm doing and try to figure it out what is going on >>> too. >>> >>> Thanks for your help, Stuart. >>> >>> >>> >>> >>> On Mon, Jan 19, 2015 at 2:12 AM, Stuart Douglas >>> wrote: >>> >>>> My best guess as to what is happening is that Undertow closing a >>>> connection after a request is done for some reason, and the apache attempts >>>> to re-use this connection without realising that it is dead. >>>> >>>> In general this should not happen, Undertow should only forcibly close >>>> a connection if it knows that it is broken (e.g. a content length is set >>>> and the full amount of content is not written). For a normal graceful close >>>> Undertow should be sending Connection:close headers. >>>> >>>> I am going to investigate some more, and see if I can figure out what >>>> is going on. It seems unlikely but is there any chance your code forcibly >>>> closes the ServerConnection (HttpServerExchange.getConnection()) because >>>> that could potentially cause this issue. Setting the exchange to >>>> non-persistent after headers have been sent could also cause it. >>>> >>>> Stuart >>>> >>>> ----- Original Message ----- >>>> > From: "Edgar Espina" >>>> > To: "Stuart Douglas" >>>> > Cc: undertow-dev at lists.jboss.org >>>> > Sent: Monday, 19 January, 2015 2:53:06 PM >>>> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy >>>> > >>>> > Done, but makes no difference. Still got the 502 random errors :S >>>> > >>>> > On Sun, Jan 18, 2015 at 11:13 PM, Stuart Douglas >>> > >>>> > wrote: >>>> > >>>> > > 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. >>>> > > >>>> > > Can you try adding: >>>> > > >>>> > > undertow.setSocketOption(Options.BACKLOG, 1000) >>>> > > >>>> > > To your Undertow builder? I am going to increase this in our default >>>> > > config upstream. >>>> > > >>>> > > Hopefully this is the issue that you are running into. >>>> > > >>>> > > Stuart >>>> > > >>>> > > >>>> > > ----- Original Message ----- >>>> > > > From: "Edgar Espina" >>>> > > > To: "Stuart Douglas" >>>> > > > Cc: undertow-dev at lists.jboss.org >>>> > > > Sent: Monday, 19 January, 2015 12:10:16 PM >>>> > > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy >>>> > > > >>>> > > > It is a default undertow instance with a HTTP listener, just set >>>> work >>>> > > > threads to 200. Is there a default idle timeout? I can' tell from >>>> javadoc >>>> > > > and looking at the code. >>>> > > > >>>> > > > >>>> > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas < >>>> sdouglas at redhat.com> >>>> > > wrote: >>>> > > > >>>> > > > > >>>> > > > > >>>> > > > > Edgar Espina wrote: >>>> > > > > >>>> > > > >> I'm not, channel does it. >>>> > > > >> >>>> > > > >> Problem is present on both. For example, home page has a >>>> > > content-length >>>> > > > >> header but jquery.js use chunked. >>>> > > > >> >>>> > > > > >>>> > > > > 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). >>>> > > > > >>>> > > > > >>>> > > > >> Do I have to call .endExchange? or closing the output stream is >>>> > > enough? >>>> > > > >> >>>> > > > > >>>> > > > > 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. >>>> > > > > >>>> > > > > The 'connection reset by peer' 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. >>>> > > > > >>>> > > > > 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. >>>> > > > > >>>> > > > > Stuart >>>> > > > > >>>> > > > > >>>> > > > >> Thanks >>>> > > > >> >>>> > > > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas < >>>> sdouglas at redhat.com >>>> > > > >> > wrote: >>>> > > > >> >>>> > > > >> Another question, are you setting a content length on the >>>> > > responses? >>>> > > > >> If not the channel will automatically set one if the >>>> response fits >>>> > > > >> inside a buffer, otherwise chunked encoding will be used. >>>> > > > >> >>>> > > > >> It might be helpful to know if this only happens on >>>> chunked, fixed >>>> > > > >> length or both. >>>> > > > >> >>>> > > > >> Stuart >>>> > > > >> >>>> > > > >> Edgar Espina wrote: >>>> > > > >> >>>> > > > >> latest: 1.2.0.Beta8 >>>> > > > >> >>>> > > > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas >>>> > > > >> >>>> > > > >> >>> sdouglas at redhat.com>>> >>>> > > wrote: >>>> > > > >> >>>> > > > >> Also what version of Undertow are you using? >>>> > > > >> >>>> > > > >> Stuart >>>> > > > >> >>>> > > > >> ----- Original Message ----- >>>> > > > >> > From: "Edgar Espina" >>> > > > >> >>>> > > > >> >>> espina.edgar at gmail.com >>>> > > > >> >__>> >>>> > > > >> > To: "Stuart Douglas" >>> > > > >> >>>> > > > >> >>> sdouglas at redhat.com>>> >>>> > > > >> > Cc: undertow-dev at lists.jboss.org >>>> > > > >> >>>> > > > >> >>> > > > >> > >>>> > > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM >>>> > > > >> > Subject: Re: [undertow-dev] occasional 502 from >>>> Apache HTTP >>>> > > > >> Proxy >>>> > > > >> > >>>> > > > >> > found this in apache: >>>> > > > >> > >>>> > > > >> > (104) Connection reset by peer: proxy: error >>>> reading status >>>> > > > >> line from >>>> > > > >> > remote server >>>> > > > >> > >>>> > > > >> > but nothing in undertow. >>>> > > > >> > >>>> > > > >> > got 502 on HTTP GET. Sometimes while calling the >>>> home page >>>> > > / or >>>> > > > >> when page >>>> > > > >> > loads OK, got 502 on page resources (js, css, >>>> images). >>>> > > > >> > >>>> > > > >> > I call startBlocking and use the outputstream to >>>> write the >>>> > > > >> response, when >>>> > > > >> > everything has been written I call the >>>> "outputstream.close" >>>> > > > >> method. Do I >>>> > > > >> > need to call exchange.endExchange too? >>>> > > > >> > >>>> > > > >> > Thanks >>>> > > > >> > >>>> > > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas >>>> > > > >> >>>> > > > >> >>> sdouglas at redhat.com>>> >>>> > > wrote: >>>> > > > >> > >>>> > > > >> > > Is there any info in the log? Or is there any >>>> specific >>>> > > type >>>> > > > >> of >>>> > > > >> request >>>> > > > >> > > that causes this? >>>> > > > >> > > >>>> > > > >> > > Stuart >>>> > > > >> > > >>>> > > > >> > > >>>> > > > >> > > ----- Original Message ----- >>>> > > > >> > > > From: "Edgar Espina" >>> > > > >> >>>> > > > >> >>> espina.edgar at gmail.com >>>> > > > >> >__>> >>>> > > > >> > > > To: undertow-dev at lists.jboss.org >>>> > > > >> >>>> > > > >> >>> > > > >> > >>>> > > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM >>>> > > > >> > > > Subject: [undertow-dev] occasional 502 from >>>> Apache HTTP >>>> > > > >> Proxy >>>> > > > >> > > > >>>> > > > >> > > > Hi, >>>> > > > >> > > > >>>> > > > >> > > > I've an Undertow application behind apache >>>> reverse >>>> > > proxy, >>>> > > > >> trying to load >>>> > > > >> > > a >>>> > > > >> > > > page displays error 502 proxy error. >>>> > > > >> > > > >>>> > > > >> > > > Still couldn't find why so I wonder if any of >>>> you find >>>> > > a >>>> > > > >> similar problem >>>> > > > >> > > with >>>> > > > >> > > > Undertow and Apache. >>>> > > > >> > > > >>>> > > > >> > > > Please note this is our first app on top of >>>> Undertow, >>>> > > > >> existing apps >>>> > > > >> > > running >>>> > > > >> > > > on Tomcat/Jetty are OK. >>>> > > > >> > > > >>>> > > > >> > > > Appreciate any help. >>>> > > > >> > > > >>>> > > > >> > > > Thanks >>>> > > > >> > > > >>>> > > > >> > > > -- >>>> > > > >> > > > edgar >>>> > > > >> > > > >>>> > > > >> > > > >>>> _________________________________________________ >>>> > > > >> > > > undertow-dev mailing list >>>> > > > >> > > > undertow-dev at lists.jboss.org >>>> > > > >> >>>> > > > >> >>> > > > >> > >>>> > > > >> > > > >>>> > > https://lists.jboss.org/__mailman/listinfo/undertow-dev >>>> > > > >> >>> > >>>> > > > >> > > >>>> > > > >> > >>>> > > > >> > >>>> > > > >> > >>>> > > > >> > -- >>>> > > > >> > edgar >>>> > > > >> > >>>> > > > >> >>>> > > > >> >>>> > > > >> >>>> > > > >> >>>> > > > >> -- >>>> > > > >> edgar >>>> > > > >> >>>> > > > >> >>>> > > > >> >>>> > > > >> >>>> > > > >> -- >>>> > > > >> edgar >>>> > > > >> >>>> > > > > >>>> > > > >>>> > > > >>>> > > > -- >>>> > > > edgar >>>> > > > >>>> > > >>>> > >>>> > >>>> > >>>> > -- >>>> > edgar >>>> > >>>> >>> >>> >>> >>> -- >>> edgar >>> >>> _______________________________________________ >>> undertow-dev mailing list >>> undertow-dev at lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>> >> >> > > > -- > edgar > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150119/b7e91d3c/attachment-0001.html From espina.edgar at gmail.com Tue Jan 20 10:03:10 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Tue, 20 Jan 2015 12:03:10 -0300 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <54BC545A.9020701@redhat.com> <54BC56E3.80602@redhat.com> <560157572.9618468.1421633621833.JavaMail.zimbra@redhat.com> <1010163216.9639599.1421644332425.JavaMail.zimbra@redhat.com> Message-ID: seems to be some sort of timeout, because everything work as expected, but then after waiting for a while and got again the 502. also, I did set the content-length for static resources and call .endExchange after a 304 response, set a backlog of 1000 and 10000 too. But it didn't help. On Mon, Jan 19, 2015 at 9:57 AM, Toma? Cerar wrote: > Maybe related to > http://stackoverflow.com/questions/169453/bad-gateway-502-error-with-apache-mod-proxy-and-tomcat > > or > http://qnalist.com/questions/4502641/users-httpd-mod-proxy-ignores-incompleteness-of-chunked-coding-response-from-backend > > On Mon, Jan 19, 2015 at 1:33 PM, Edgar Espina > wrote: > >> Sure, it is 2.2.15. >> >> >> >> On Mon, Jan 19, 2015 at 9:29 AM, Toma? Cerar >> wrote: >> >>> Edgar, >>> >>> what is the version of Apache and mod_proxy module you are using. >>> maybe it will be easier to reproduce with exact version you have.. >>> >>> -- >>> tomaz >>> >>> On Mon, Jan 19, 2015 at 1:15 PM, Edgar Espina >>> wrote: >>> >>>> The source code can be found here: >>>> https://github.com/jooby-project/jooby >>>> >>>> Undertow related classes are here: >>>> https://github.com/jooby-project/jooby/tree/master/jooby/src/main/java/org/jooby/internal/undertow >>>> . >>>> Server is built here: >>>> https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowServer.java >>>> Response is sent here: >>>> https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowResponse.java#L336-382 >>>> >>>> My microweb-framework was built on top of Jetty, so for now I used the >>>> blocking API and follow more or less what we usually do with Servlets >>>> (acquire an outstream). >>>> >>>> I will review what I'm doing and try to figure it out what is going on >>>> too. >>>> >>>> Thanks for your help, Stuart. >>>> >>>> >>>> >>>> >>>> On Mon, Jan 19, 2015 at 2:12 AM, Stuart Douglas >>>> wrote: >>>> >>>>> My best guess as to what is happening is that Undertow closing a >>>>> connection after a request is done for some reason, and the apache attempts >>>>> to re-use this connection without realising that it is dead. >>>>> >>>>> In general this should not happen, Undertow should only forcibly close >>>>> a connection if it knows that it is broken (e.g. a content length is set >>>>> and the full amount of content is not written). For a normal graceful close >>>>> Undertow should be sending Connection:close headers. >>>>> >>>>> I am going to investigate some more, and see if I can figure out what >>>>> is going on. It seems unlikely but is there any chance your code forcibly >>>>> closes the ServerConnection (HttpServerExchange.getConnection()) because >>>>> that could potentially cause this issue. Setting the exchange to >>>>> non-persistent after headers have been sent could also cause it. >>>>> >>>>> Stuart >>>>> >>>>> ----- Original Message ----- >>>>> > From: "Edgar Espina" >>>>> > To: "Stuart Douglas" >>>>> > Cc: undertow-dev at lists.jboss.org >>>>> > Sent: Monday, 19 January, 2015 2:53:06 PM >>>>> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy >>>>> > >>>>> > Done, but makes no difference. Still got the 502 random errors :S >>>>> > >>>>> > On Sun, Jan 18, 2015 at 11:13 PM, Stuart Douglas < >>>>> sdouglas at redhat.com> >>>>> > wrote: >>>>> > >>>>> > > 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. >>>>> > > >>>>> > > Can you try adding: >>>>> > > >>>>> > > undertow.setSocketOption(Options.BACKLOG, 1000) >>>>> > > >>>>> > > To your Undertow builder? I am going to increase this in our >>>>> default >>>>> > > config upstream. >>>>> > > >>>>> > > Hopefully this is the issue that you are running into. >>>>> > > >>>>> > > Stuart >>>>> > > >>>>> > > >>>>> > > ----- Original Message ----- >>>>> > > > From: "Edgar Espina" >>>>> > > > To: "Stuart Douglas" >>>>> > > > Cc: undertow-dev at lists.jboss.org >>>>> > > > Sent: Monday, 19 January, 2015 12:10:16 PM >>>>> > > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy >>>>> > > > >>>>> > > > It is a default undertow instance with a HTTP listener, just set >>>>> work >>>>> > > > threads to 200. Is there a default idle timeout? I can' tell >>>>> from javadoc >>>>> > > > and looking at the code. >>>>> > > > >>>>> > > > >>>>> > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas < >>>>> sdouglas at redhat.com> >>>>> > > wrote: >>>>> > > > >>>>> > > > > >>>>> > > > > >>>>> > > > > Edgar Espina wrote: >>>>> > > > > >>>>> > > > >> I'm not, channel does it. >>>>> > > > >> >>>>> > > > >> Problem is present on both. For example, home page has a >>>>> > > content-length >>>>> > > > >> header but jquery.js use chunked. >>>>> > > > >> >>>>> > > > > >>>>> > > > > 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). >>>>> > > > > >>>>> > > > > >>>>> > > > >> Do I have to call .endExchange? or closing the output stream >>>>> is >>>>> > > enough? >>>>> > > > >> >>>>> > > > > >>>>> > > > > 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. >>>>> > > > > >>>>> > > > > The 'connection reset by peer' 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. >>>>> > > > > >>>>> > > > > 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. >>>>> > > > > >>>>> > > > > Stuart >>>>> > > > > >>>>> > > > > >>>>> > > > >> Thanks >>>>> > > > >> >>>>> > > > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas < >>>>> sdouglas at redhat.com >>>>> > > > >> > wrote: >>>>> > > > >> >>>>> > > > >> Another question, are you setting a content length on the >>>>> > > responses? >>>>> > > > >> If not the channel will automatically set one if the >>>>> response fits >>>>> > > > >> inside a buffer, otherwise chunked encoding will be used. >>>>> > > > >> >>>>> > > > >> It might be helpful to know if this only happens on >>>>> chunked, fixed >>>>> > > > >> length or both. >>>>> > > > >> >>>>> > > > >> Stuart >>>>> > > > >> >>>>> > > > >> Edgar Espina wrote: >>>>> > > > >> >>>>> > > > >> latest: 1.2.0.Beta8 >>>>> > > > >> >>>>> > > > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas >>>>> > > > >> >>>>> > > > >> >>>> sdouglas at redhat.com>>> >>>>> > > wrote: >>>>> > > > >> >>>>> > > > >> Also what version of Undertow are you using? >>>>> > > > >> >>>>> > > > >> Stuart >>>>> > > > >> >>>>> > > > >> ----- Original Message ----- >>>>> > > > >> > From: "Edgar Espina" >>>> > > > >> >>>>> > > > >> >>>> espina.edgar at gmail.com >>>>> > > > >> >__>> >>>>> > > > >> > To: "Stuart Douglas" >>>> > > > >> >>>>> > > > >> >>>> sdouglas at redhat.com>>> >>>>> > > > >> > Cc: undertow-dev at lists.jboss.org >>>>> > > > >> >>>>> > > > >> >>>> > > > >> > >>>>> > > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM >>>>> > > > >> > Subject: Re: [undertow-dev] occasional 502 from >>>>> Apache HTTP >>>>> > > > >> Proxy >>>>> > > > >> > >>>>> > > > >> > found this in apache: >>>>> > > > >> > >>>>> > > > >> > (104) Connection reset by peer: proxy: error >>>>> reading status >>>>> > > > >> line from >>>>> > > > >> > remote server >>>>> > > > >> > >>>>> > > > >> > but nothing in undertow. >>>>> > > > >> > >>>>> > > > >> > got 502 on HTTP GET. Sometimes while calling the >>>>> home page >>>>> > > / or >>>>> > > > >> when page >>>>> > > > >> > loads OK, got 502 on page resources (js, css, >>>>> images). >>>>> > > > >> > >>>>> > > > >> > I call startBlocking and use the outputstream to >>>>> write the >>>>> > > > >> response, when >>>>> > > > >> > everything has been written I call the >>>>> "outputstream.close" >>>>> > > > >> method. Do I >>>>> > > > >> > need to call exchange.endExchange too? >>>>> > > > >> > >>>>> > > > >> > Thanks >>>>> > > > >> > >>>>> > > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas >>>>> > > > >> >>>>> > > > >> >>>> sdouglas at redhat.com>>> >>>>> > > wrote: >>>>> > > > >> > >>>>> > > > >> > > Is there any info in the log? Or is there any >>>>> specific >>>>> > > type >>>>> > > > >> of >>>>> > > > >> request >>>>> > > > >> > > that causes this? >>>>> > > > >> > > >>>>> > > > >> > > Stuart >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> > > ----- Original Message ----- >>>>> > > > >> > > > From: "Edgar Espina" >>>> > > > >> >>>>> > > > >> >>>> espina.edgar at gmail.com >>>>> > > > >> >__>> >>>>> > > > >> > > > To: undertow-dev at lists.jboss.org >>>>> > > > >> >>>>> > > > >> >>>> > > > >> > >>>>> > > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM >>>>> > > > >> > > > Subject: [undertow-dev] occasional 502 from >>>>> Apache HTTP >>>>> > > > >> Proxy >>>>> > > > >> > > > >>>>> > > > >> > > > Hi, >>>>> > > > >> > > > >>>>> > > > >> > > > I've an Undertow application behind apache >>>>> reverse >>>>> > > proxy, >>>>> > > > >> trying to load >>>>> > > > >> > > a >>>>> > > > >> > > > page displays error 502 proxy error. >>>>> > > > >> > > > >>>>> > > > >> > > > Still couldn't find why so I wonder if any of >>>>> you find >>>>> > > a >>>>> > > > >> similar problem >>>>> > > > >> > > with >>>>> > > > >> > > > Undertow and Apache. >>>>> > > > >> > > > >>>>> > > > >> > > > Please note this is our first app on top of >>>>> Undertow, >>>>> > > > >> existing apps >>>>> > > > >> > > running >>>>> > > > >> > > > on Tomcat/Jetty are OK. >>>>> > > > >> > > > >>>>> > > > >> > > > Appreciate any help. >>>>> > > > >> > > > >>>>> > > > >> > > > Thanks >>>>> > > > >> > > > >>>>> > > > >> > > > -- >>>>> > > > >> > > > edgar >>>>> > > > >> > > > >>>>> > > > >> > > > >>>>> _________________________________________________ >>>>> > > > >> > > > undertow-dev mailing list >>>>> > > > >> > > > undertow-dev at lists.jboss.org >>>>> > > > >> >>>>> > > > >> >>>> > > > >> > >>>>> > > > >> > > > >>>>> > > https://lists.jboss.org/__mailman/listinfo/undertow-dev >>>>> > > > >> < >>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev> >>>>> > > > >> > > >>>>> > > > >> > >>>>> > > > >> > >>>>> > > > >> > >>>>> > > > >> > -- >>>>> > > > >> > edgar >>>>> > > > >> > >>>>> > > > >> >>>>> > > > >> >>>>> > > > >> >>>>> > > > >> >>>>> > > > >> -- >>>>> > > > >> edgar >>>>> > > > >> >>>>> > > > >> >>>>> > > > >> >>>>> > > > >> >>>>> > > > >> -- >>>>> > > > >> edgar >>>>> > > > >> >>>>> > > > > >>>>> > > > >>>>> > > > >>>>> > > > -- >>>>> > > > edgar >>>>> > > > >>>>> > > >>>>> > >>>>> > >>>>> > >>>>> > -- >>>>> > edgar >>>>> > >>>>> >>>> >>>> >>>> >>>> -- >>>> edgar >>>> >>>> _______________________________________________ >>>> undertow-dev mailing list >>>> undertow-dev at lists.jboss.org >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>>> >>> >>> >> >> >> -- >> edgar >> > > -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150120/44174afd/attachment-0001.html From sdouglas at redhat.com Tue Jan 20 15:07:35 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Tue, 20 Jan 2015 15:07:35 -0500 (EST) Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <1010163216.9639599.1421644332425.JavaMail.zimbra@redhat.com> Message-ID: <847958625.10923832.1421784455109.JavaMail.zimbra@redhat.com> ----- Original Message ----- > From: "Edgar Espina" > To: "Toma? Cerar" > Cc: "Stuart Douglas" , undertow-dev at lists.jboss.org > Sent: Wednesday, 21 January, 2015 2:03:10 AM > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > seems to be some sort of timeout, because everything work as expected, but > then after waiting for a while and got again the 502. That is odd, as there is no timeout configured. What does your network config between the LB and Undertow look like? Does enabling TCP keep alive (Options.KEEP_ALIVE) help? Stuart > > also, I did set the content-length for static resources and call > .endExchange after a 304 response, set a backlog of 1000 and 10000 too. But > it didn't help. > > > > On Mon, Jan 19, 2015 at 9:57 AM, Toma? Cerar wrote: > > > Maybe related to > > http://stackoverflow.com/questions/169453/bad-gateway-502-error-with-apache-mod-proxy-and-tomcat > > > > or > > http://qnalist.com/questions/4502641/users-httpd-mod-proxy-ignores-incompleteness-of-chunked-coding-response-from-backend > > > > On Mon, Jan 19, 2015 at 1:33 PM, Edgar Espina > > wrote: > > > >> Sure, it is 2.2.15. > >> > >> > >> > >> On Mon, Jan 19, 2015 at 9:29 AM, Toma? Cerar > >> wrote: > >> > >>> Edgar, > >>> > >>> what is the version of Apache and mod_proxy module you are using. > >>> maybe it will be easier to reproduce with exact version you have.. > >>> > >>> -- > >>> tomaz > >>> > >>> On Mon, Jan 19, 2015 at 1:15 PM, Edgar Espina > >>> wrote: > >>> > >>>> The source code can be found here: > >>>> https://github.com/jooby-project/jooby > >>>> > >>>> Undertow related classes are here: > >>>> https://github.com/jooby-project/jooby/tree/master/jooby/src/main/java/org/jooby/internal/undertow > >>>> . > >>>> Server is built here: > >>>> https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowServer.java > >>>> Response is sent here: > >>>> https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowResponse.java#L336-382 > >>>> > >>>> My microweb-framework was built on top of Jetty, so for now I used the > >>>> blocking API and follow more or less what we usually do with Servlets > >>>> (acquire an outstream). > >>>> > >>>> I will review what I'm doing and try to figure it out what is going on > >>>> too. > >>>> > >>>> Thanks for your help, Stuart. > >>>> > >>>> > >>>> > >>>> > >>>> On Mon, Jan 19, 2015 at 2:12 AM, Stuart Douglas > >>>> wrote: > >>>> > >>>>> My best guess as to what is happening is that Undertow closing a > >>>>> connection after a request is done for some reason, and the apache > >>>>> attempts > >>>>> to re-use this connection without realising that it is dead. > >>>>> > >>>>> In general this should not happen, Undertow should only forcibly close > >>>>> a connection if it knows that it is broken (e.g. a content length is > >>>>> set > >>>>> and the full amount of content is not written). For a normal graceful > >>>>> close > >>>>> Undertow should be sending Connection:close headers. > >>>>> > >>>>> I am going to investigate some more, and see if I can figure out what > >>>>> is going on. It seems unlikely but is there any chance your code > >>>>> forcibly > >>>>> closes the ServerConnection (HttpServerExchange.getConnection()) > >>>>> because > >>>>> that could potentially cause this issue. Setting the exchange to > >>>>> non-persistent after headers have been sent could also cause it. > >>>>> > >>>>> Stuart > >>>>> > >>>>> ----- Original Message ----- > >>>>> > From: "Edgar Espina" > >>>>> > To: "Stuart Douglas" > >>>>> > Cc: undertow-dev at lists.jboss.org > >>>>> > Sent: Monday, 19 January, 2015 2:53:06 PM > >>>>> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > >>>>> > > >>>>> > Done, but makes no difference. Still got the 502 random errors :S > >>>>> > > >>>>> > On Sun, Jan 18, 2015 at 11:13 PM, Stuart Douglas < > >>>>> sdouglas at redhat.com> > >>>>> > wrote: > >>>>> > > >>>>> > > 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. > >>>>> > > > >>>>> > > Can you try adding: > >>>>> > > > >>>>> > > undertow.setSocketOption(Options.BACKLOG, 1000) > >>>>> > > > >>>>> > > To your Undertow builder? I am going to increase this in our > >>>>> default > >>>>> > > config upstream. > >>>>> > > > >>>>> > > Hopefully this is the issue that you are running into. > >>>>> > > > >>>>> > > Stuart > >>>>> > > > >>>>> > > > >>>>> > > ----- Original Message ----- > >>>>> > > > From: "Edgar Espina" > >>>>> > > > To: "Stuart Douglas" > >>>>> > > > Cc: undertow-dev at lists.jboss.org > >>>>> > > > Sent: Monday, 19 January, 2015 12:10:16 PM > >>>>> > > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > >>>>> > > > > >>>>> > > > It is a default undertow instance with a HTTP listener, just set > >>>>> work > >>>>> > > > threads to 200. Is there a default idle timeout? I can' tell > >>>>> from javadoc > >>>>> > > > and looking at the code. > >>>>> > > > > >>>>> > > > > >>>>> > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas < > >>>>> sdouglas at redhat.com> > >>>>> > > wrote: > >>>>> > > > > >>>>> > > > > > >>>>> > > > > > >>>>> > > > > Edgar Espina wrote: > >>>>> > > > > > >>>>> > > > >> I'm not, channel does it. > >>>>> > > > >> > >>>>> > > > >> Problem is present on both. For example, home page has a > >>>>> > > content-length > >>>>> > > > >> header but jquery.js use chunked. > >>>>> > > > >> > >>>>> > > > > > >>>>> > > > > 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). > >>>>> > > > > > >>>>> > > > > > >>>>> > > > >> Do I have to call .endExchange? or closing the output stream > >>>>> is > >>>>> > > enough? > >>>>> > > > >> > >>>>> > > > > > >>>>> > > > > 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. > >>>>> > > > > > >>>>> > > > > The 'connection reset by peer' 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. > >>>>> > > > > > >>>>> > > > > 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. > >>>>> > > > > > >>>>> > > > > Stuart > >>>>> > > > > > >>>>> > > > > > >>>>> > > > >> Thanks > >>>>> > > > >> > >>>>> > > > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas < > >>>>> sdouglas at redhat.com > >>>>> > > > >> > wrote: > >>>>> > > > >> > >>>>> > > > >> Another question, are you setting a content length on the > >>>>> > > responses? > >>>>> > > > >> If not the channel will automatically set one if the > >>>>> response fits > >>>>> > > > >> inside a buffer, otherwise chunked encoding will be used. > >>>>> > > > >> > >>>>> > > > >> It might be helpful to know if this only happens on > >>>>> chunked, fixed > >>>>> > > > >> length or both. > >>>>> > > > >> > >>>>> > > > >> Stuart > >>>>> > > > >> > >>>>> > > > >> Edgar Espina wrote: > >>>>> > > > >> > >>>>> > > > >> latest: 1.2.0.Beta8 > >>>>> > > > >> > >>>>> > > > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > >>>>> > > > >> > >>>>> > > > >> >>>>> sdouglas at redhat.com>>> > >>>>> > > wrote: > >>>>> > > > >> > >>>>> > > > >> Also what version of Undertow are you using? > >>>>> > > > >> > >>>>> > > > >> Stuart > >>>>> > > > >> > >>>>> > > > >> ----- Original Message ----- > >>>>> > > > >> > From: "Edgar Espina" >>>>> > > > >> > >>>>> > > > >> >>>>> espina.edgar at gmail.com > >>>>> > > > >> >__>> > >>>>> > > > >> > To: "Stuart Douglas" >>>>> > > > >> > >>>>> > > > >> >>>>> sdouglas at redhat.com>>> > >>>>> > > > >> > Cc: undertow-dev at lists.jboss.org > >>>>> > > > >> > >>>>> > > > >> >>>>> > > > >> > > >>>>> > > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM > >>>>> > > > >> > Subject: Re: [undertow-dev] occasional 502 from > >>>>> Apache HTTP > >>>>> > > > >> Proxy > >>>>> > > > >> > > >>>>> > > > >> > found this in apache: > >>>>> > > > >> > > >>>>> > > > >> > (104) Connection reset by peer: proxy: error > >>>>> reading status > >>>>> > > > >> line from > >>>>> > > > >> > remote server > >>>>> > > > >> > > >>>>> > > > >> > but nothing in undertow. > >>>>> > > > >> > > >>>>> > > > >> > got 502 on HTTP GET. Sometimes while calling the > >>>>> home page > >>>>> > > / or > >>>>> > > > >> when page > >>>>> > > > >> > loads OK, got 502 on page resources (js, css, > >>>>> images). > >>>>> > > > >> > > >>>>> > > > >> > I call startBlocking and use the outputstream to > >>>>> write the > >>>>> > > > >> response, when > >>>>> > > > >> > everything has been written I call the > >>>>> "outputstream.close" > >>>>> > > > >> method. Do I > >>>>> > > > >> > need to call exchange.endExchange too? > >>>>> > > > >> > > >>>>> > > > >> > Thanks > >>>>> > > > >> > > >>>>> > > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas > >>>>> > > > >> > >>>>> > > > >> >>>>> sdouglas at redhat.com>>> > >>>>> > > wrote: > >>>>> > > > >> > > >>>>> > > > >> > > Is there any info in the log? Or is there any > >>>>> specific > >>>>> > > type > >>>>> > > > >> of > >>>>> > > > >> request > >>>>> > > > >> > > that causes this? > >>>>> > > > >> > > > >>>>> > > > >> > > Stuart > >>>>> > > > >> > > > >>>>> > > > >> > > > >>>>> > > > >> > > ----- Original Message ----- > >>>>> > > > >> > > > From: "Edgar Espina" >>>>> > > > >> > >>>>> > > > >> >>>>> espina.edgar at gmail.com > >>>>> > > > >> >__>> > >>>>> > > > >> > > > To: undertow-dev at lists.jboss.org > >>>>> > > > >> > >>>>> > > > >> >>>>> > > > >> > > >>>>> > > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM > >>>>> > > > >> > > > Subject: [undertow-dev] occasional 502 from > >>>>> Apache HTTP > >>>>> > > > >> Proxy > >>>>> > > > >> > > > > >>>>> > > > >> > > > Hi, > >>>>> > > > >> > > > > >>>>> > > > >> > > > I've an Undertow application behind apache > >>>>> reverse > >>>>> > > proxy, > >>>>> > > > >> trying to load > >>>>> > > > >> > > a > >>>>> > > > >> > > > page displays error 502 proxy error. > >>>>> > > > >> > > > > >>>>> > > > >> > > > Still couldn't find why so I wonder if any of > >>>>> you find > >>>>> > > a > >>>>> > > > >> similar problem > >>>>> > > > >> > > with > >>>>> > > > >> > > > Undertow and Apache. > >>>>> > > > >> > > > > >>>>> > > > >> > > > Please note this is our first app on top of > >>>>> Undertow, > >>>>> > > > >> existing apps > >>>>> > > > >> > > running > >>>>> > > > >> > > > on Tomcat/Jetty are OK. > >>>>> > > > >> > > > > >>>>> > > > >> > > > Appreciate any help. > >>>>> > > > >> > > > > >>>>> > > > >> > > > Thanks > >>>>> > > > >> > > > > >>>>> > > > >> > > > -- > >>>>> > > > >> > > > edgar > >>>>> > > > >> > > > > >>>>> > > > >> > > > > >>>>> _________________________________________________ > >>>>> > > > >> > > > undertow-dev mailing list > >>>>> > > > >> > > > undertow-dev at lists.jboss.org > >>>>> > > > >> > >>>>> > > > >> >>>>> > > > >> > > >>>>> > > > >> > > > > >>>>> > > https://lists.jboss.org/__mailman/listinfo/undertow-dev > >>>>> > > > >> < > >>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev> > >>>>> > > > >> > > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> > -- > >>>>> > > > >> > edgar > >>>>> > > > >> > > >>>>> > > > >> > >>>>> > > > >> > >>>>> > > > >> > >>>>> > > > >> > >>>>> > > > >> -- > >>>>> > > > >> edgar > >>>>> > > > >> > >>>>> > > > >> > >>>>> > > > >> > >>>>> > > > >> > >>>>> > > > >> -- > >>>>> > > > >> edgar > >>>>> > > > >> > >>>>> > > > > > >>>>> > > > > >>>>> > > > > >>>>> > > > -- > >>>>> > > > edgar > >>>>> > > > > >>>>> > > > >>>>> > > >>>>> > > >>>>> > > >>>>> > -- > >>>>> > edgar > >>>>> > > >>>>> > >>>> > >>>> > >>>> > >>>> -- > >>>> edgar > >>>> > >>>> _______________________________________________ > >>>> undertow-dev mailing list > >>>> undertow-dev at lists.jboss.org > >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev > >>>> > >>> > >>> > >> > >> > >> -- > >> edgar > >> > > > > > > > -- > edgar > From espina.edgar at gmail.com Wed Jan 21 14:40:50 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Wed, 21 Jan 2015 16:40:50 -0300 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: <847958625.10923832.1421784455109.JavaMail.zimbra@redhat.com> References: <1010163216.9639599.1421644332425.JavaMail.zimbra@redhat.com> <847958625.10923832.1421784455109.JavaMail.zimbra@redhat.com> Message-ID: Nope, it doesn't help. Stuart, you mentioned that: "For a normal graceful close Undertow should be sending Connection:close headers." Is it mean that on a req/res cycle, Undertow should always set the Connection response header with close or keep-alive? Thanks On Tue, Jan 20, 2015 at 5:07 PM, Stuart Douglas wrote: > > > ----- Original Message ----- > > From: "Edgar Espina" > > To: "Toma? Cerar" > > Cc: "Stuart Douglas" , undertow-dev at lists.jboss.org > > Sent: Wednesday, 21 January, 2015 2:03:10 AM > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > seems to be some sort of timeout, because everything work as expected, > but > > then after waiting for a while and got again the 502. > > That is odd, as there is no timeout configured. What does your network > config between the LB and Undertow look like? > > Does enabling TCP keep alive (Options.KEEP_ALIVE) help? > > Stuart > > > > > > also, I did set the content-length for static resources and call > > .endExchange after a 304 response, set a backlog of 1000 and 10000 too. > But > > it didn't help. > > > > > > > > On Mon, Jan 19, 2015 at 9:57 AM, Toma? Cerar > wrote: > > > > > Maybe related to > > > > http://stackoverflow.com/questions/169453/bad-gateway-502-error-with-apache-mod-proxy-and-tomcat > > > > > > or > > > > http://qnalist.com/questions/4502641/users-httpd-mod-proxy-ignores-incompleteness-of-chunked-coding-response-from-backend > > > > > > On Mon, Jan 19, 2015 at 1:33 PM, Edgar Espina > > > wrote: > > > > > >> Sure, it is 2.2.15. > > >> > > >> > > >> > > >> On Mon, Jan 19, 2015 at 9:29 AM, Toma? Cerar > > >> wrote: > > >> > > >>> Edgar, > > >>> > > >>> what is the version of Apache and mod_proxy module you are using. > > >>> maybe it will be easier to reproduce with exact version you have.. > > >>> > > >>> -- > > >>> tomaz > > >>> > > >>> On Mon, Jan 19, 2015 at 1:15 PM, Edgar Espina < > espina.edgar at gmail.com> > > >>> wrote: > > >>> > > >>>> The source code can be found here: > > >>>> https://github.com/jooby-project/jooby > > >>>> > > >>>> Undertow related classes are here: > > >>>> > https://github.com/jooby-project/jooby/tree/master/jooby/src/main/java/org/jooby/internal/undertow > > >>>> . > > >>>> Server is built here: > > >>>> > https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowServer.java > > >>>> Response is sent here: > > >>>> > https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowResponse.java#L336-382 > > >>>> > > >>>> My microweb-framework was built on top of Jetty, so for now I used > the > > >>>> blocking API and follow more or less what we usually do with > Servlets > > >>>> (acquire an outstream). > > >>>> > > >>>> I will review what I'm doing and try to figure it out what is going > on > > >>>> too. > > >>>> > > >>>> Thanks for your help, Stuart. > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> On Mon, Jan 19, 2015 at 2:12 AM, Stuart Douglas < > sdouglas at redhat.com> > > >>>> wrote: > > >>>> > > >>>>> My best guess as to what is happening is that Undertow closing a > > >>>>> connection after a request is done for some reason, and the apache > > >>>>> attempts > > >>>>> to re-use this connection without realising that it is dead. > > >>>>> > > >>>>> In general this should not happen, Undertow should only forcibly > close > > >>>>> a connection if it knows that it is broken (e.g. a content length > is > > >>>>> set > > >>>>> and the full amount of content is not written). For a normal > graceful > > >>>>> close > > >>>>> Undertow should be sending Connection:close headers. > > >>>>> > > >>>>> I am going to investigate some more, and see if I can figure out > what > > >>>>> is going on. It seems unlikely but is there any chance your code > > >>>>> forcibly > > >>>>> closes the ServerConnection (HttpServerExchange.getConnection()) > > >>>>> because > > >>>>> that could potentially cause this issue. Setting the exchange to > > >>>>> non-persistent after headers have been sent could also cause it. > > >>>>> > > >>>>> Stuart > > >>>>> > > >>>>> ----- Original Message ----- > > >>>>> > From: "Edgar Espina" > > >>>>> > To: "Stuart Douglas" > > >>>>> > Cc: undertow-dev at lists.jboss.org > > >>>>> > Sent: Monday, 19 January, 2015 2:53:06 PM > > >>>>> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > >>>>> > > > >>>>> > Done, but makes no difference. Still got the 502 random errors :S > > >>>>> > > > >>>>> > On Sun, Jan 18, 2015 at 11:13 PM, Stuart Douglas < > > >>>>> sdouglas at redhat.com> > > >>>>> > wrote: > > >>>>> > > > >>>>> > > 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. > > >>>>> > > > > >>>>> > > Can you try adding: > > >>>>> > > > > >>>>> > > undertow.setSocketOption(Options.BACKLOG, 1000) > > >>>>> > > > > >>>>> > > To your Undertow builder? I am going to increase this in our > > >>>>> default > > >>>>> > > config upstream. > > >>>>> > > > > >>>>> > > Hopefully this is the issue that you are running into. > > >>>>> > > > > >>>>> > > Stuart > > >>>>> > > > > >>>>> > > > > >>>>> > > ----- Original Message ----- > > >>>>> > > > From: "Edgar Espina" > > >>>>> > > > To: "Stuart Douglas" > > >>>>> > > > Cc: undertow-dev at lists.jboss.org > > >>>>> > > > Sent: Monday, 19 January, 2015 12:10:16 PM > > >>>>> > > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP > Proxy > > >>>>> > > > > > >>>>> > > > It is a default undertow instance with a HTTP listener, just > set > > >>>>> work > > >>>>> > > > threads to 200. Is there a default idle timeout? I can' tell > > >>>>> from javadoc > > >>>>> > > > and looking at the code. > > >>>>> > > > > > >>>>> > > > > > >>>>> > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas < > > >>>>> sdouglas at redhat.com> > > >>>>> > > wrote: > > >>>>> > > > > > >>>>> > > > > > > >>>>> > > > > > > >>>>> > > > > Edgar Espina wrote: > > >>>>> > > > > > > >>>>> > > > >> I'm not, channel does it. > > >>>>> > > > >> > > >>>>> > > > >> Problem is present on both. For example, home page has a > > >>>>> > > content-length > > >>>>> > > > >> header but jquery.js use chunked. > > >>>>> > > > >> > > >>>>> > > > > > > >>>>> > > > > 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). > > >>>>> > > > > > > >>>>> > > > > > > >>>>> > > > >> Do I have to call .endExchange? or closing the output > stream > > >>>>> is > > >>>>> > > enough? > > >>>>> > > > >> > > >>>>> > > > > > > >>>>> > > > > 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. > > >>>>> > > > > > > >>>>> > > > > The 'connection reset by peer' 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. > > >>>>> > > > > > > >>>>> > > > > 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. > > >>>>> > > > > > > >>>>> > > > > Stuart > > >>>>> > > > > > > >>>>> > > > > > > >>>>> > > > >> Thanks > > >>>>> > > > >> > > >>>>> > > > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas < > > >>>>> sdouglas at redhat.com > > >>>>> > > > >> > wrote: > > >>>>> > > > >> > > >>>>> > > > >> Another question, are you setting a content length on > the > > >>>>> > > responses? > > >>>>> > > > >> If not the channel will automatically set one if the > > >>>>> response fits > > >>>>> > > > >> inside a buffer, otherwise chunked encoding will be > used. > > >>>>> > > > >> > > >>>>> > > > >> It might be helpful to know if this only happens on > > >>>>> chunked, fixed > > >>>>> > > > >> length or both. > > >>>>> > > > >> > > >>>>> > > > >> Stuart > > >>>>> > > > >> > > >>>>> > > > >> Edgar Espina wrote: > > >>>>> > > > >> > > >>>>> > > > >> latest: 1.2.0.Beta8 > > >>>>> > > > >> > > >>>>> > > > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > > >>>>> > > > >> > > >>>>> > > > >> > >>>>> sdouglas at redhat.com>>> > > >>>>> > > wrote: > > >>>>> > > > >> > > >>>>> > > > >> Also what version of Undertow are you using? > > >>>>> > > > >> > > >>>>> > > > >> Stuart > > >>>>> > > > >> > > >>>>> > > > >> ----- Original Message ----- > > >>>>> > > > >> > From: "Edgar Espina" > >>>>> > > > >> > > >>>>> > > > >> > >>>>> espina.edgar at gmail.com > > >>>>> > > > >> >__>> > > >>>>> > > > >> > To: "Stuart Douglas" > >>>>> > > > >> > > >>>>> > > > >> > >>>>> sdouglas at redhat.com>>> > > >>>>> > > > >> > Cc: undertow-dev at lists.jboss.org > > >>>>> > > > >> > > >>>>> > > > >> > >>>>> > > > >> > > > >>>>> > > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM > > >>>>> > > > >> > Subject: Re: [undertow-dev] occasional 502 from > > >>>>> Apache HTTP > > >>>>> > > > >> Proxy > > >>>>> > > > >> > > > >>>>> > > > >> > found this in apache: > > >>>>> > > > >> > > > >>>>> > > > >> > (104) Connection reset by peer: proxy: error > > >>>>> reading status > > >>>>> > > > >> line from > > >>>>> > > > >> > remote server > > >>>>> > > > >> > > > >>>>> > > > >> > but nothing in undertow. > > >>>>> > > > >> > > > >>>>> > > > >> > got 502 on HTTP GET. Sometimes while calling > the > > >>>>> home page > > >>>>> > > / or > > >>>>> > > > >> when page > > >>>>> > > > >> > loads OK, got 502 on page resources (js, css, > > >>>>> images). > > >>>>> > > > >> > > > >>>>> > > > >> > I call startBlocking and use the outputstream > to > > >>>>> write the > > >>>>> > > > >> response, when > > >>>>> > > > >> > everything has been written I call the > > >>>>> "outputstream.close" > > >>>>> > > > >> method. Do I > > >>>>> > > > >> > need to call exchange.endExchange too? > > >>>>> > > > >> > > > >>>>> > > > >> > Thanks > > >>>>> > > > >> > > > >>>>> > > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas > > >>>>> > > > >> > > >>>>> > > > >> > >>>>> sdouglas at redhat.com>>> > > >>>>> > > wrote: > > >>>>> > > > >> > > > >>>>> > > > >> > > Is there any info in the log? Or is there any > > >>>>> specific > > >>>>> > > type > > >>>>> > > > >> of > > >>>>> > > > >> request > > >>>>> > > > >> > > that causes this? > > >>>>> > > > >> > > > > >>>>> > > > >> > > Stuart > > >>>>> > > > >> > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > ----- Original Message ----- > > >>>>> > > > >> > > > From: "Edgar Espina" < > espina.edgar at gmail.com > > >>>>> > > > >> > > >>>>> > > > >> > >>>>> espina.edgar at gmail.com > > >>>>> > > > >> >__>> > > >>>>> > > > >> > > > To: undertow-dev at lists.jboss.org > > >>>>> > > > >> > > >>>>> > > > >> > >>>>> > > > >> > > > >>>>> > > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM > > >>>>> > > > >> > > > Subject: [undertow-dev] occasional 502 from > > >>>>> Apache HTTP > > >>>>> > > > >> Proxy > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > Hi, > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > I've an Undertow application behind apache > > >>>>> reverse > > >>>>> > > proxy, > > >>>>> > > > >> trying to load > > >>>>> > > > >> > > a > > >>>>> > > > >> > > > page displays error 502 proxy error. > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > Still couldn't find why so I wonder if any > of > > >>>>> you find > > >>>>> > > a > > >>>>> > > > >> similar problem > > >>>>> > > > >> > > with > > >>>>> > > > >> > > > Undertow and Apache. > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > Please note this is our first app on top of > > >>>>> Undertow, > > >>>>> > > > >> existing apps > > >>>>> > > > >> > > running > > >>>>> > > > >> > > > on Tomcat/Jetty are OK. > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > Appreciate any help. > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > Thanks > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > -- > > >>>>> > > > >> > > > edgar > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > > > >>>>> _________________________________________________ > > >>>>> > > > >> > > > undertow-dev mailing list > > >>>>> > > > >> > > > undertow-dev at lists.jboss.org > > >>>>> > > > >> > > >>>>> > > > >> > >>>>> > > > >> > > > >>>>> > > > >> > > > > > >>>>> > > https://lists.jboss.org/__mailman/listinfo/undertow-dev > > >>>>> > > > >> < > > >>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev> > > >>>>> > > > >> > > > > >>>>> > > > >> > > > >>>>> > > > >> > > > >>>>> > > > >> > > > >>>>> > > > >> > -- > > >>>>> > > > >> > edgar > > >>>>> > > > >> > > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> -- > > >>>>> > > > >> edgar > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> -- > > >>>>> > > > >> edgar > > >>>>> > > > >> > > >>>>> > > > > > > >>>>> > > > > > >>>>> > > > > > >>>>> > > > -- > > >>>>> > > > edgar > > >>>>> > > > > > >>>>> > > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > -- > > >>>>> > edgar > > >>>>> > > > >>>>> > > >>>> > > >>>> > > >>>> > > >>>> -- > > >>>> edgar > > >>>> > > >>>> _______________________________________________ > > >>>> undertow-dev mailing list > > >>>> undertow-dev at lists.jboss.org > > >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev > > >>>> > > >>> > > >>> > > >> > > >> > > >> -- > > >> edgar > > >> > > > > > > > > > > > > -- > > edgar > > > -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150121/fadc29a1/attachment-0001.html From jason.greene at redhat.com Wed Jan 21 14:51:21 2015 From: jason.greene at redhat.com (Jason Greene) Date: Wed, 21 Jan 2015 13:51:21 -0600 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <1010163216.9639599.1421644332425.JavaMail.zimbra@redhat.com> <847958625.10923832.1421784455109.JavaMail.zimbra@redhat.com> Message-ID: Would you be willing to capture the traffic with wireshark or (tcpdump using -s 65535) when the failure occurs? It would be helpful in diagnosing the exact reason the connection is lost (tcp, http protocol issue, etc). If you prefer not to post the dump on list, you can email us privately. Thanks! > On Jan 21, 2015, at 1:40 PM, Edgar Espina wrote: > > Nope, it doesn't help. > > Stuart, you mentioned that: > "For a normal graceful close Undertow should be sending Connection:close headers." > > Is it mean that on a req/res cycle, Undertow should always set the Connection response header with close or keep-alive? > > Thanks > > > > > On Tue, Jan 20, 2015 at 5:07 PM, Stuart Douglas wrote: > > > ----- Original Message ----- > > From: "Edgar Espina" > > To: "Toma? Cerar" > > Cc: "Stuart Douglas" , undertow-dev at lists.jboss.org > > Sent: Wednesday, 21 January, 2015 2:03:10 AM > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > seems to be some sort of timeout, because everything work as expected, but > > then after waiting for a while and got again the 502. > > That is odd, as there is no timeout configured. What does your network config between the LB and Undertow look like? > > Does enabling TCP keep alive (Options.KEEP_ALIVE) help? > > Stuart > > > > > > also, I did set the content-length for static resources and call > > .endExchange after a 304 response, set a backlog of 1000 and 10000 too. But > > it didn't help. > > > > > > > > On Mon, Jan 19, 2015 at 9:57 AM, Toma? Cerar wrote: > > > > > Maybe related to > > > http://stackoverflow.com/questions/169453/bad-gateway-502-error-with-apache-mod-proxy-and-tomcat > > > > > > or > > > http://qnalist.com/questions/4502641/users-httpd-mod-proxy-ignores-incompleteness-of-chunked-coding-response-from-backend > > > > > > On Mon, Jan 19, 2015 at 1:33 PM, Edgar Espina > > > wrote: > > > > > >> Sure, it is 2.2.15. > > >> > > >> > > >> > > >> On Mon, Jan 19, 2015 at 9:29 AM, Toma? Cerar > > >> wrote: > > >> > > >>> Edgar, > > >>> > > >>> what is the version of Apache and mod_proxy module you are using. > > >>> maybe it will be easier to reproduce with exact version you have.. > > >>> > > >>> -- > > >>> tomaz > > >>> > > >>> On Mon, Jan 19, 2015 at 1:15 PM, Edgar Espina > > >>> wrote: > > >>> > > >>>> The source code can be found here: > > >>>> https://github.com/jooby-project/jooby > > >>>> > > >>>> Undertow related classes are here: > > >>>> https://github.com/jooby-project/jooby/tree/master/jooby/src/main/java/org/jooby/internal/undertow > > >>>> . > > >>>> Server is built here: > > >>>> https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowServer.java > > >>>> Response is sent here: > > >>>> https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowResponse.java#L336-382 > > >>>> > > >>>> My microweb-framework was built on top of Jetty, so for now I used the > > >>>> blocking API and follow more or less what we usually do with Servlets > > >>>> (acquire an outstream). > > >>>> > > >>>> I will review what I'm doing and try to figure it out what is going on > > >>>> too. > > >>>> > > >>>> Thanks for your help, Stuart. > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> On Mon, Jan 19, 2015 at 2:12 AM, Stuart Douglas > > >>>> wrote: > > >>>> > > >>>>> My best guess as to what is happening is that Undertow closing a > > >>>>> connection after a request is done for some reason, and the apache > > >>>>> attempts > > >>>>> to re-use this connection without realising that it is dead. > > >>>>> > > >>>>> In general this should not happen, Undertow should only forcibly close > > >>>>> a connection if it knows that it is broken (e.g. a content length is > > >>>>> set > > >>>>> and the full amount of content is not written). For a normal graceful > > >>>>> close > > >>>>> Undertow should be sending Connection:close headers. > > >>>>> > > >>>>> I am going to investigate some more, and see if I can figure out what > > >>>>> is going on. It seems unlikely but is there any chance your code > > >>>>> forcibly > > >>>>> closes the ServerConnection (HttpServerExchange.getConnection()) > > >>>>> because > > >>>>> that could potentially cause this issue. Setting the exchange to > > >>>>> non-persistent after headers have been sent could also cause it. > > >>>>> > > >>>>> Stuart > > >>>>> > > >>>>> ----- Original Message ----- > > >>>>> > From: "Edgar Espina" > > >>>>> > To: "Stuart Douglas" > > >>>>> > Cc: undertow-dev at lists.jboss.org > > >>>>> > Sent: Monday, 19 January, 2015 2:53:06 PM > > >>>>> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > >>>>> > > > >>>>> > Done, but makes no difference. Still got the 502 random errors :S > > >>>>> > > > >>>>> > On Sun, Jan 18, 2015 at 11:13 PM, Stuart Douglas < > > >>>>> sdouglas at redhat.com> > > >>>>> > wrote: > > >>>>> > > > >>>>> > > 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. > > >>>>> > > > > >>>>> > > Can you try adding: > > >>>>> > > > > >>>>> > > undertow.setSocketOption(Options.BACKLOG, 1000) > > >>>>> > > > > >>>>> > > To your Undertow builder? I am going to increase this in our > > >>>>> default > > >>>>> > > config upstream. > > >>>>> > > > > >>>>> > > Hopefully this is the issue that you are running into. > > >>>>> > > > > >>>>> > > Stuart > > >>>>> > > > > >>>>> > > > > >>>>> > > ----- Original Message ----- > > >>>>> > > > From: "Edgar Espina" > > >>>>> > > > To: "Stuart Douglas" > > >>>>> > > > Cc: undertow-dev at lists.jboss.org > > >>>>> > > > Sent: Monday, 19 January, 2015 12:10:16 PM > > >>>>> > > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > >>>>> > > > > > >>>>> > > > It is a default undertow instance with a HTTP listener, just set > > >>>>> work > > >>>>> > > > threads to 200. Is there a default idle timeout? I can' tell > > >>>>> from javadoc > > >>>>> > > > and looking at the code. > > >>>>> > > > > > >>>>> > > > > > >>>>> > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas < > > >>>>> sdouglas at redhat.com> > > >>>>> > > wrote: > > >>>>> > > > > > >>>>> > > > > > > >>>>> > > > > > > >>>>> > > > > Edgar Espina wrote: > > >>>>> > > > > > > >>>>> > > > >> I'm not, channel does it. > > >>>>> > > > >> > > >>>>> > > > >> Problem is present on both. For example, home page has a > > >>>>> > > content-length > > >>>>> > > > >> header but jquery.js use chunked. > > >>>>> > > > >> > > >>>>> > > > > > > >>>>> > > > > 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). > > >>>>> > > > > > > >>>>> > > > > > > >>>>> > > > >> Do I have to call .endExchange? or closing the output stream > > >>>>> is > > >>>>> > > enough? > > >>>>> > > > >> > > >>>>> > > > > > > >>>>> > > > > 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. > > >>>>> > > > > > > >>>>> > > > > The 'connection reset by peer' 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. > > >>>>> > > > > > > >>>>> > > > > 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. > > >>>>> > > > > > > >>>>> > > > > Stuart > > >>>>> > > > > > > >>>>> > > > > > > >>>>> > > > >> Thanks > > >>>>> > > > >> > > >>>>> > > > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas < > > >>>>> sdouglas at redhat.com > > >>>>> > > > >> > wrote: > > >>>>> > > > >> > > >>>>> > > > >> Another question, are you setting a content length on the > > >>>>> > > responses? > > >>>>> > > > >> If not the channel will automatically set one if the > > >>>>> response fits > > >>>>> > > > >> inside a buffer, otherwise chunked encoding will be used. > > >>>>> > > > >> > > >>>>> > > > >> It might be helpful to know if this only happens on > > >>>>> chunked, fixed > > >>>>> > > > >> length or both. > > >>>>> > > > >> > > >>>>> > > > >> Stuart > > >>>>> > > > >> > > >>>>> > > > >> Edgar Espina wrote: > > >>>>> > > > >> > > >>>>> > > > >> latest: 1.2.0.Beta8 > > >>>>> > > > >> > > >>>>> > > > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > > >>>>> > > > >> > > >>>>> > > > >> > >>>>> sdouglas at redhat.com>>> > > >>>>> > > wrote: > > >>>>> > > > >> > > >>>>> > > > >> Also what version of Undertow are you using? > > >>>>> > > > >> > > >>>>> > > > >> Stuart > > >>>>> > > > >> > > >>>>> > > > >> ----- Original Message ----- > > >>>>> > > > >> > From: "Edgar Espina" > >>>>> > > > >> > > >>>>> > > > >> > >>>>> espina.edgar at gmail.com > > >>>>> > > > >> >__>> > > >>>>> > > > >> > To: "Stuart Douglas" > >>>>> > > > >> > > >>>>> > > > >> > >>>>> sdouglas at redhat.com>>> > > >>>>> > > > >> > Cc: undertow-dev at lists.jboss.org > > >>>>> > > > >> > > >>>>> > > > >> > >>>>> > > > >> > > > >>>>> > > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM > > >>>>> > > > >> > Subject: Re: [undertow-dev] occasional 502 from > > >>>>> Apache HTTP > > >>>>> > > > >> Proxy > > >>>>> > > > >> > > > >>>>> > > > >> > found this in apache: > > >>>>> > > > >> > > > >>>>> > > > >> > (104) Connection reset by peer: proxy: error > > >>>>> reading status > > >>>>> > > > >> line from > > >>>>> > > > >> > remote server > > >>>>> > > > >> > > > >>>>> > > > >> > but nothing in undertow. > > >>>>> > > > >> > > > >>>>> > > > >> > got 502 on HTTP GET. Sometimes while calling the > > >>>>> home page > > >>>>> > > / or > > >>>>> > > > >> when page > > >>>>> > > > >> > loads OK, got 502 on page resources (js, css, > > >>>>> images). > > >>>>> > > > >> > > > >>>>> > > > >> > I call startBlocking and use the outputstream to > > >>>>> write the > > >>>>> > > > >> response, when > > >>>>> > > > >> > everything has been written I call the > > >>>>> "outputstream.close" > > >>>>> > > > >> method. Do I > > >>>>> > > > >> > need to call exchange.endExchange too? > > >>>>> > > > >> > > > >>>>> > > > >> > Thanks > > >>>>> > > > >> > > > >>>>> > > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart Douglas > > >>>>> > > > >> > > >>>>> > > > >> > >>>>> sdouglas at redhat.com>>> > > >>>>> > > wrote: > > >>>>> > > > >> > > > >>>>> > > > >> > > Is there any info in the log? Or is there any > > >>>>> specific > > >>>>> > > type > > >>>>> > > > >> of > > >>>>> > > > >> request > > >>>>> > > > >> > > that causes this? > > >>>>> > > > >> > > > > >>>>> > > > >> > > Stuart > > >>>>> > > > >> > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > ----- Original Message ----- > > >>>>> > > > >> > > > From: "Edgar Espina" > >>>>> > > > >> > > >>>>> > > > >> > >>>>> espina.edgar at gmail.com > > >>>>> > > > >> >__>> > > >>>>> > > > >> > > > To: undertow-dev at lists.jboss.org > > >>>>> > > > >> > > >>>>> > > > >> > >>>>> > > > >> > > > >>>>> > > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM > > >>>>> > > > >> > > > Subject: [undertow-dev] occasional 502 from > > >>>>> Apache HTTP > > >>>>> > > > >> Proxy > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > Hi, > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > I've an Undertow application behind apache > > >>>>> reverse > > >>>>> > > proxy, > > >>>>> > > > >> trying to load > > >>>>> > > > >> > > a > > >>>>> > > > >> > > > page displays error 502 proxy error. > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > Still couldn't find why so I wonder if any of > > >>>>> you find > > >>>>> > > a > > >>>>> > > > >> similar problem > > >>>>> > > > >> > > with > > >>>>> > > > >> > > > Undertow and Apache. > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > Please note this is our first app on top of > > >>>>> Undertow, > > >>>>> > > > >> existing apps > > >>>>> > > > >> > > running > > >>>>> > > > >> > > > on Tomcat/Jetty are OK. > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > Appreciate any help. > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > Thanks > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > -- > > >>>>> > > > >> > > > edgar > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > > > >>>>> _________________________________________________ > > >>>>> > > > >> > > > undertow-dev mailing list > > >>>>> > > > >> > > > undertow-dev at lists.jboss.org > > >>>>> > > > >> > > >>>>> > > > >> > >>>>> > > > >> > > > >>>>> > > > >> > > > > > >>>>> > > https://lists.jboss.org/__mailman/listinfo/undertow-dev > > >>>>> > > > >> < > > >>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev> > > >>>>> > > > >> > > > > >>>>> > > > >> > > > >>>>> > > > >> > > > >>>>> > > > >> > > > >>>>> > > > >> > -- > > >>>>> > > > >> > edgar > > >>>>> > > > >> > > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> -- > > >>>>> > > > >> edgar > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> > > >>>>> > > > >> -- > > >>>>> > > > >> edgar > > >>>>> > > > >> > > >>>>> > > > > > > >>>>> > > > > > >>>>> > > > > > >>>>> > > > -- > > >>>>> > > > edgar > > >>>>> > > > > > >>>>> > > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> > -- > > >>>>> > edgar > > >>>>> > > > >>>>> > > >>>> > > >>>> > > >>>> > > >>>> -- > > >>>> edgar > > >>>> > > >>>> _______________________________________________ > > >>>> undertow-dev mailing list > > >>>> undertow-dev at lists.jboss.org > > >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev > > >>>> > > >>> > > >>> > > >> > > >> > > >> -- > > >> edgar > > >> > > > > > > > > > > > > -- > > edgar > > > > > > -- > edgar > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev -- Jason T. Greene WildFly Lead / JBoss EAP Platform Architect JBoss, a division of Red Hat From espina.edgar at gmail.com Thu Jan 22 11:18:25 2015 From: espina.edgar at gmail.com (Edgar Espina) Date: Thu, 22 Jan 2015 13:18:25 -0300 Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <1010163216.9639599.1421644332425.JavaMail.zimbra@redhat.com> <847958625.10923832.1421784455109.JavaMail.zimbra@redhat.com> Message-ID: we put nginx upfront undertow and everything works as expected. so we have: apache -> nginx -> undertow :S apache can't be removed it and as I said before existing apps running on Tomcat/Jetty work without any issue we need to move on with our project (wasted a lot of time on this) but I will try capture the traffic with wireshark and shared it. still, if you find out something will be helpful too. On Wed, Jan 21, 2015 at 4:51 PM, Jason Greene wrote: > Would you be willing to capture the traffic with wireshark or (tcpdump > using -s 65535) when the failure occurs? It would be helpful in diagnosing > the exact reason the connection is lost (tcp, http protocol issue, etc). > > If you prefer not to post the dump on list, you can email us privately. > > Thanks! > > > > On Jan 21, 2015, at 1:40 PM, Edgar Espina > wrote: > > > > Nope, it doesn't help. > > > > Stuart, you mentioned that: > > "For a normal graceful close Undertow should be sending Connection:close > headers." > > > > Is it mean that on a req/res cycle, Undertow should always set the > Connection response header with close or keep-alive? > > > > Thanks > > > > > > > > > > On Tue, Jan 20, 2015 at 5:07 PM, Stuart Douglas > wrote: > > > > > > ----- Original Message ----- > > > From: "Edgar Espina" > > > To: "Toma? Cerar" > > > Cc: "Stuart Douglas" , > undertow-dev at lists.jboss.org > > > Sent: Wednesday, 21 January, 2015 2:03:10 AM > > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > > > seems to be some sort of timeout, because everything work as expected, > but > > > then after waiting for a while and got again the 502. > > > > That is odd, as there is no timeout configured. What does your network > config between the LB and Undertow look like? > > > > Does enabling TCP keep alive (Options.KEEP_ALIVE) help? > > > > Stuart > > > > > > > > > > also, I did set the content-length for static resources and call > > > .endExchange after a 304 response, set a backlog of 1000 and 10000 > too. But > > > it didn't help. > > > > > > > > > > > > On Mon, Jan 19, 2015 at 9:57 AM, Toma? Cerar > wrote: > > > > > > > Maybe related to > > > > > http://stackoverflow.com/questions/169453/bad-gateway-502-error-with-apache-mod-proxy-and-tomcat > > > > > > > > or > > > > > http://qnalist.com/questions/4502641/users-httpd-mod-proxy-ignores-incompleteness-of-chunked-coding-response-from-backend > > > > > > > > On Mon, Jan 19, 2015 at 1:33 PM, Edgar Espina < > espina.edgar at gmail.com> > > > > wrote: > > > > > > > >> Sure, it is 2.2.15. > > > >> > > > >> > > > >> > > > >> On Mon, Jan 19, 2015 at 9:29 AM, Toma? Cerar > > > > >> wrote: > > > >> > > > >>> Edgar, > > > >>> > > > >>> what is the version of Apache and mod_proxy module you are using. > > > >>> maybe it will be easier to reproduce with exact version you have.. > > > >>> > > > >>> -- > > > >>> tomaz > > > >>> > > > >>> On Mon, Jan 19, 2015 at 1:15 PM, Edgar Espina < > espina.edgar at gmail.com> > > > >>> wrote: > > > >>> > > > >>>> The source code can be found here: > > > >>>> https://github.com/jooby-project/jooby > > > >>>> > > > >>>> Undertow related classes are here: > > > >>>> > https://github.com/jooby-project/jooby/tree/master/jooby/src/main/java/org/jooby/internal/undertow > > > >>>> . > > > >>>> Server is built here: > > > >>>> > https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowServer.java > > > >>>> Response is sent here: > > > >>>> > https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowResponse.java#L336-382 > > > >>>> > > > >>>> My microweb-framework was built on top of Jetty, so for now I > used the > > > >>>> blocking API and follow more or less what we usually do with > Servlets > > > >>>> (acquire an outstream). > > > >>>> > > > >>>> I will review what I'm doing and try to figure it out what is > going on > > > >>>> too. > > > >>>> > > > >>>> Thanks for your help, Stuart. > > > >>>> > > > >>>> > > > >>>> > > > >>>> > > > >>>> On Mon, Jan 19, 2015 at 2:12 AM, Stuart Douglas < > sdouglas at redhat.com> > > > >>>> wrote: > > > >>>> > > > >>>>> My best guess as to what is happening is that Undertow closing a > > > >>>>> connection after a request is done for some reason, and the > apache > > > >>>>> attempts > > > >>>>> to re-use this connection without realising that it is dead. > > > >>>>> > > > >>>>> In general this should not happen, Undertow should only forcibly > close > > > >>>>> a connection if it knows that it is broken (e.g. a content > length is > > > >>>>> set > > > >>>>> and the full amount of content is not written). For a normal > graceful > > > >>>>> close > > > >>>>> Undertow should be sending Connection:close headers. > > > >>>>> > > > >>>>> I am going to investigate some more, and see if I can figure out > what > > > >>>>> is going on. It seems unlikely but is there any chance your code > > > >>>>> forcibly > > > >>>>> closes the ServerConnection (HttpServerExchange.getConnection()) > > > >>>>> because > > > >>>>> that could potentially cause this issue. Setting the exchange to > > > >>>>> non-persistent after headers have been sent could also cause it. > > > >>>>> > > > >>>>> Stuart > > > >>>>> > > > >>>>> ----- Original Message ----- > > > >>>>> > From: "Edgar Espina" > > > >>>>> > To: "Stuart Douglas" > > > >>>>> > Cc: undertow-dev at lists.jboss.org > > > >>>>> > Sent: Monday, 19 January, 2015 2:53:06 PM > > > >>>>> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP > Proxy > > > >>>>> > > > > >>>>> > Done, but makes no difference. Still got the 502 random errors > :S > > > >>>>> > > > > >>>>> > On Sun, Jan 18, 2015 at 11:13 PM, Stuart Douglas < > > > >>>>> sdouglas at redhat.com> > > > >>>>> > wrote: > > > >>>>> > > > > >>>>> > > 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. > > > >>>>> > > > > > >>>>> > > Can you try adding: > > > >>>>> > > > > > >>>>> > > undertow.setSocketOption(Options.BACKLOG, 1000) > > > >>>>> > > > > > >>>>> > > To your Undertow builder? I am going to increase this in our > > > >>>>> default > > > >>>>> > > config upstream. > > > >>>>> > > > > > >>>>> > > Hopefully this is the issue that you are running into. > > > >>>>> > > > > > >>>>> > > Stuart > > > >>>>> > > > > > >>>>> > > > > > >>>>> > > ----- Original Message ----- > > > >>>>> > > > From: "Edgar Espina" > > > >>>>> > > > To: "Stuart Douglas" > > > >>>>> > > > Cc: undertow-dev at lists.jboss.org > > > >>>>> > > > Sent: Monday, 19 January, 2015 12:10:16 PM > > > >>>>> > > > Subject: Re: [undertow-dev] occasional 502 from Apache > HTTP Proxy > > > >>>>> > > > > > > >>>>> > > > It is a default undertow instance with a HTTP listener, > just set > > > >>>>> work > > > >>>>> > > > threads to 200. Is there a default idle timeout? I can' > tell > > > >>>>> from javadoc > > > >>>>> > > > and looking at the code. > > > >>>>> > > > > > > >>>>> > > > > > > >>>>> > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas < > > > >>>>> sdouglas at redhat.com> > > > >>>>> > > wrote: > > > >>>>> > > > > > > >>>>> > > > > > > > >>>>> > > > > > > > >>>>> > > > > Edgar Espina wrote: > > > >>>>> > > > > > > > >>>>> > > > >> I'm not, channel does it. > > > >>>>> > > > >> > > > >>>>> > > > >> Problem is present on both. For example, home page has a > > > >>>>> > > content-length > > > >>>>> > > > >> header but jquery.js use chunked. > > > >>>>> > > > >> > > > >>>>> > > > > > > > >>>>> > > > > 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). > > > >>>>> > > > > > > > >>>>> > > > > > > > >>>>> > > > >> Do I have to call .endExchange? or closing the output > stream > > > >>>>> is > > > >>>>> > > enough? > > > >>>>> > > > >> > > > >>>>> > > > > > > > >>>>> > > > > 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. > > > >>>>> > > > > > > > >>>>> > > > > The 'connection reset by peer' 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. > > > >>>>> > > > > > > > >>>>> > > > > 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. > > > >>>>> > > > > > > > >>>>> > > > > Stuart > > > >>>>> > > > > > > > >>>>> > > > > > > > >>>>> > > > >> Thanks > > > >>>>> > > > >> > > > >>>>> > > > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas < > > > >>>>> sdouglas at redhat.com > > > >>>>> > > > >> > wrote: > > > >>>>> > > > >> > > > >>>>> > > > >> Another question, are you setting a content length > on the > > > >>>>> > > responses? > > > >>>>> > > > >> If not the channel will automatically set one if the > > > >>>>> response fits > > > >>>>> > > > >> inside a buffer, otherwise chunked encoding will be > used. > > > >>>>> > > > >> > > > >>>>> > > > >> It might be helpful to know if this only happens on > > > >>>>> chunked, fixed > > > >>>>> > > > >> length or both. > > > >>>>> > > > >> > > > >>>>> > > > >> Stuart > > > >>>>> > > > >> > > > >>>>> > > > >> Edgar Espina wrote: > > > >>>>> > > > >> > > > >>>>> > > > >> latest: 1.2.0.Beta8 > > > >>>>> > > > >> > > > >>>>> > > > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > > > >>>>> > > > >> sdouglas at redhat.com> > > > >>>>> > > > >> > > >>>>> sdouglas at redhat.com>>> > > > >>>>> > > wrote: > > > >>>>> > > > >> > > > >>>>> > > > >> Also what version of Undertow are you > using? > > > >>>>> > > > >> > > > >>>>> > > > >> Stuart > > > >>>>> > > > >> > > > >>>>> > > > >> ----- Original Message ----- > > > >>>>> > > > >> > From: "Edgar Espina" < > espina.edgar at gmail.com > > > >>>>> > > > >> > > > >>>>> > > > >> > > >>>>> espina.edgar at gmail.com > > > >>>>> > > > >> >__>> > > > >>>>> > > > >> > To: "Stuart Douglas" > > >>>>> > > > >> > > > >>>>> > > > >> > > >>>>> sdouglas at redhat.com>>> > > > >>>>> > > > >> > Cc: undertow-dev at lists.jboss.org > > > >>>>> > > > >> > > > >>>>> > > > >> > > >>>>> > > > >> > > > > >>>>> > > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM > > > >>>>> > > > >> > Subject: Re: [undertow-dev] occasional 502 > from > > > >>>>> Apache HTTP > > > >>>>> > > > >> Proxy > > > >>>>> > > > >> > > > > >>>>> > > > >> > found this in apache: > > > >>>>> > > > >> > > > > >>>>> > > > >> > (104) Connection reset by peer: proxy: error > > > >>>>> reading status > > > >>>>> > > > >> line from > > > >>>>> > > > >> > remote server > > > >>>>> > > > >> > > > > >>>>> > > > >> > but nothing in undertow. > > > >>>>> > > > >> > > > > >>>>> > > > >> > got 502 on HTTP GET. Sometimes while calling > the > > > >>>>> home page > > > >>>>> > > / or > > > >>>>> > > > >> when page > > > >>>>> > > > >> > loads OK, got 502 on page resources (js, css, > > > >>>>> images). > > > >>>>> > > > >> > > > > >>>>> > > > >> > I call startBlocking and use the > outputstream to > > > >>>>> write the > > > >>>>> > > > >> response, when > > > >>>>> > > > >> > everything has been written I call the > > > >>>>> "outputstream.close" > > > >>>>> > > > >> method. Do I > > > >>>>> > > > >> > need to call exchange.endExchange too? > > > >>>>> > > > >> > > > > >>>>> > > > >> > Thanks > > > >>>>> > > > >> > > > > >>>>> > > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart > Douglas > > > >>>>> > > > >> sdouglas at redhat.com> > > > >>>>> > > > >> > > >>>>> sdouglas at redhat.com>>> > > > >>>>> > > wrote: > > > >>>>> > > > >> > > > > >>>>> > > > >> > > Is there any info in the log? Or is there > any > > > >>>>> specific > > > >>>>> > > type > > > >>>>> > > > >> of > > > >>>>> > > > >> request > > > >>>>> > > > >> > > that causes this? > > > >>>>> > > > >> > > > > > >>>>> > > > >> > > Stuart > > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > > ----- Original Message ----- > > > >>>>> > > > >> > > > From: "Edgar Espina" < > espina.edgar at gmail.com > > > >>>>> > > > >> > > > >>>>> > > > >> > > >>>>> espina.edgar at gmail.com > > > >>>>> > > > >> >__>> > > > >>>>> > > > >> > > > To: undertow-dev at lists.jboss.org > > > >>>>> > > > >> > > > >>>>> > > > >> > > >>>>> > > > >> > > > > >>>>> > > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM > > > >>>>> > > > >> > > > Subject: [undertow-dev] occasional 502 > from > > > >>>>> Apache HTTP > > > >>>>> > > > >> Proxy > > > >>>>> > > > >> > > > > > > >>>>> > > > >> > > > Hi, > > > >>>>> > > > >> > > > > > > >>>>> > > > >> > > > I've an Undertow application behind > apache > > > >>>>> reverse > > > >>>>> > > proxy, > > > >>>>> > > > >> trying to load > > > >>>>> > > > >> > > a > > > >>>>> > > > >> > > > page displays error 502 proxy error. > > > >>>>> > > > >> > > > > > > >>>>> > > > >> > > > Still couldn't find why so I wonder if > any of > > > >>>>> you find > > > >>>>> > > a > > > >>>>> > > > >> similar problem > > > >>>>> > > > >> > > with > > > >>>>> > > > >> > > > Undertow and Apache. > > > >>>>> > > > >> > > > > > > >>>>> > > > >> > > > Please note this is our first app on top > of > > > >>>>> Undertow, > > > >>>>> > > > >> existing apps > > > >>>>> > > > >> > > running > > > >>>>> > > > >> > > > on Tomcat/Jetty are OK. > > > >>>>> > > > >> > > > > > > >>>>> > > > >> > > > Appreciate any help. > > > >>>>> > > > >> > > > > > > >>>>> > > > >> > > > Thanks > > > >>>>> > > > >> > > > > > > >>>>> > > > >> > > > -- > > > >>>>> > > > >> > > > edgar > > > >>>>> > > > >> > > > > > > >>>>> > > > >> > > > > > > >>>>> _________________________________________________ > > > >>>>> > > > >> > > > undertow-dev mailing list > > > >>>>> > > > >> > > > undertow-dev at lists.jboss.org > > > >>>>> > > > >> > > > >>>>> > > > >> > > >>>>> > > > >> > > > > >>>>> > > > >> > > > > > > >>>>> > > https://lists.jboss.org/__mailman/listinfo/undertow-dev > > > >>>>> > > > >> < > > > >>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev> > > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > > >>>>> > > > >> > -- > > > >>>>> > > > >> > edgar > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > >>>>> > > > >> > > > >>>>> > > > >> > > > >>>>> > > > >> > > > >>>>> > > > >> -- > > > >>>>> > > > >> edgar > > > >>>>> > > > >> > > > >>>>> > > > >> > > > >>>>> > > > >> > > > >>>>> > > > >> > > > >>>>> > > > >> -- > > > >>>>> > > > >> edgar > > > >>>>> > > > >> > > > >>>>> > > > > > > > >>>>> > > > > > > >>>>> > > > > > > >>>>> > > > -- > > > >>>>> > > > edgar > > > >>>>> > > > > > > >>>>> > > > > > >>>>> > > > > >>>>> > > > > >>>>> > > > > >>>>> > -- > > > >>>>> > edgar > > > >>>>> > > > > >>>>> > > > >>>> > > > >>>> > > > >>>> > > > >>>> -- > > > >>>> edgar > > > >>>> > > > >>>> _______________________________________________ > > > >>>> undertow-dev mailing list > > > >>>> undertow-dev at lists.jboss.org > > > >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev > > > >>>> > > > >>> > > > >>> > > > >> > > > >> > > > >> -- > > > >> edgar > > > >> > > > > > > > > > > > > > > > > > -- > > > edgar > > > > > > > > > > > -- > > edgar > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > > -- > Jason T. Greene > WildFly Lead / JBoss EAP Platform Architect > JBoss, a division of Red Hat > > -- edgar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150122/c9bf6930/attachment-0001.html From sdouglas at redhat.com Thu Jan 22 19:29:21 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Thu, 22 Jan 2015 19:29:21 -0500 (EST) Subject: [undertow-dev] occasional 502 from Apache HTTP Proxy In-Reply-To: References: <847958625.10923832.1421784455109.JavaMail.zimbra@redhat.com> Message-ID: <1999201773.12204875.1421972961590.JavaMail.zimbra@redhat.com> I actually just found a bug that could be the root cause of this. The header size check was being performed incorrectly, so in some circumstances a request may be closed after the headers have been sent. This is fixed upstream, and will make it into a release shortly. Stuart ----- Original Message ----- > From: "Edgar Espina" > To: "Jason Greene" > Cc: "Stuart Douglas" , undertow-dev at lists.jboss.org > Sent: Friday, 23 January, 2015 3:18:25 AM > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > we put nginx upfront undertow and everything works as expected. > > so we have: apache -> nginx -> undertow :S > > apache can't be removed it and as I said before existing apps running on > Tomcat/Jetty work without any issue > > we need to move on with our project (wasted a lot of time on this) but I > will try capture the traffic with wireshark and shared it. > > still, if you find out something will be helpful too. > > > > On Wed, Jan 21, 2015 at 4:51 PM, Jason Greene > wrote: > > > Would you be willing to capture the traffic with wireshark or (tcpdump > > using -s 65535) when the failure occurs? It would be helpful in diagnosing > > the exact reason the connection is lost (tcp, http protocol issue, etc). > > > > If you prefer not to post the dump on list, you can email us privately. > > > > Thanks! > > > > > > > On Jan 21, 2015, at 1:40 PM, Edgar Espina > > wrote: > > > > > > Nope, it doesn't help. > > > > > > Stuart, you mentioned that: > > > "For a normal graceful close Undertow should be sending Connection:close > > headers." > > > > > > Is it mean that on a req/res cycle, Undertow should always set the > > Connection response header with close or keep-alive? > > > > > > Thanks > > > > > > > > > > > > > > > On Tue, Jan 20, 2015 at 5:07 PM, Stuart Douglas > > wrote: > > > > > > > > > ----- Original Message ----- > > > > From: "Edgar Espina" > > > > To: "Toma? Cerar" > > > > Cc: "Stuart Douglas" , > > undertow-dev at lists.jboss.org > > > > Sent: Wednesday, 21 January, 2015 2:03:10 AM > > > > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP Proxy > > > > > > > > seems to be some sort of timeout, because everything work as expected, > > but > > > > then after waiting for a while and got again the 502. > > > > > > That is odd, as there is no timeout configured. What does your network > > config between the LB and Undertow look like? > > > > > > Does enabling TCP keep alive (Options.KEEP_ALIVE) help? > > > > > > Stuart > > > > > > > > > > > > > > also, I did set the content-length for static resources and call > > > > .endExchange after a 304 response, set a backlog of 1000 and 10000 > > too. But > > > > it didn't help. > > > > > > > > > > > > > > > > On Mon, Jan 19, 2015 at 9:57 AM, Toma? Cerar > > wrote: > > > > > > > > > Maybe related to > > > > > > > http://stackoverflow.com/questions/169453/bad-gateway-502-error-with-apache-mod-proxy-and-tomcat > > > > > > > > > > or > > > > > > > http://qnalist.com/questions/4502641/users-httpd-mod-proxy-ignores-incompleteness-of-chunked-coding-response-from-backend > > > > > > > > > > On Mon, Jan 19, 2015 at 1:33 PM, Edgar Espina < > > espina.edgar at gmail.com> > > > > > wrote: > > > > > > > > > >> Sure, it is 2.2.15. > > > > >> > > > > >> > > > > >> > > > > >> On Mon, Jan 19, 2015 at 9:29 AM, Toma? Cerar > > > > > > >> wrote: > > > > >> > > > > >>> Edgar, > > > > >>> > > > > >>> what is the version of Apache and mod_proxy module you are using. > > > > >>> maybe it will be easier to reproduce with exact version you have.. > > > > >>> > > > > >>> -- > > > > >>> tomaz > > > > >>> > > > > >>> On Mon, Jan 19, 2015 at 1:15 PM, Edgar Espina < > > espina.edgar at gmail.com> > > > > >>> wrote: > > > > >>> > > > > >>>> The source code can be found here: > > > > >>>> https://github.com/jooby-project/jooby > > > > >>>> > > > > >>>> Undertow related classes are here: > > > > >>>> > > https://github.com/jooby-project/jooby/tree/master/jooby/src/main/java/org/jooby/internal/undertow > > > > >>>> . > > > > >>>> Server is built here: > > > > >>>> > > https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowServer.java > > > > >>>> Response is sent here: > > > > >>>> > > https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/undertow/UndertowResponse.java#L336-382 > > > > >>>> > > > > >>>> My microweb-framework was built on top of Jetty, so for now I > > used the > > > > >>>> blocking API and follow more or less what we usually do with > > Servlets > > > > >>>> (acquire an outstream). > > > > >>>> > > > > >>>> I will review what I'm doing and try to figure it out what is > > going on > > > > >>>> too. > > > > >>>> > > > > >>>> Thanks for your help, Stuart. > > > > >>>> > > > > >>>> > > > > >>>> > > > > >>>> > > > > >>>> On Mon, Jan 19, 2015 at 2:12 AM, Stuart Douglas < > > sdouglas at redhat.com> > > > > >>>> wrote: > > > > >>>> > > > > >>>>> My best guess as to what is happening is that Undertow closing a > > > > >>>>> connection after a request is done for some reason, and the > > apache > > > > >>>>> attempts > > > > >>>>> to re-use this connection without realising that it is dead. > > > > >>>>> > > > > >>>>> In general this should not happen, Undertow should only forcibly > > close > > > > >>>>> a connection if it knows that it is broken (e.g. a content > > length is > > > > >>>>> set > > > > >>>>> and the full amount of content is not written). For a normal > > graceful > > > > >>>>> close > > > > >>>>> Undertow should be sending Connection:close headers. > > > > >>>>> > > > > >>>>> I am going to investigate some more, and see if I can figure out > > what > > > > >>>>> is going on. It seems unlikely but is there any chance your code > > > > >>>>> forcibly > > > > >>>>> closes the ServerConnection (HttpServerExchange.getConnection()) > > > > >>>>> because > > > > >>>>> that could potentially cause this issue. Setting the exchange to > > > > >>>>> non-persistent after headers have been sent could also cause it. > > > > >>>>> > > > > >>>>> Stuart > > > > >>>>> > > > > >>>>> ----- Original Message ----- > > > > >>>>> > From: "Edgar Espina" > > > > >>>>> > To: "Stuart Douglas" > > > > >>>>> > Cc: undertow-dev at lists.jboss.org > > > > >>>>> > Sent: Monday, 19 January, 2015 2:53:06 PM > > > > >>>>> > Subject: Re: [undertow-dev] occasional 502 from Apache HTTP > > Proxy > > > > >>>>> > > > > > >>>>> > Done, but makes no difference. Still got the 502 random errors > > :S > > > > >>>>> > > > > > >>>>> > On Sun, Jan 18, 2015 at 11:13 PM, Stuart Douglas < > > > > >>>>> sdouglas at redhat.com> > > > > >>>>> > wrote: > > > > >>>>> > > > > > >>>>> > > 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. > > > > >>>>> > > > > > > >>>>> > > Can you try adding: > > > > >>>>> > > > > > > >>>>> > > undertow.setSocketOption(Options.BACKLOG, 1000) > > > > >>>>> > > > > > > >>>>> > > To your Undertow builder? I am going to increase this in our > > > > >>>>> default > > > > >>>>> > > config upstream. > > > > >>>>> > > > > > > >>>>> > > Hopefully this is the issue that you are running into. > > > > >>>>> > > > > > > >>>>> > > Stuart > > > > >>>>> > > > > > > >>>>> > > > > > > >>>>> > > ----- Original Message ----- > > > > >>>>> > > > From: "Edgar Espina" > > > > >>>>> > > > To: "Stuart Douglas" > > > > >>>>> > > > Cc: undertow-dev at lists.jboss.org > > > > >>>>> > > > Sent: Monday, 19 January, 2015 12:10:16 PM > > > > >>>>> > > > Subject: Re: [undertow-dev] occasional 502 from Apache > > HTTP Proxy > > > > >>>>> > > > > > > > >>>>> > > > It is a default undertow instance with a HTTP listener, > > just set > > > > >>>>> work > > > > >>>>> > > > threads to 200. Is there a default idle timeout? I can' > > tell > > > > >>>>> from javadoc > > > > >>>>> > > > and looking at the code. > > > > >>>>> > > > > > > > >>>>> > > > > > > > >>>>> > > > On Sun, Jan 18, 2015 at 9:59 PM, Stuart Douglas < > > > > >>>>> sdouglas at redhat.com> > > > > >>>>> > > wrote: > > > > >>>>> > > > > > > > >>>>> > > > > > > > > >>>>> > > > > > > > > >>>>> > > > > Edgar Espina wrote: > > > > >>>>> > > > > > > > > >>>>> > > > >> I'm not, channel does it. > > > > >>>>> > > > >> > > > > >>>>> > > > >> Problem is present on both. For example, home page has a > > > > >>>>> > > content-length > > > > >>>>> > > > >> header but jquery.js use chunked. > > > > >>>>> > > > >> > > > > >>>>> > > > > > > > > >>>>> > > > > 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). > > > > >>>>> > > > > > > > > >>>>> > > > > > > > > >>>>> > > > >> Do I have to call .endExchange? or closing the output > > stream > > > > >>>>> is > > > > >>>>> > > enough? > > > > >>>>> > > > >> > > > > >>>>> > > > > > > > > >>>>> > > > > 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. > > > > >>>>> > > > > > > > > >>>>> > > > > The 'connection reset by peer' 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. > > > > >>>>> > > > > > > > > >>>>> > > > > 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. > > > > >>>>> > > > > > > > > >>>>> > > > > Stuart > > > > >>>>> > > > > > > > > >>>>> > > > > > > > > >>>>> > > > >> Thanks > > > > >>>>> > > > >> > > > > >>>>> > > > >> On Sun, Jan 18, 2015 at 9:48 PM, Stuart Douglas < > > > > >>>>> sdouglas at redhat.com > > > > >>>>> > > > >> > wrote: > > > > >>>>> > > > >> > > > > >>>>> > > > >> Another question, are you setting a content length > > on the > > > > >>>>> > > responses? > > > > >>>>> > > > >> If not the channel will automatically set one if the > > > > >>>>> response fits > > > > >>>>> > > > >> inside a buffer, otherwise chunked encoding will be > > used. > > > > >>>>> > > > >> > > > > >>>>> > > > >> It might be helpful to know if this only happens on > > > > >>>>> chunked, fixed > > > > >>>>> > > > >> length or both. > > > > >>>>> > > > >> > > > > >>>>> > > > >> Stuart > > > > >>>>> > > > >> > > > > >>>>> > > > >> Edgar Espina wrote: > > > > >>>>> > > > >> > > > > >>>>> > > > >> latest: 1.2.0.Beta8 > > > > >>>>> > > > >> > > > > >>>>> > > > >> On Sun, Jan 18, 2015 at 9:42 PM, Stuart Douglas > > > > >>>>> > > > >> > sdouglas at redhat.com> > > > > >>>>> > > > >> > > > >>>>> sdouglas at redhat.com>>> > > > > >>>>> > > wrote: > > > > >>>>> > > > >> > > > > >>>>> > > > >> Also what version of Undertow are you > > using? > > > > >>>>> > > > >> > > > > >>>>> > > > >> Stuart > > > > >>>>> > > > >> > > > > >>>>> > > > >> ----- Original Message ----- > > > > >>>>> > > > >> > From: "Edgar Espina" < > > espina.edgar at gmail.com > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > >>>>> espina.edgar at gmail.com > > > > >>>>> > > > >> >__>> > > > > >>>>> > > > >> > To: "Stuart Douglas" > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > >>>>> sdouglas at redhat.com>>> > > > > >>>>> > > > >> > Cc: undertow-dev at lists.jboss.org > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > >>>>> > > > >> > > > > > >>>>> > > > >> > Sent: Monday, 19 January, 2015 11:13:21 AM > > > > >>>>> > > > >> > Subject: Re: [undertow-dev] occasional 502 > > from > > > > >>>>> Apache HTTP > > > > >>>>> > > > >> Proxy > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > found this in apache: > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > (104) Connection reset by peer: proxy: error > > > > >>>>> reading status > > > > >>>>> > > > >> line from > > > > >>>>> > > > >> > remote server > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > but nothing in undertow. > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > got 502 on HTTP GET. Sometimes while calling > > the > > > > >>>>> home page > > > > >>>>> > > / or > > > > >>>>> > > > >> when page > > > > >>>>> > > > >> > loads OK, got 502 on page resources (js, css, > > > > >>>>> images). > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > I call startBlocking and use the > > outputstream to > > > > >>>>> write the > > > > >>>>> > > > >> response, when > > > > >>>>> > > > >> > everything has been written I call the > > > > >>>>> "outputstream.close" > > > > >>>>> > > > >> method. Do I > > > > >>>>> > > > >> > need to call exchange.endExchange too? > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > Thanks > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > On Sun, Jan 18, 2015 at 8:52 PM, Stuart > > Douglas > > > > >>>>> > > > >> > sdouglas at redhat.com> > > > > >>>>> > > > >> > > > >>>>> sdouglas at redhat.com>>> > > > > >>>>> > > wrote: > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > > Is there any info in the log? Or is there > > any > > > > >>>>> specific > > > > >>>>> > > type > > > > >>>>> > > > >> of > > > > >>>>> > > > >> request > > > > >>>>> > > > >> > > that causes this? > > > > >>>>> > > > >> > > > > > > >>>>> > > > >> > > Stuart > > > > >>>>> > > > >> > > > > > > >>>>> > > > >> > > > > > > >>>>> > > > >> > > ----- Original Message ----- > > > > >>>>> > > > >> > > > From: "Edgar Espina" < > > espina.edgar at gmail.com > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > >>>>> espina.edgar at gmail.com > > > > >>>>> > > > >> >__>> > > > > >>>>> > > > >> > > > To: undertow-dev at lists.jboss.org > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > Sent: Monday, 19 January, 2015 9:42:19 AM > > > > >>>>> > > > >> > > > Subject: [undertow-dev] occasional 502 > > from > > > > >>>>> Apache HTTP > > > > >>>>> > > > >> Proxy > > > > >>>>> > > > >> > > > > > > > >>>>> > > > >> > > > Hi, > > > > >>>>> > > > >> > > > > > > > >>>>> > > > >> > > > I've an Undertow application behind > > apache > > > > >>>>> reverse > > > > >>>>> > > proxy, > > > > >>>>> > > > >> trying to load > > > > >>>>> > > > >> > > a > > > > >>>>> > > > >> > > > page displays error 502 proxy error. > > > > >>>>> > > > >> > > > > > > > >>>>> > > > >> > > > Still couldn't find why so I wonder if > > any of > > > > >>>>> you find > > > > >>>>> > > a > > > > >>>>> > > > >> similar problem > > > > >>>>> > > > >> > > with > > > > >>>>> > > > >> > > > Undertow and Apache. > > > > >>>>> > > > >> > > > > > > > >>>>> > > > >> > > > Please note this is our first app on top > > of > > > > >>>>> Undertow, > > > > >>>>> > > > >> existing apps > > > > >>>>> > > > >> > > running > > > > >>>>> > > > >> > > > on Tomcat/Jetty are OK. > > > > >>>>> > > > >> > > > > > > > >>>>> > > > >> > > > Appreciate any help. > > > > >>>>> > > > >> > > > > > > > >>>>> > > > >> > > > Thanks > > > > >>>>> > > > >> > > > > > > > >>>>> > > > >> > > > -- > > > > >>>>> > > > >> > > > edgar > > > > >>>>> > > > >> > > > > > > > >>>>> > > > >> > > > > > > > >>>>> _________________________________________________ > > > > >>>>> > > > >> > > > undertow-dev mailing list > > > > >>>>> > > > >> > > > undertow-dev at lists.jboss.org > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > > > > > >>>>> > > https://lists.jboss.org/__mailman/listinfo/undertow-dev > > > > >>>>> > > > >> < > > > > >>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev> > > > > >>>>> > > > >> > > > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > -- > > > > >>>>> > > > >> > edgar > > > > >>>>> > > > >> > > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > > >>>>> > > > >> -- > > > > >>>>> > > > >> edgar > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > > >>>>> > > > >> > > > > >>>>> > > > >> -- > > > > >>>>> > > > >> edgar > > > > >>>>> > > > >> > > > > >>>>> > > > > > > > > >>>>> > > > > > > > >>>>> > > > > > > > >>>>> > > > -- > > > > >>>>> > > > edgar > > > > >>>>> > > > > > > > >>>>> > > > > > > >>>>> > > > > > >>>>> > > > > > >>>>> > > > > > >>>>> > -- > > > > >>>>> > edgar > > > > >>>>> > > > > > >>>>> > > > > >>>> > > > > >>>> > > > > >>>> > > > > >>>> -- > > > > >>>> edgar > > > > >>>> > > > > >>>> _______________________________________________ > > > > >>>> undertow-dev mailing list > > > > >>>> undertow-dev at lists.jboss.org > > > > >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > >>>> > > > > >>> > > > > >>> > > > > >> > > > > >> > > > > >> -- > > > > >> edgar > > > > >> > > > > > > > > > > > > > > > > > > > > > > -- > > > > edgar > > > > > > > > > > > > > > > > -- > > > edgar > > > _______________________________________________ > > > undertow-dev mailing list > > > undertow-dev at lists.jboss.org > > > https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > -- > > Jason T. Greene > > WildFly Lead / JBoss EAP Platform Architect > > JBoss, a division of Red Hat > > > > > > > -- > edgar > From ceharris at vt.edu Fri Jan 23 07:25:36 2015 From: ceharris at vt.edu (Harris, Carl) Date: Fri, 23 Jan 2015 12:25:36 +0000 Subject: [undertow-dev] Access JBoss MSC service from ServletExtension Message-ID: I made a ServletExtension that adds an AuthenticationMethod to an Undertow servlet deployment. I have a basic mock up of the authentication method working. In order to move beyond the mock up, my authentication mechanism needs to use a service that my Wildfly extension puts into the (JBoss MSC) service registry. I?m not seeing how to put the pieces together to get a reference to the service registry so I can locate my service. Does someone have an example that I could reference or tips on how I might go about this? Thanks, Carl ? Carl Harris Chief Technology Architect Virginia Tech From tomaz.cerar at gmail.com Fri Jan 23 12:17:45 2015 From: tomaz.cerar at gmail.com (=?UTF-8?B?VG9tYcW+IENlcmFy?=) Date: Fri, 23 Jan 2015 18:17:45 +0100 Subject: [undertow-dev] Access JBoss MSC service from ServletExtension In-Reply-To: References: Message-ID: ServletExtension is not really meant to be also WildFly extension... but there is some overlap. As ServletExtension would work also outside wildfly deployment. what you could do is use Service Activator that implements *org.jboss.msc.service.ServiceActivator* and register it as a service in your deployment. This service activator will be than activated with deployment is started. And example how to use this can be found at: http://management-platform.blogspot.com/2012/07/co-located-management-client-for.html other option would be to write proper WildFly extension which is bit more work. take a look at https://docs.jboss.org/author/display/WFLY8/Extending+WildFly+8 for how to do that. -- tomaz On Fri, Jan 23, 2015 at 1:25 PM, Harris, Carl wrote: > I made a ServletExtension that adds an AuthenticationMethod to an Undertow > servlet deployment. I have a basic mock up of the authentication method > working. > > In order to move beyond the mock up, my authentication mechanism needs to > use a service that my Wildfly extension puts into the (JBoss MSC) service > registry. I?m not seeing how to put the pieces together to get a reference > to the service registry so I can locate my service. > > Does someone have an example that I could reference or tips on how I might > go about this? > > Thanks, > > Carl > > > ? > Carl Harris > Chief Technology Architect > Virginia Tech > > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150123/c1c2b386/attachment-0001.html From ceharris at vt.edu Fri Jan 23 12:54:55 2015 From: ceharris at vt.edu (Harris, Carl) Date: Fri, 23 Jan 2015 17:54:55 +0000 Subject: [undertow-dev] Access JBoss MSC service from ServletExtension In-Reply-To: References: Message-ID: On Jan 23, 2015, at 12:17 PM, Toma? Cerar > wrote: Other option would be to write proper WildFly extension which is bit more work. take a look at https://docs.jboss.org/author/display/WFLY8/Extending+WildFly+8 for how to do that. Perhaps I wasn?t clear in my original message. I have written a proper Wildfly extension. It uses a DeploymentProcessor to observe deployments and participates and in the management model to create/configure the services needed for the authentication and authorization mechanisms I wish to support. I am using an Undertow ServletExtension so that I can augment the authentication mechanisms supported by Undertow with my own mechanism. What I?m unclear on how to accomplish is how to get a reference to the services I have created in my Wildfly extension from within the implementation of my Undertow authentication mechanism and associated identity manager. Thanks for any tips/advice. ? Carl Harris Chief Technology Architect Virginia Tech -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150123/56d1954f/attachment.html From tomaz.cerar at gmail.com Fri Jan 23 13:25:15 2015 From: tomaz.cerar at gmail.com (=?UTF-8?B?VG9tYcW+IENlcmFy?=) Date: Fri, 23 Jan 2015 19:25:15 +0100 Subject: [undertow-dev] Access JBoss MSC service from ServletExtension In-Reply-To: References: Message-ID: if you do have proper extension, than it is simple :) You could create your servletExtension as part of your deployment processor, where you can lookup service registry by calling deploymentUnit.getServiceRegistry() and lookup service from there. once you have created your servletextension with the data from your service just pass that servlet extension instance to attachment list. deploymentUnit.addToAttachmentList(UndertowAttachments.UNDERTOW_SERVLET_EXTENSIONS, your servlet extension); this way your exact instance will be used, no need for registering it as service in meta-inf... hope this helps, tomaz On Fri, Jan 23, 2015 at 6:54 PM, Harris, Carl wrote: > On Jan 23, 2015, at 12:17 PM, Toma? Cerar wrote: > > Other option would be to write proper WildFly extension which is bit > more work. > take a look at > https://docs.jboss.org/author/display/WFLY8/Extending+WildFly+8 > for how to do that. > > > Perhaps I wasn?t clear in my original message. I have written a proper > Wildfly extension. It uses a DeploymentProcessor to observe deployments > and participates and in the management model to create/configure the > services needed for the authentication and authorization mechanisms I wish > to support. > > I am using an Undertow ServletExtension so that I can augment the > authentication mechanisms supported by Undertow with my own mechanism. > > What I?m unclear on how to accomplish is how to get a reference to the > services I have created in my Wildfly extension from within the > implementation of my Undertow authentication mechanism and associated > identity manager. > > Thanks for any tips/advice. > > > ? > Carl Harris > Chief Technology Architect > Virginia Tech > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150123/236c9ad1/attachment.html From sdouglas at redhat.com Fri Jan 23 21:22:15 2015 From: sdouglas at redhat.com (Stuart Douglas) Date: Fri, 23 Jan 2015 21:22:15 -0500 (EST) Subject: [undertow-dev] Access JBoss MSC service from ServletExtension In-Reply-To: References: Message-ID: <1502159775.3500.1422066135252.JavaMail.zimbra@redhat.com> org.jboss.as.server.CurrentServiceContainer#getServiceContainer() lets you get a reference to the container, which you can then use to look up the services by name. You should make sure that the web deployment has a dependency on these services, just to make sure they are there when you look them up. Stuart ----- Original Message ----- > From: "Carl Harris" > To: "Toma? Cerar" > Cc: undertow-dev at lists.jboss.org > Sent: Friday, 23 January, 2015 9:54:55 PM > Subject: Re: [undertow-dev] Access JBoss MSC service from ServletExtension > > On Jan 23, 2015, at 12:17 PM, Toma? Cerar < tomaz.cerar at gmail.com > wrote: > > > > Other option would be to write proper WildFly extension which is bit more > work. > take a look at > https://docs.jboss.org/author/display/WFLY8/Extending+WildFly+8 > for how to do that. > > Perhaps I wasn?t clear in my original message. I have written a proper > Wildfly extension. It uses a DeploymentProcessor to observe deployments and > participates and in the management model to create/configure the services > needed for the authentication and authorization mechanisms I wish to > support. > > I am using an Undertow ServletExtension so that I can augment the > authentication mechanisms supported by Undertow with my own mechanism. > > What I?m unclear on how to accomplish is how to get a reference to the > services I have created in my Wildfly extension from within the > implementation of my Undertow authentication mechanism and associated > identity manager. > > Thanks for any tips/advice. > > > ? > Carl Harris > Chief Technology Architect > Virginia Tech > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From bikash.gupta11 at gmail.com Sat Jan 31 23:52:34 2015 From: bikash.gupta11 at gmail.com (Bikash Gupta) Date: Sun, 1 Feb 2015 10:22:34 +0530 Subject: [undertow-dev] Multi Part Reuest Issue in Undertow for Wildfly 8.2.0.Final Message-ID: I have migrated my application from Jboss AS 7.1.1.Final to WildFly 8.2.0.Final where I have used Primeface 5, Shiro and Rewrite 2.0.12. Due to this migration my upload has stopped working. Based on the comments in Rewrite Forum( http://www.ocpsoft.org/support/topic/command-not-fired-with-multipart-form-jsf-2-2/), I have replaced undertow module jar with latest version undertow-core-1.2.0.Beta9.jar undertow-servlet-1.2.0.Beta9.jar undertow-websockets-jsr-1.2.0.Beta9.jar Still the upload is not working. As suggested in other forums I have also tried custom FileUploadFilter for MultiPartReuest. Still no luck. Please suggest!!! -- Regards Biks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150201/38cd67c4/attachment.html