[Bug 43968] [patch] support ipv6 with mod_jk
https://issues.apache.org/bugzilla/show_bug.cgi?id=43968 --- Comment #10 from Mladen Turk --- I'm going to work on this feature this and next week, so hopefully we'll have IPV6 support inside mod_jk. First thing is that APR should be used for name resolution whenever present, so this means that the provided patch removing APR support completely will have to be modified. Next thing is how to preserve backward compatibility for existing configurations where IPV4 is preferred over IPV6 when resolving hostnames. There are two options. a) have worker.name.hostname6 = localhost b) have worker.name.hostname = ::localhost In case there is a colon inside name (eg. ::1) use IPV6 Beside that most of the Eiji's patch can be reused. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
JK support for IPV6
Hi, I'll be working on IPV6 support for mod_jk so hopefully we'll have a working solution next week. There is a patch in that direction (bz #44290) but it has few problems. Patch removes using APR, but that's easily solvable. However major question is how to preserve existing configuration backward compatibility where IPV4 is favored over IPV6. In part of comment to #44290 I gave two options a) Have a new worker attribute worker.name.hostname6 = b) Use double colon in front of hostname worker.name.hostame = ::my-ipv6-server For numeric hostnames that easy by just parsing hexadecimal + colon for IPV6 and decimal + dot for IPV6 WDYT? Next, do we need something for java side? Are the java connectors capable of listening to IPV6 addresses? Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1519948 - in /tomcat/trunk/modules/jdbc-pool: doc/ src/main/java/org/apache/tomcat/jdbc/pool/ src/main/java/org/apache/tomcat/jdbc/pool/jmx/
Author: kfujino Date: Wed Sep 4 08:56:24 2013 New Revision: 1519948 URL: http://svn.apache.org/r1519948 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55343 Add flag to ignore error of connection creation while initializing the pool. Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=1519948&r1=1519947&r2=1519948&view=diff == --- tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original) +++ tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Wed Sep 4 08:56:24 2013 @@ -492,6 +492,13 @@ (boolean) Set this to true to propagate the interrupt state for a thread that has been interrupted (not clearing the interrupt state). Default value is false for backwards compatibility. + + (boolean) Flag whether ignore error of connection creation while initializing the pool. + Set to true if you want to ignore error of connection creation while initializing the pool. + Set to false if you want to fail the initialization of the pool by throwing exception. + The default value is false. + + Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1519948&r1=1519947&r2=1519948&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Wed Sep 4 08:56:24 2013 @@ -487,9 +487,12 @@ public class ConnectionPool { } //for } catch (SQLException x) { -if (jmxPool!=null) jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_INIT, getStackTrace(x)); -close(true); -throw x; +log.error("Unable to create initial connections of pool.", x); +if (!poolProperties.isIgnoreExceptionOnPreLoad()) { +if (jmxPool!=null) jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_INIT, getStackTrace(x)); +close(true); +throw x; +} } finally { //return the members as idle to the pool for (int i = 0; i < initialPool.length; i++) { Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java?rev=1519948&r1=1519947&r2=1519948&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java Wed Sep 4 08:56:24 2013 @@ -122,6 +122,8 @@ public class DataSourceFactory implement protected static final String PROP_PROPAGATEINTERRUPTSTATE = "propagateInterruptState"; +protected static final String PROP_IGNOREEXCEPTIONONPRELOAD = "ignoreExceptionOnPreLoad"; + public static final int UNKNOWN_TRANSACTIONISOLATION = -1; public static final String OBJECT_NAME = "object_name"; @@ -175,7 +177,8 @@ public class DataSourceFactory implement PROP_ROLLBACKONRETURN, PROP_USEDISPOSABLECONNECTIONFACADE, PROP_LOGVALIDATIONERRORS, -PROP_PROPAGATEINTERRUPTSTATE +PROP_PROPAGATEINTERRUPTSTATE, +PROP_IGNOREEXCEPTIONONPRELOAD }; // -- ObjectFactory Methods @@ -514,6 +517,11 @@ public class DataSourceFactory implement poolProperties.setPropagateInterruptState(Boolean.parseBoolean(value)); } +value = properties.getProperty(PROP_IGNOREEXCEPTIONONPRELOAD); +if (value != null) { + poolProperties.setIgnoreExceptionOnPreLoad(Boolean.parseBoolean(value)); +}
svn commit: r1519949 - in /tomcat/tc7.0.x/trunk: modules/jdbc-pool/doc/ modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ we
Author: kfujino Date: Wed Sep 4 09:01:22 2013 New Revision: 1519949 URL: http://svn.apache.org/r1519949 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55343 Add flag to ignore error of connection creation while initializing the pool. Modified: tomcat/tc7.0.x/trunk/modules/jdbc-pool/doc/jdbc-pool.xml tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/modules/jdbc-pool/doc/jdbc-pool.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=1519949&r1=1519948&r2=1519949&view=diff == --- tomcat/tc7.0.x/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original) +++ tomcat/tc7.0.x/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Wed Sep 4 09:01:22 2013 @@ -495,6 +495,13 @@ (boolean) Set this to true to propagate the interrupt state for a thread that has been interrupted (not clearing the interrupt state). Default value is false for backwards compatibility. + + (boolean) Flag whether ignore error of connection creation while initializing the pool. + Set to true if you want to ignore error of connection creation while initializing the pool. + Set to false if you want to fail the initialization of the pool by throwing exception. + The default value is false. + + Modified: tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1519949&r1=1519948&r2=1519949&view=diff == --- tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Wed Sep 4 09:01:22 2013 @@ -487,9 +487,12 @@ public class ConnectionPool { } //for } catch (SQLException x) { -if (jmxPool!=null) jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_INIT, getStackTrace(x)); -close(true); -throw x; +log.error("Unable to create initial connections of pool.", x); +if (!poolProperties.isIgnoreExceptionOnPreLoad()) { +if (jmxPool!=null) jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_INIT, getStackTrace(x)); +close(true); +throw x; +} } finally { //return the members as idle to the pool for (int i = 0; i < initialPool.length; i++) { Modified: tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java?rev=1519949&r1=1519948&r2=1519949&view=diff == --- tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java (original) +++ tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java Wed Sep 4 09:01:22 2013 @@ -122,6 +122,8 @@ public class DataSourceFactory implement protected static final String PROP_PROPAGATEINTERRUPTSTATE = "propagateInterruptState"; +protected static final String PROP_IGNOREEXCEPTIONONPRELOAD = "ignoreExceptionOnPreLoad"; + public static final int UNKNOWN_TRANSACTIONISOLATION = -1; public static final String OBJECT_NAME = "object_name"; @@ -175,7 +177,8 @@ public class DataSourceFactory implement PROP_ROLLBACKONRETURN, PROP_USEDISPOSABLECONNECTIONFACADE, PROP_LOGVALIDATIONERRORS, -PROP_PROPAGATEINTERRUPTSTATE +PROP_PROPAGATEINTERRUPTSTATE, +PROP_IGNOREEXCEPTIONONPRELOAD }; // -- ObjectFactory Methods @@ -514,6 +517,11 @@ public class DataSourceFactory implement poolProperties.setPropagateInterruptState(Boolean.parseBoolean(value));
[Bug 55343] Add flag to ignore exceptions while creating initial pool
https://issues.apache.org/bugzilla/show_bug.cgi?id=55343 Keiichi Fujino changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #1 from Keiichi Fujino --- Fixed in trunk and 7.0.x and will be included in 7.0.43 onwards. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1519951 - /tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
Author: markt Date: Wed Sep 4 09:10:35 2013 New Revision: 1519951 URL: http://svn.apache.org/r1519951 Log: Correct comment Fix some whitespace formatting Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java?rev=1519951&r1=1519950&r2=1519951&view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java Wed Sep 4 09:10:35 2013 @@ -190,7 +190,7 @@ public class InternalNioOutputBuffer ext // Keep writing until all the data is written or a non-blocking write // leaves data in the buffer -while (!dataLeft && length>0) { +while (!dataLeft && length > 0) { int thisTime = transfer(buf,offset,length,socket.getBufHandler().getWriteBuffer()); length = length - thisTime; offset = offset + thisTime; @@ -204,11 +204,10 @@ public class InternalNioOutputBuffer ext } NioEndpoint.KeyAttachment ka = (NioEndpoint.KeyAttachment)socket.getAttachment(false); -if ( ka!= null ) ka.access();//prevent timeouts for just doing client writes +if (ka != null) ka.access();//prevent timeouts for just doing client writes -if (!isBlocking() && length>0) { -//we must buffer as long as it fits -//ByteBufferHolder tail = bufferedWrite. +if (!isBlocking() && length > 0) { +// Remaining data must be buffered addToBuffers(buf, offset, length); } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1519952 - /tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
Author: markt Date: Wed Sep 4 09:12:08 2013 New Revision: 1519952 URL: http://svn.apache.org/r1519952 Log: Fix comment typo Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1519952&r1=1519951&r2=1519952&view=diff == --- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Wed Sep 4 09:12:08 2013 @@ -1338,7 +1338,7 @@ public abstract class AbstractAjpProcess swallowResponse = true; } -// Responses to HEAD requests are not permitted to incude a response +// Responses to HEAD requests are not permitted to include a response // body. MessageBytes methodMB = request.method(); if (methodMB.equals("HEAD")) { @@ -1495,8 +1495,7 @@ public abstract class AbstractAjpProcess * Write chunk. */ @Override -public int doWrite(ByteChunk chunk, Response res) -throws IOException { +public int doWrite(ByteChunk chunk, Response res) throws IOException { if (!response.isCommitted()) { // Validate and write response headers - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 55521] New: Race Condition in HttpSession#invalidate() / HttpServletRequest#getSession(boolean)
https://issues.apache.org/bugzilla/show_bug.cgi?id=55521 Bug ID: 55521 Summary: Race Condition in HttpSession#invalidate() / HttpServletRequest#getSession(boolean) Product: Tomcat 7 Version: 7.0.40 Hardware: PC OS: All Status: NEW Severity: normal Priority: P2 Component: Servlet & JSP API Assignee: dev@tomcat.apache.org Reporter: christoph.lud...@haufe-lexware.com Created attachment 30798 --> https://issues.apache.org/bugzilla/attachment.cgi?id=30798&action=edit code flow that exhibits the race condition For session fixation protection, we have to discard a user's session and create a new one whenever the user's login state changes. For this we rely on Spring Security's SessionFixationProtectionStrategy that, at its core, uses the following commands: session.invalidate(); session = request.getSession(true); Yesterday, we had a message in the log that indicates the latter command returned the same session that was invalidated in the line before: "Your servlet container did not change the session ID when a new session was created. You will not be adequately protected against session-fixation attacks (catalina-exec-339, org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy, SessionFixationProtectionStrategy.java:102)" When I investigated this issue, I found there is in fact a race condition if two threads (associated with requests from the same client) enter the session fixation protection code in parallel. I attached a TXT file that illustrates the code flow that leads to the race condition: When thread B calls session.invalidate(), the call returns immediately becuase the session is already in the "expiring" state. Since the session is not invalid yet, the call to request.getSession(true) won't create a new session, though. So in effect, thread B cannot obtain a new session. The documentation at http://tomcat.apache.org/tomcat-7.0-doc/servletapi/ has no indication that a session may not yet be invalid when session.invalidate() returns. The session interface neither provides a way to detect "expiring" session. The error message appears only once in the production log files that go some weeks back, so it seems to be an infrequent event. Nevertheless, it should be possible to implement session fixation without a race condition. Regards Christoph -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: JK support for IPV6
On 09/04/2013 09:31 AM, Mladen Turk wrote: Next, do we need something for java side? Are the java connectors capable of listening to IPV6 addresses? According to the tests I did months ago they did work. Cheers Jean-Frederic - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1519991 - in /tomcat/trunk/java/org/apache/tomcat/util/net: AbstractEndpoint.java AprEndpoint.java JIoEndpoint.java NioEndpoint.java
Author: markt Date: Wed Sep 4 12:14:02 2013 New Revision: 1519991 URL: http://svn.apache.org/r1519991 Log: Fix possible memory leak with NIO when executor needs to create a new thread. Pull up common code. Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1519991&r1=1519990&r2=1519991&view=diff == --- tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java Wed Sep 4 12:14:02 2013 @@ -20,6 +20,7 @@ import java.io.File; import java.io.OutputStreamWriter; import java.net.InetAddress; import java.net.InetSocketAddress; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.HashMap; import java.util.StringTokenizer; @@ -94,6 +95,23 @@ public abstract class AbstractEndpoint { + +private ClassLoader cl; + +PrivilegedSetTccl(ClassLoader cl) { +this.cl = cl; +} + +@Override +public Void run() { +Thread.currentThread().setContextClassLoader(cl); +return null; +} +} + + private static final int INITIAL_ERROR_DELAY = 50; private static final int MAX_ERROR_DELAY = 1600; Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1519991&r1=1519990&r2=1519991&view=diff == --- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Sep 4 12:14:02 2013 @@ -2300,20 +2300,4 @@ public class AprEndpoint extends Abstrac super(socket); } } - - -private static class PrivilegedSetTccl implements PrivilegedAction { - -private ClassLoader cl; - -PrivilegedSetTccl(ClassLoader cl) { -this.cl = cl; -} - -@Override -public Void run() { -Thread.currentThread().setContextClassLoader(cl); -return null; -} -} } Modified: tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java?rev=1519991&r1=1519990&r2=1519991&view=diff == --- tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java Wed Sep 4 12:14:02 2013 @@ -607,20 +607,4 @@ public class JIoEndpoint extends Abstrac protected Log getLog() { return log; } - -private static class PrivilegedSetTccl implements PrivilegedAction { - -private ClassLoader cl; - -PrivilegedSetTccl(ClassLoader cl) { -this.cl = cl; -} - -@Override -public Void run() { -Thread.currentThread().setContextClassLoader(cl); -return null; -} -} - } Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1519991&r1=1519990&r2=1519991&view=diff == --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Sep 4 12:14:02 2013 @@ -32,6 +32,8 @@ import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.nio.channels.WritableByteChannel; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Iterator; import java.util.Set; import java.util.concurrent.CountDownLatch; @@ -626,8 +628,30 @@ public class NioEndpoint extends Abstrac SocketProcessor sc = processorCache.pop(); if ( sc == null ) sc = new SocketProcessor(socket,status); else sc.reset(socket,status); -if ( dispatch && getExecutor()!=null ) getExecutor().execute(sc); -else sc.run(); +if (dispatch && getExecutor() != null) { +ClassLoader loader = Thread.currentThread().getContextClassLoader(); +try { +//threads should not be created by the webapp classloader +if
svn commit: r1519994 - in /tomcat/trunk/java/org/apache/coyote/ajp: AbstractAjpProcessor.java AjpAprProcessor.java AjpNioProcessor.java AjpProcessor.java
Author: markt Date: Wed Sep 4 12:33:42 2013 New Revision: 1519994 URL: http://svn.apache.org/r1519994 Log: Add some plumbing for non-blocking writes to the AJP connectors. There is no functional change. All writes remain blocking. Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1519994&r1=1519993&r2=1519994&view=diff == --- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Wed Sep 4 12:33:42 2013 @@ -672,7 +672,7 @@ public abstract class AbstractAjpProcess } cping = true; try { -output(pongMessageArray, 0, pongMessageArray.length); +output(pongMessageArray, 0, pongMessageArray.length, true); } catch (IOException e) { error = true; } @@ -855,8 +855,8 @@ public abstract class AbstractAjpProcess protected abstract void resetTimeouts(); // Methods called by prepareResponse() -protected abstract void output(byte[] src, int offset, int length) -throws IOException; +protected abstract int output(byte[] src, int offset, int length, +boolean block) throws IOException; // Methods called by process() protected abstract void setupSocket(SocketWrapper socketWrapper) @@ -1002,7 +1002,7 @@ public abstract class AbstractAjpProcess // Request more data immediately if (!first && !waitingForBodyMessage) { -output(getBodyMessageArray, 0, getBodyMessageArray.length); +output(getBodyMessageArray, 0, getBodyMessageArray.length, true); waitingForBodyMessage = true; } @@ -1397,8 +1397,7 @@ public abstract class AbstractAjpProcess // Write to buffer responseMessage.end(); -output(responseMessage.getBuffer(), 0, -responseMessage.getLen()); +output(responseMessage.getBuffer(), 0, responseMessage.getLen(), true); } @@ -1408,7 +1407,7 @@ public abstract class AbstractAjpProcess protected void flush(boolean explicit) throws IOException { if (explicit && !finished) { // Send the flush message -output(flushMessageArray, 0, flushMessageArray.length); +output(flushMessageArray, 0, flushMessageArray.length, true); } } @@ -1440,9 +1439,9 @@ public abstract class AbstractAjpProcess // Add the end message if (error) { -output(endAndCloseMessageArray, 0, endAndCloseMessageArray.length); +output(endAndCloseMessageArray, 0, endAndCloseMessageArray.length, true); } else { -output(endMessageArray, 0, endMessageArray.length); +output(endMessageArray, 0, endMessageArray.length, true); } } @@ -1523,7 +1522,7 @@ public abstract class AbstractAjpProcess responseMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK); responseMessage.appendBytes(chunk.getBytes(), chunk.getOffset() + off, thisTime); responseMessage.end(); -output(responseMessage.getBuffer(), 0, responseMessage.getLen()); +output(responseMessage.getBuffer(), 0, responseMessage.getLen(), true); off += thisTime; } Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1519994&r1=1519993&r2=1519994&view=diff == --- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Wed Sep 4 12:33:42 2013 @@ -24,6 +24,7 @@ import java.util.concurrent.locks.Reentr import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.jni.Socket; +import org.apache.tomcat.jni.Status; import org.apache.tomcat.util.net.AprEndpoint; import org.apache.tomcat.util.net.SocketWrapper; @@ -102,22 +103,32 @@ public class AjpAprProcessor extends Abs @Override -protected void output(byte[] src, int offset, int length) +protected int output(byte[] src, int offset, int length, boolean block) throws IOException { + +if (length == 0) { +
Re: svn commit: r1519804 - /tomcat/trunk/build.xml
2013/9/4 Konstantin Kolinko : > 2013/9/3 : >> Author: markt >> Date: Tue Sep 3 19:26:17 2013 >> New Revision: 1519804 >> >> URL: http://svn.apache.org/r1519804 >> Log: >> Tomcat only uses package-info.java files for Javadoc so don't bother >> creating empty class files from them. >> >> Modified: >> tomcat/trunk/build.xml >> > > 1. Docs [1] say that those files are created so that Ant will stop > recompiling them. > > Beware that re-compilation time may increase. > Another solution could be to filter out those unwanted class files when packing a jar. > 2. The createMissingPackageInfoClass option is @since Ant 1.8.3. > > BUILDING.txt for trunk says that we require Ant 1.8.x. > I think it is the time to update that. > My opinion is that we may say that we require 1.9.2 (the current > version of Ant). > > [1] http://ant.apache.org/manual/Tasks/javac.html Best regards, Konstantin Kolinko >> Modified: tomcat/trunk/build.xml >> URL: >> http://svn.apache.org/viewvc/tomcat/trunk/build.xml?rev=1519804&r1=1519803&r2=1519804&view=diff >> == >> --- tomcat/trunk/build.xml (original) >> +++ tomcat/trunk/build.xml Tue Sep 3 19:26:17 2013 >> @@ -611,7 +611,8 @@ >> optimize="${compile.optimize}" >> excludes="**/.svn/**" >> encoding="ISO-8859-1" >> - includeAntRuntime="true" > >> + includeAntRuntime="true" >> + createMissingPackageInfoClass="false" > >> >> >> >> - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: JK support for IPV6
2013/9/4 Mladen Turk : > Hi, > > I'll be working on IPV6 support for mod_jk so hopefully we'll have > a working solution next week. > > There is a patch in that direction (bz #44290) but it has few problems. > Patch removes using APR, but that's easily solvable. > However major question is how to preserve existing configuration > backward compatibility where IPV4 is favored over IPV6. > > In part of comment to #44290 I gave two options > > a) Have a new worker attribute >worker.name.hostname6 = > b) Use double colon in front of hostname >worker.name.hostame = ::my-ipv6-server > > For numeric hostnames that easy by just parsing > hexadecimal + colon for IPV6 and decimal + dot for IPV6 > > > WDYT? > > Next, do we need something for java side? Are the java connectors > capable of listening to IPV6 addresses? > I wonder how others, e.g. httpd, deal with this. From a quick look, there are no 'v6' directives. 'Listen' directive accepts either IPv4 or IPv6 address, with latter one always having a pair of square brackets. http://httpd.apache.org/docs/2.4/mod/mpm_common.html#listen > Listen 192.170.2.1:80 > Listen [2001:db8::a00:20ff:fea7:ccea]:80 mod_proxy can use hostnames (e.g. in BalancerMember directive), but there are no IPv6 examples there. If an IP address is used then it should be clear whether it is an IPv4 or IPv6 one. (I think IPv6 IP addresses should be in square brackets, per RFC3986) An ambiguity is only if a hostname is used. Do you propose the prefix for hostnames only, not numeric IP addresses? Best regards, Konstantin Kolinko - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
buildbot failure in ASF Buildbot on tomcat-trunk
The Buildbot has detected a new failure on builder tomcat-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-trunk/builds/4924 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/trunk] 1519994 Blamelist: markt BUILD FAILED: failed compile_1 sincerely, -The Buildbot
svn commit: r1520027 - /tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
Author: markt Date: Wed Sep 4 14:12:48 2013 New Revision: 1520027 URL: http://svn.apache.org/r1520027 Log: Calculate the maximum output chunk size when the processor is created. Since it won't change, there is no need to re-calculate it every time there is some output to write. Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1520027&r1=1520026&r2=1520027&view=diff == --- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Wed Sep 4 14:12:48 2013 @@ -140,7 +140,7 @@ public abstract class AbstractAjpProcess /** * AJP packet size. */ -protected final int packetSize; +private final int outputMaxChunkSize; /** * Header message. Note that this header is merely the one used during the @@ -248,7 +248,10 @@ public abstract class AbstractAjpProcess super(endpoint); -this.packetSize = packetSize; +// Calculate maximum chunk size as packetSize may have been changed from +// the default (Constants.MAX_PACKET_SIZE) +this.outputMaxChunkSize = +Constants.MAX_SEND_SIZE + packetSize - Constants.MAX_PACKET_SIZE; request.setInputBuffer(new SocketInputBuffer()); @@ -1509,13 +1512,11 @@ public abstract class AbstractAjpProcess if (!swallowResponse) { int len = chunk.getLength(); // 4 - hardcoded, byte[] marshaling overhead -// Adjust allowed size if packetSize != default (Constants.MAX_PACKET_SIZE) -int chunkSize = Constants.MAX_SEND_SIZE + packetSize - Constants.MAX_PACKET_SIZE; int off = 0; while (len > 0) { int thisTime = len; -if (thisTime > chunkSize) { -thisTime = chunkSize; +if (thisTime > outputMaxChunkSize) { +thisTime = outputMaxChunkSize; } len -= thisTime; responseMessage.reset(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
buildbot success in ASF Buildbot on tomcat-trunk
The Buildbot has detected a restored build on builder tomcat-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-trunk/builds/4925 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/trunk] 1520027 Blamelist: markt Build succeeded! sincerely, -The Buildbot
Re: JK support for IPV6
On 09/04/2013 03:30 PM, Konstantin Kolinko wrote: 2013/9/4 Mladen Turk : For numeric hostnames that easy by just parsing hexadecimal + colon for IPV6 and decimal + dot for IPV6 An ambiguity is only if a hostname is used. Do you propose the prefix for hostnames only, not numeric IP addresses? Yes, only hostnames. In other case upgrading mod_jk could cause using IPV6 suddenly. Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: JK support for IPV6
On 09/04/2013 03:30 PM, Konstantin Kolinko wrote: An ambiguity is only if a hostname is used. Do you propose the prefix for hostnames only, not numeric IP addresses? There is also one other option and that is to always resolve to IPV4 address if both IPV4 and IPV6 have same hostname entry. We can then add directive worker.foo.prefer-ipv6 = 1 This would cause to use first IPV6 address if found. In case hostname has either IPV4 or IPV6 address only that one would be used. This way no prefix would be needed and backward compatibility will be preserved. Regards -- ^TM - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1520069 - /tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
Author: markt Date: Wed Sep 4 17:07:04 2013 New Revision: 1520069 URL: http://svn.apache.org/r1520069 Log: Add a note to flush() Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1520069&r1=1520068&r2=1520069&view=diff == --- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Wed Sep 4 17:07:04 2013 @@ -1408,6 +1408,9 @@ public abstract class AbstractAjpProcess * Callback to write data from the buffer. */ protected void flush(boolean explicit) throws IOException { +// Calling code should ensure that there is no data in the buffers for +// non-blocking writes. +// TODO Validate the assertion above if (explicit && !finished) { // Send the flush message output(flushMessageArray, 0, flushMessageArray.length, true); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1520145 - /tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
Author: markt Date: Wed Sep 4 21:15:33 2013 New Revision: 1520145 URL: http://svn.apache.org/r1520145 Log: Add some plumbing with a view to supporting non-blocking writes. Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1520145&r1=1520144&r2=1520145&view=diff == --- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Wed Sep 4 21:15:33 2013 @@ -158,6 +158,13 @@ public abstract class AbstractAjpProcess /** + * Location of next write of the response message (used withnon-blocking + * writes when the message may not be written in a single write). Avalue of + * -1 indicates that no message has been written to the buffer. + */ +private int responseMsgPos = -1; + +/** * Body message. */ protected final AjpMessage bodyMessage; @@ -1452,6 +1459,25 @@ public abstract class AbstractAjpProcess } +private void writeResponseMessage(boolean block) throws IOException { +int len = responseMessage.getLen(); +int written = 1; +if (responseMsgPos == -1) { +// New message. Advance the write position to the beginning +responseMsgPos = 0; +} + +while (written > 0 && responseMsgPos < len) { +written = output( +responseMessage.getBuffer(), responseMsgPos, len, block); +responseMsgPos += written; +} + +if (responseMsgPos == len) { +responseMsgPos = -1; +} +} + // - InputStreamInputBuffer Inner Class @@ -1526,7 +1552,7 @@ public abstract class AbstractAjpProcess responseMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK); responseMessage.appendBytes(chunk.getBytes(), chunk.getOffset() + off, thisTime); responseMessage.end(); -output(responseMessage.getBuffer(), 0, responseMessage.getLen(), true); +writeResponseMessage(true); off += thisTime; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 55524] New: Deadlock produced during Websocket write operation (org.apache.catalina.websocket.WsOutbound)
https://issues.apache.org/bugzilla/show_bug.cgi?id=55524 Bug ID: 55524 Summary: Deadlock produced during Websocket write operation (org.apache.catalina.websocket.WsOutbound) Product: Tomcat 7 Version: 7.0.42 Hardware: PC OS: Linux Status: NEW Severity: blocker Priority: P2 Component: Servlet & JSP API Assignee: dev@tomcat.apache.org Reporter: confi...@googlemail.com Created attachment 30800 --> https://issues.apache.org/bugzilla/attachment.cgi?id=30800&action=edit thread dump of the deadlock I use Tomcat with an application that uses Websockets. The websockets are handled by the Atmosphere framework: https://github.com/Atmosphere/atmosphere A deadlock occurs during write operations to the websocket. I have attached a thread dump of the deadlock. This issue is also duscussed here: https://github.com/Atmosphere/atmosphere/issues/1264 Here are the deadlocked threads: Found one Java-level deadlock: = "Atmosphere-Shared-AsyncOp-267": waiting to lock monitor 0x7efebc0015f8 (object 0x0005ef4c6988, a org.apache.catalina.websocket.WsOutbound), which is held by "Atmosphere-Scheduler-2" "Atmosphere-Scheduler-2": waiting to lock monitor 0x7efe8c290ac0 (object 0x0005ef4b77f8, a org.atmosphere.cpr.AtmosphereResourceImpl), which is held by "Atmosphere-Shared-AsyncOp-267" Java stack information for the threads listed above: === "Atmosphere-Shared-AsyncOp-267": at org.apache.catalina.websocket.WsOutbound.writeTextMessage(WsOutbound.java:165) - waiting to lock <0x0005ef4c6988> (a org.apache.catalina.websocket.WsOutbound) at org.atmosphere.container.version.TomcatWebSocket.write(TomcatWebSocket.java:49) at org.atmosphere.websocket.WebSocket.write(WebSocket.java:199) at org.atmosphere.websocket.WebSocket.write(WebSocket.java:168) at org.atmosphere.websocket.WebSocket.write(WebSocket.java:40) at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:574) at org.atmosphere.handler.AbstractReflectorAtmosphereHandler.onStateChange(AbstractReflectorAtmosphereHandler.java:169) at org.atmosphere.cpr.DefaultBroadcaster.invokeOnStateChange(DefaultBroadcaster.java:1027) at org.atmosphere.cpr.DefaultBroadcaster.prepareInvokeOnStateChange(DefaultBroadcaster.java:1047) at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:921) at org.atmosphere.cpr.DefaultBroadcaster$3.run(DefaultBroadcaster.java:580) - locked <0x0005ef4b77f8> (a org.atmosphere.cpr.AtmosphereResourceImpl) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) 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:724) "Atmosphere-Scheduler-2": at org.atmosphere.cpr.AsynchronousProcessor.completeLifecycle(AsynchronousProcessor.java:476) - waiting to lock <0x0005ef4b77f8> (a org.atmosphere.cpr.AtmosphereResourceImpl) at org.atmosphere.cpr.AsynchronousProcessor.timedout(AsynchronousProcessor.java:437) at org.atmosphere.cpr.AsynchronousProcessor$AsynchronousProcessorHook.timedOut(AsynchronousProcessor.java:633) at org.atmosphere.websocket.DefaultWebSocketProcessor.close(DefaultWebSocketProcessor.java:483) at org.atmosphere.container.TomcatWebSocketHandler.onClose(TomcatWebSocketHandler.java:80) at org.apache.catalina.websocket.StreamInbound.doOnClose(StreamInbound.java:222) at org.apache.catalina.websocket.WsOutbound.doWriteBytes(WsOutbound.java:423) at org.apache.catalina.websocket.WsOutbound.doWriteText(WsOutbound.java:442) at org.apache.catalina.websocket.WsOutbound.writeTextMessage(WsOutbound.java:174) - locked <0x0005ef4c6988> (a org.apache.catalina.websocket.WsOutbound) at org.atmosphere.container.version.TomcatWebSocket.write(TomcatWebSocket.java:49) at org.atmosphere.websocket.WebSocket.write(WebSocket.java:199) at org.atmosphere.websocket.WebSocket.write(WebSocket.java:168) at org.atmosphere.websocket.WebSocket.write(WebSocket.java:40) at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:574) at org.atmosphere.cpr.AtmosphereResponse.write(AtmosphereResponse.java:992) at org.atmosphere.interceptor.HeartbeatInterceptor$1$1.call(HeartbeatInterceptor.java:104) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThr