svn commit: r1358057 - in /tomcat/trunk: java/org/apache/catalina/connector/Connector.java webapps/docs/changelog.xml webapps/docs/config/http.xml

2012-07-06 Thread fhanik
Author: fhanik
Date: Fri Jul  6 07:01:22 2012
New Revision: 1358057

URL: http://svn.apache.org/viewvc?rev=1358057view=rev
Log:
Change the default connector for Tomcat 8

Modified:
tomcat/trunk/java/org/apache/catalina/connector/Connector.java
tomcat/trunk/webapps/docs/changelog.xml
tomcat/trunk/webapps/docs/config/http.xml

Modified: tomcat/trunk/java/org/apache/catalina/connector/Connector.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Connector.java?rev=1358057r1=1358056r2=1358057view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/Connector.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Connector.java Fri Jul  6 
07:01:22 2012
@@ -551,7 +551,7 @@ public class Connector extends Lifecycle
  */
 public String getProtocol() {
 
-if (org.apache.coyote.http11.Http11Protocol.equals
+if (org.apache.coyote.http11.Http11NioProtocol.equals
 (getProtocolHandlerClassName())
 || org.apache.coyote.http11.Http11AprProtocol.equals
 (getProtocolHandlerClassName())) {
@@ -590,7 +590,7 @@ public class Connector extends Lifecycle
 } else {
 if (HTTP/1.1.equals(protocol)) {
 setProtocolHandlerClassName
-(org.apache.coyote.http11.Http11Protocol);
+(org.apache.coyote.http11.Http11NioProtocol);
 } else if (AJP/1.3.equals(protocol)) {
 setProtocolHandlerClassName
 (org.apache.coyote.ajp.AjpProtocol);

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1358057r1=1358056r2=1358057view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Jul  6 07:01:22 2012
@@ -85,6 +85,10 @@
   subsection name=Coyote
 changelog
   scode
+The default connector is now the Java NIO connector 
+even when specifying HTTP/1.1 as protocol (fhanik)
+  /scode
+  scode
 Update default value of pollerThreadCount for the NIO connector.
 The new default value will never go above 2 regardless of
 available processors. (fhanik)

Modified: tomcat/trunk/webapps/docs/config/http.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/http.xml?rev=1358057r1=1358056r2=1358057view=diff
==
--- tomcat/trunk/webapps/docs/config/http.xml (original)
+++ tomcat/trunk/webapps/docs/config/http.xml Fri Jul  6 07:01:22 2012
@@ -157,7 +157,7 @@
 attribute name=protocol required=false
   pSets the protocol to handle incoming traffic. The default value is
 codeHTTP/1.1/code which uses an auto-switching mechanism to select
-either a blocking Java based connector or an APR/native based 
connector.
+either a non blocking Java based connector or an APR/native based 
connector.
 If the codePATH/code (Windows) or codeLD_LIBRARY_PATH/code (on
 most unix systems) environment variables contain the Tomcat native
 library, the APR/native connector will be used. If the native library



-
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

2012-07-06 Thread buildbot
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/3162

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: bb-vm_ubuntu

Build Reason: scheduler
Build Source Stamp: [branch tomcat/trunk] 1358055
Blamelist: fhanik

Build succeeded!

sincerely,
 -The Buildbot




-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: [VOTE] Release Apache Tomcat 7.0.29

2012-07-06 Thread Konstantin Kolinko
2012/7/3 Mark Thomas ma...@apache.org:
 The proposed Apache Tomcat 7.0.29 release is now available for voting.

 It can be obtained from:
 https://dist.apache.org/repos/dist/dev/tomcat/tomcat-7/v7.0.29/
 The Maven staging repo is:
 https://repository.apache.org/content/repositories/orgapachetomcat-014/
 The svn tag is:
 http://svn.apache.org/repos/asf/tomcat/tc7.0.x/tags/TOMCAT_7_0_29/

 The proposed 7.0.29 release is:
 [ ] Broken - do not release
 [x] Stable - go ahead and release as 7.0.29 Stable


Tested on WinXP, JDK 6u33 32-bit.
Running the full testsuite 2 times x BIO,NIO,APR, the only failing test is

org.apache.catalina.loader.TestWebappClassLoaderExecutorMemoryLeak

Out of 6 runs, it succeeded 2 times - with different connectors.
[[[
Testcase: testTimerThreadLeak took 3,328 sec
FAILED
null
junit.framework.AssertionFailedError: null
at 
org.apache.catalina.loader.TestWebappClassLoaderExecutorMemoryLeak.testTimerThreadLeak(TestWebappClassLoaderExecutorMemoryLeak.java:72)
]]]

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1358271 - in /tomcat/trunk/java/org/apache: catalina/connector/CoyoteAdapter.java catalina/core/AsyncContextImpl.java coyote/http11/Http11NioProcessor.java tomcat/util/net/SocketStatus.ja

2012-07-06 Thread fhanik
Author: fhanik
Date: Fri Jul  6 15:40:14 2012
New Revision: 1358271

URL: http://svn.apache.org/viewvc?rev=1358271view=rev
Log:
Add in the ability to catch non blocking read and write errors and propagate 
that to the servlet

Modified:
tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketStatus.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1358271r1=1358270r2=1358271view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Fri Jul  
6 15:40:14 2012
@@ -293,6 +293,22 @@ public class CoyoteAdapter implements Ad
 if (!asyncConImpl.timeout()) {
 asyncConImpl.setErrorState(null);
 }
+} else if (status==SocketStatus.ASYNC_READ_ERROR) {
+success = true;
+Throwable t = 
(Throwable)req.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
+req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION);
+asyncConImpl.notifyReadError(t);
+if (t != null) {
+asyncConImpl.setErrorState(t);
+}
+} else if (status==SocketStatus.ASYNC_WRITE_ERROR) {
+success = true;
+Throwable t = 
(Throwable)req.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
+req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION);
+asyncConImpl.notifyWriteError(t);
+if (t != null) {
+asyncConImpl.setErrorState(t);
+}
 }
 
 

Modified: tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1358271r1=1358270r2=1358271view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Fri Jul  6 
15:40:14 2012
@@ -135,6 +135,32 @@ public class AsyncContextImpl implements
 return true;
 }
 
+public boolean notifyWriteError(Throwable error) {
+if 
(request.getResponse().getCoyoteResponse().getWriteListener()==null) return 
false;
+ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ClassLoader newCL = request.getContext().getLoader().getClassLoader();
+try {
+Thread.currentThread().setContextClassLoader(newCL);
+
request.getResponse().getCoyoteResponse().getWriteListener().onError(error);
+return true;
+} finally {
+Thread.currentThread().setContextClassLoader(oldCL);
+}
+}
+
+public boolean notifyReadError(Throwable error) {
+if (request.getCoyoteRequest().getReadListener()==null) return false;
+ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ClassLoader newCL = request.getContext().getLoader().getClassLoader();
+try {
+Thread.currentThread().setContextClassLoader(newCL);
+request.getCoyoteRequest().getReadListener().onError(error);
+return true;
+} finally {
+Thread.currentThread().setContextClassLoader(oldCL);
+}
+}
+
 public boolean timeout() throws IOException {
 AtomicBoolean result = new AtomicBoolean();
 request.getCoyoteRequest().action(ActionCode.ASYNC_TIMEOUT, result);

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1358271r1=1358270r2=1358271view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Fri Jul  
6 15:40:14 2012
@@ -24,6 +24,7 @@ import java.util.concurrent.atomic.Atomi
 
 import javax.net.ssl.SSLEngine;
 import javax.servlet.ReadListener;
+import javax.servlet.RequestDispatcher;
 import javax.servlet.WriteListener;
 
 import org.apache.coyote.ActionCode;
@@ -192,14 +193,15 @@ public class Http11NioProcessor extends 
 }
 }catch (IOException x) {
 if (log.isDebugEnabled()) log.debug(Unable to write async 
data.,x);
-//TODO FIXME-- fix - so we can 

svn commit: r1358287 - in /tomcat/trunk: java/org/apache/coyote/AsyncStateMachine.java test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java test/org/apache/catalina/startup/TomcatBaseTest.java

2012-07-06 Thread fhanik
Author: fhanik
Date: Fri Jul  6 16:01:36 2012
New Revision: 1358287

URL: http://svn.apache.org/viewvc?rev=1358287view=rev
Log:
Add in test for write error 

Modified:
tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java
tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java
tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java

Modified: tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java?rev=1358287r1=1358286r2=1358287view=diff
==
--- tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java Fri Jul  6 
16:01:36 2012
@@ -296,7 +296,8 @@ public class AsyncStateMachineS {
 
 public synchronized void asyncError() {
 if (state == AsyncState.DISPATCHED ||
-state == AsyncState.TIMING_OUT) {
+state == AsyncState.TIMING_OUT ||
+state == AsyncState.READ_WRITE_OP) {
 state = AsyncState.ERROR;
 } else {
 throw new IllegalStateException(

Modified: 
tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java?rev=1358287r1=1358286r2=1358287view=diff
==
--- tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java 
Fri Jul  6 16:01:36 2012
@@ -16,7 +16,12 @@
  */
 package org.apache.catalina.nonblocking;
 
+import java.io.BufferedInputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
@@ -133,6 +138,69 @@ public class TestNonBlockingAPI extends 
 Assert.assertEquals(HttpServletResponse.SC_OK, rc);
 }
 
+
+@Test
+public void testNonBlockingWriteError() throws Exception {
+String bind = localhost;
+// Configure a context with digest auth and a single protected resource
+Tomcat tomcat = getTomcatInstance();
+// Must have a real docBase - just use temp
+StandardContext ctx = (StandardContext) tomcat.addContext(, 
System.getProperty(java.io.tmpdir));
+
+NBWriteServlet servlet = new NBWriteServlet();
+String servletName = NBWriteServlet.class.getName();
+Wrapper servletWrapper = tomcat.addServlet(ctx, servletName, servlet);
+ctx.addServletMapping(/, servletName);
+tomcat.getConnector().setProperty(socket.txBufSize, 1024);
+tomcat.getConnector().setProperty(address, bind);
+System.out.println(tomcat.getConnector().getProperty(address));
+tomcat.start();
+
+MapString, ListString resHeaders = new HashMapString, 
ListString();
+ByteChunk slowReader = new ByteChunk();
+slowReader.setLimit(1); // FIXME BUFFER IS BROKEN, 0 doesn't work
+slowReader.setByteOutputChannel(new ByteOutputChannel() {
+long counter = 0;
+long delta = 0;
+
+@Override
+public void realWriteBytes(byte[] cbuf, int off, int len) throws 
IOException {
+try {
+if (len == 0)
+return;
+counter += len;
+delta += len;
+if (counter  bytesToDownload) {
+System.out.println(ERROR Downloaded more than 
expected ERROR);
+} else if (counter == bytesToDownload) {
+System.out.println(Download complete( + 
bytesToDownload +  bytes));
+// } else if (counter  (1966086)) {
+// System.out.println(Download almost complete, 
missing bytes (+counter+));
+} else if (delta  (bytesToDownload / 16)) {
+System.out.println(Read  + counter +  bytes.);
+delta = 0;
+Thread.currentThread().sleep(500);
+}
+} catch (Exception x) {
+throw new IOException(x);
+}
+}
+});
+int rc = postUrlWithDisconnect(true, new DataWriter(0), http://; + 
bind + : + getPort() + /, slowReader, resHeaders,
+null);
+slowReader.flushBuffer();
+Assert.assertEquals(HttpServletResponse.SC_OK, rc);
+try {
+//allow the listeners to finish up
+Thread.sleep(1000);
+} catch (Exception e) {
+}
+Assert.assertTrue(Error listener should have been invoked., 

[Bug 53513] Race condition / out of order operation in session replication at node startup

2012-07-06 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53513

gbal...@industrialinfo.com changed:

   What|Removed |Added

 CC||gbal...@industrialinfo.com

-- 
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



[Bug 53498] Atomicity violation bugs because of misusing concurrent collections

2012-07-06 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53498

--- Comment #3 from Yu Lin yu.lin...@gmail.com ---
Hello,

(In reply to comment #2)
 Many thanks for the analysis and patch.
=
You are welcome. 


 Regardless,
 these three are fixed in trunk and 7.0.x and will be included in 7.0.30
 onwards. I used the provided patch as a starting point although I did make
 some changes to make the code a little cleaner.
 
Great.

 The fourth issue is definitely not valid since a Host will never permit
 multiple children with the same name. This change was not included in the
 fix.

I'm not an expert on the domain of Host. Is there some code that creates unique
keys contextName every single time when a thread executes manageApp method?
If not, there could be still an atomicity violation: suppose thread T1 finds
that map deployed doesn't contain key contextName, so it moves to calculate
the value deployedApp. Before T1 puts deployedApp into the map, another
thread T2 checks if deployed map doesn't contain key contextName and so it
moves to create the value deployedApp and put it into the map. Now thread T1
resumes execution and overwrites what T2 previously put.

-- 
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