svn commit: r1579896 - /tomcat/tc6.0.x/trunk/STATUS.txt

2014-03-21 Thread kkolinko
Author: kkolinko
Date: Fri Mar 21 08:35:17 2014
New Revision: 1579896

URL: http://svn.apache.org/r1579896
Log:
votes

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1579896r1=1579895r2=1579896view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Fri Mar 21 08:35:17 2014
@@ -33,7 +33,7 @@ PATCHES PROPOSED TO BACKPORT:
   Prevent user supplied XSLTs used by the DefaultServlet from defining external
   entities.
   
http://people.apache.org/~markt/patches/2014-03-17-globalXsltFile-tc6-v1.patch
-  +1: markt
+  +1: markt, kkolinko
   -1: schultz: The idea of the patch is fine: I'm actually +1.
I have some small nits:
1. DocumentBuilderFactory is not thread-safe, and shouldn't
@@ -41,6 +41,40 @@ PATCHES PROPOSED TO BACKPORT:
when closing File streams. We should at least log a warning.
It looks like there is an opportinity to use StringBuilder
instead of StringBuffer, there, too, if you want.
+  kkolinko:
+Re 1.:
+  The newDocumentBuilder() method is thread safe.
+
+  See JSR 206 (Final Release = JAXP 1.3)
+  https://jcp.org/en/jsr/detail?id=206
+  Ch.3 - Thread Safety
+  [quote]
+ Implementations of the SAXParser, DocumentBuilder, Transformer, 
Validator and Validat
+ orHandler abstract classes are not expected to be thread safe by 
this specification. (...)
+
+ Configuration of a SAXParserFactory, DocumentBuilderFactory 
TransformerFactory or
+ SchemaFactory is also not expected to be thread safe. (...)
+
+ It is expected that the newSAXParser method of a SAXParserFactory 
implementation, the newDocument
+ Builder method of a DocumentBuilderFactory and the newTransformer 
method of a Transformer
+ Factory will be thread safe without side effects. (...)
+
+ Note that Schema is thread safe.
+  [/quote]
+
+Re 2.:
+  Those are input streams that are read, not written. Nothing
+  should really happen when those are closed.
+
+Re StringBuilder:
+  I think it is not of much concern. But if there is any interest,
+  I am proposing a patch below. It is a 4 years old one.
+  -1:
+
+* Use StringBuilder in DefaultServlet
+  Apply only DefaultServlet.java part of the following patch:
+  
https://people.apache.org/~kkolinko/patches/StringBuilder/2009-11-02_StringBuilder_o_a_c_servlets.patch
+  +1: kkolinko
   -1:
 
 * Fix possible overflow when parsing long values from a byte array.
@@ -48,7 +82,8 @@ PATCHES PROPOSED TO BACKPORT:
   +1: markt, kkolinko, schultz
   -1:
 
-* Add Java 8 support to Jasper's default configuration
+* Fix http://issues.apache.org/bugzilla/show_bug.cgi?id=56283
+  Add Java 8 support to Jasper's default configuration
   http://people.apache.org/~markt/patches/2014-03-19-Jasper-Java8-tc6-v1.patch
   +1: markt
   +0: kkolinko:
@@ -65,8 +100,10 @@ PATCHES PROPOSED TO BACKPORT:
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56265
   Don't escape values for dynamic tag attributes
   http://people.apache.org/~markt/patches/2014-03-19-bug56265-tc6-v1.patch
-  +1: markt
+  +1: markt, kkolinko
   -1:
+kkolinko: Beware that changelog part of this patch merges into a wrong
+place. This change belongs to Jasper, not Catalina.
 
 * Update tc-native to 1.1.29
   http://people.apache.org/~markt/patches/2014-03-19-tc-native-tc6-v1.patch
@@ -76,7 +113,7 @@ PATCHES PROPOSED TO BACKPORT:
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56275
   Fix memory leak if a Filter throws an exception during its destroy() method
   http://people.apache.org/~markt/patches/2014-03-19-bug56275-tc6-v1.patch
-  +1: markt, schultz
+  +1: markt, schultz, kkolinko
   -1:
 
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54475



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



Re: [VOTE] Release Apache Tomcat 8.0.4

2014-03-21 Thread Konstantin Kolinko
2014-03-20 1:14 GMT+04:00 Mark Thomas ma...@apache.org:
 The proposed Apache Tomcat 8.0.4 release is now available for voting.

 The main changes since 8.0.3 are:
 - Update Eclipse JDT compiler to enable full Java 8 support for JSPs in
   the default configuration
 - Add new, experimental HTTP and AJP connectors based on NIO2
 - Update the default connection pooling based on a repackaged Commons
   DBCP 2 to use the Commons DBCP 2.0 release

 ...


I am not voting yet.
The test suite did pass successfully for BIO,NIO,APR,NIO2 with JDK
7u51 (32-bit) on Windows 7,  except for the following test with NIO2:

TEST-org.apache.catalina.connector.TestCoyoteOutputStream.NIO2.txt
[[[
Testcase: testNonBlockingWriteTwiceBlockingWriteOnce took 300,096 sec
Caused an ERROR
Read timed out
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at 
sun.net.www.http.ChunkedInputStream.readAheadBlocking(ChunkedInputStream.java:552)
at 
sun.net.www.http.ChunkedInputStream.readAhead(ChunkedInputStream.java:609)
at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:696)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at 
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3053)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at 
org.apache.catalina.startup.TomcatBaseTest.methodUrl(TomcatBaseTest.java:264)
at 
org.apache.catalina.startup.TomcatBaseTest.getUrl(TomcatBaseTest.java:219)
at 
org.apache.catalina.connector.TestCoyoteOutputStream.doNonBlockingTest(TestCoyoteOutputStream.java:91)
at 
org.apache.catalina.connector.TestCoyoteOutputStream.testNonBlockingWriteTwiceBlockingWriteOnce(TestCoyoteOutputStream.java:69)
]]]

There are a number of the following messages in the log files (in 3
files for NIO2, in 1 file for BIO):
java.util.concurrent.RejectedExecutionException: Executor not running,
can't force a command into the queue

Those are in
TEST-org.apache.catalina.connector.TestCoyoteOutputStream.NIO2.txt
TEST-org.apache.coyote.http11.upgrade.TestUpgrade.BIO.txt
TEST-org.apache.coyote.http11.upgrade.TestUpgrade.NIO2.txt
TEST-org.apache.tomcat.websocket.TestWsWebSocketContainer.NIO2.txt

According to the logs when RejectedExecutionException happens the
protocol handler have been stopped and destroyed several msecs before
that event.

The log for BIO connector in
TEST-org.apache.coyote.http11.upgrade.TestUpgrade.BIO.txt looks like
the following:
[[[
21-Mar-2014 11:00:28.285 INFO [main]
org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
[http-bio-127.0.0.1-auto-5]
21-Mar-2014 11:00:28.285 INFO [main]
org.apache.catalina.core.StandardService.startInternal Starting
service Tomcat
21-Mar-2014 11:00:28.286 INFO [main]
org.apache.catalina.core.StandardEngine.startInternal Starting Servlet
Engine: Apache Tomcat/8.0.4
21-Mar-2014 11:00:28.300 INFO [main]
org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
[http-bio-127.0.0.1-auto-5-54604]
21-Mar-2014 11:00:28.305 INFO [main]
org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler
[http-bio-127.0.0.1-auto-5-54604]
21-Mar-2014 11:00:28.356 INFO [main]
org.apache.catalina.core.StandardService.stopInternal Stopping service
Tomcat
21-Mar-2014 11:00:28.362 INFO [main]
org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler
[http-bio-127.0.0.1-auto-5-54604]
21-Mar-2014 11:00:28.362 INFO [main]
org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler
[http-bio-127.0.0.1-auto-5-54604]
21-Mar-2014 11:00:28.362 WARNING [http-bio-127.0.0.1-auto-5-exec-5]
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run Socket
reprocessing request was rejected
for:org.apache.tomcat.util.net.SocketWrapper@1c44935:Socket[addr=/127.0.0.1,port=54605,localport=54604]
 java.util.concurrent.RejectedExecutionException: Executor not
running, can't force a command into the queue
at org.apache.tomcat.util.threads.TaskQueue.force(TaskQueue.java:63)
at 
org.apache.tomcat.util.threads.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:180)
at 
org.apache.tomcat.util.threads.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:155)
at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:353)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at 

[Bug 56296] New: AjpNioProcessor throws java.nio.BufferOverflowException

2014-03-21 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56296

Bug ID: 56296
   Summary: AjpNioProcessor throws
java.nio.BufferOverflowException
   Product: Tomcat 7
   Version: 7.0.52
  Hardware: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: hugo.lums...@blackrock.com

We are seeing the following sporadic exceptions in catalina.out:

Mar 21, 2014 2:42:13 AM org.apache.coyote.ajp.AjpNioProcessor process
SEVERE: Error processing request
java.nio.BufferOverflowException
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:183)
at
org.apache.coyote.ajp.AjpNioProcessor.output(AjpNioProcessor.java:296)
at
org.apache.coyote.ajp.AbstractAjpProcessor$SocketOutputBuffer.doWrite(AbstractAjpProcessor.java:1195)
at org.apache.coyote.Response.doWrite(Response.java:520)
at
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:408)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480)
at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:359)
at
org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:309)
at
org.apache.catalina.connector.Response.finishResponse(Response.java:510)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:435)
at
org.apache.coyote.ajp.AjpNioProcessor.process(AjpNioProcessor.java:177)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1721)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1679)
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:744


We have correlated these with the following error in our application log:

2014-03-21 02:42:13,753 (tomcat-exec-13) ERROR [x.StreamingManagerImpl]
Error streaming document [/xxx/responsible-investment-report-2011.pdf]
ClientAbortException:  java.io.IOException: Broken pipe
at
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:413)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:366)
at
org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:438)
at
org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:426)
at
org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:91)
at
org.apache.catalina.servlets.DefaultServlet.copyRange(DefaultServlet.java:2032)
at
org.apache.catalina.servlets.DefaultServlet.copy(DefaultServlet.java:1871)
at
org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:959)
at
org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:409)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)



We want to understand whether the error is benign and simply caused by a client
dropping connection mid-download.  Or if it's the other way round - for example
a slow network download speed to the client causes the buffer overflow and the
connection drop.

-- 
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: [VOTE] Release Apache Tomcat 8.0.4

2014-03-21 Thread Rémy Maucherat
2014-03-21 10:42 GMT+01:00 Konstantin Kolinko knst.koli...@gmail.com:

 I am not voting yet.
 The test suite did pass successfully for BIO,NIO,APR,NIO2 with JDK
 7u51 (32-bit) on Windows 7,  except for the following test with NIO2:

 TEST-org.apache.catalina.connector.TestCoyoteOutputStream.NIO2.txt
 [[[
 Testcase: testNonBlockingWriteTwiceBlockingWriteOnce took 300,096 sec
 Caused an ERROR


Works for me (like that SSL test ...).


 There are a number of the following messages in the log files (in 3
 files for NIO2, in 1 file for BIO):
 java.util.concurrent.RejectedExecutionException: Executor not running,
 can't force a command into the queue


Yes, I get some of them too. There's a completion handler waiting on
keepalive, that gets a failed when closing the server socket, which seems
normal to me. But there are no checks for the running state there, it will
try to process the close. So that should be cosmetic, I think I'll check
the best option between toning down the thing to debug level, adding a
check for the running flag, etc.

Example stack from the TestCoyoteOutputStream logs:
20-Mar-2014 14:48:14.605 WARNING [http-nio2-127.0.0.1-auto-4-exec-7]
org.apache.tomcat.util.net.Nio2Endpoint.processSocket0 Executor rejected
socket [org.apache.tomcat.util.net.Nio2Endpoint$Nio2SocketWrapper@3e7747dc:null]
for processing
 java.util.concurrent.RejectedExecutionException: Executor not running,
can't force a command into the queue
at org.apache.tomcat.util.threads.TaskQueue.force(TaskQueue.java:63)
at
org.apache.tomcat.util.threads.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:180)

at
org.apache.tomcat.util.threads.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:155)

at
org.apache.tomcat.util.net.Nio2Endpoint.processSocket0(Nio2Endpoint.java:561)

at
org.apache.tomcat.util.net.Nio2Endpoint$1.failed(Nio2Endpoint.java:932)
at
org.apache.tomcat.util.net.Nio2Endpoint$1.failed(Nio2Endpoint.java:919)


 Those are in
 TEST-org.apache.catalina.connector.TestCoyoteOutputStream.NIO2.txt
 TEST-org.apache.coyote.http11.upgrade.TestUpgrade.BIO.txt
 TEST-org.apache.coyote.http11.upgrade.TestUpgrade.NIO2.txt
 TEST-org.apache.tomcat.websocket.TestWsWebSocketContainer.NIO2.txt

 According to the logs when RejectedExecutionException happens the
 protocol handler have been stopped and destroyed several msecs before
 that event.

 With websockets, I get some additional shutdown errors too.

BTW, the stability vote is not about NIO2, it is experimental (and will
remain that way for an indefinite amount of time, maybe until its removal
if not successful enough).

Rémy


Re: svn commit: r1579428 - /tomcat/tc6.0.x/trunk/STATUS.txt

2014-03-21 Thread Konstantin Kolinko
2014-03-20 23:58 GMT+04:00 Christopher Schultz ch...@christopherschultz.net:
 Mark,

 On 3/19/14, 6:35 PM, ma...@apache.org wrote:
 Author: markt
 Date: Wed Mar 19 22:35:46 2014
 New Revision: 1579428

==
 --- tomcat/tc6.0.x/trunk/STATUS.txt (original)
 +++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Mar 19 22:35:46 2014

 +* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56275
 +  Fix memory leak if a Filter throws an exception during its destroy() 
 method
 +  http://people.apache.org/~markt/patches/2014-03-19-bug56275-tc6-v1.patch
 +  +1: markt
 +  -1:
 +

 I can't seem to find the original patch against Tomcat 7.0 to ask about
 this, but I wanted to know who you removed the setFilterDef method

http://svn.apache.org/viewvc?view=revisionrevision=1429172

 -- it
 seemed to provide the useful service of decommissioning any Filter that
 had already been started. Is that something that never actually happens?


That is a package-visible method, it is not part of the API.

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: r1579925 - in /tomcat/trunk/java/org/apache: coyote/http11/InternalNio2OutputBuffer.java tomcat/util/net/Nio2Endpoint.java

2014-03-21 Thread remm
Author: remm
Date: Fri Mar 21 11:07:20 2014
New Revision: 1579925

URL: http://svn.apache.org/r1579925
Log:
- Reliably allow blocking following non blocking if some flushing is needed on 
end.
- Use debug log level in case of a rejected execution, which can occur on 
shutdown.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1579925r1=1579924r2=1579925view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
Fri Mar 21 11:07:20 2014
@@ -381,7 +381,15 @@ public class InternalNio2OutputBuffer ex
 byteBuffer.flip();
 flipped = true;
 }
-
socket.getSocket().write(byteBuffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS);
+if (bufferedWrites.size()  0) {
+for (ByteBuffer buffer : bufferedWrites) {
+buffer.flip();
+
socket.getSocket().write(buffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS);
+}
+}
+if (byteBuffer.hasRemaining()) {
+
socket.getSocket().write(byteBuffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS);
+}
 } catch (InterruptedException | ExecutionException e) {
 throw new IOException(e);
 } catch (TimeoutException e) {

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1579925r1=1579924r2=1579925view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Fri Mar 21 
11:07:20 2014
@@ -563,7 +563,7 @@ public class Nio2Endpoint extends Abstra
 sc.run();
 }
 } catch (RejectedExecutionException ree) {
-log.warn(sm.getString(endpoint.executor.fail, socket), ree);
+log.debug(sm.getString(endpoint.executor.fail, socket), ree);
 return false;
 } catch (Throwable t) {
 ExceptionUtils.handleThrowable(t);



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



svn commit: r1579931 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/descriptor/LocalResolver.java webapps/docs/changelog.xml

2014-03-21 Thread kkolinko
Author: kkolinko
Date: Fri Mar 21 12:16:34 2014
New Revision: 1579931

URL: http://svn.apache.org/r1579931
Log:
Merged r1576288 from tomcat/trunk:
Add a work-around for XML documents (often TLDs) that only refer to JavaEE 
schemas by file name
Backport of markt's patch.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/descriptor/LocalResolver.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1576288

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/descriptor/LocalResolver.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/descriptor/LocalResolver.java?rev=1579931r1=1579930r2=1579931view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/descriptor/LocalResolver.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/descriptor/LocalResolver.java 
Fri Mar 21 12:16:34 2014
@@ -37,6 +37,11 @@ public class LocalResolver implements En
 private static final StringManager sm =
 StringManager.getManager(Constants.PACKAGE_NAME);
 
+private static final String[] JAVA_EE_NAMESPACES = {
+XmlIdentifiers.JAVAEE_1_4_NS,
+XmlIdentifiers.JAVAEE_5_NS };
+
+
 private final MapString,String publicIds;
 private final MapString,String systemIds;
 private final boolean blockExternal;
@@ -94,6 +99,18 @@ public class LocalResolver implements En
 return is;
 }
 
+// Work-around for XML documents that use just the file name for the
+// location to refer to a JavaEE schema
+for (String javaEENamespace : JAVA_EE_NAMESPACES) {
+String javaEESystemId = javaEENamespace + '/' + systemId;
+resolved = systemIds.get(javaEESystemId);
+if (resolved != null) {
+InputSource is = new InputSource(resolved);
+is.setPublicId(publicId);
+return is;
+}
+}
+
 // Resolve the supplied systemId against the base
 URI systemUri;
 try {
@@ -133,6 +150,7 @@ public class LocalResolver implements En
 return is;
 }
 }
+
 throw new 
FileNotFoundException(sm.getString(localResolver.unresolvedEntity,
 name, publicId, systemId, base));
 }

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1579931r1=1579930r2=1579931view=diff
==
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Mar 21 12:16:34 2014
@@ -102,6 +102,11 @@
 Prevent user supplied XSLTs used by the DefaultServlet from defining
 external entities. (markt)
   /fix
+  add
+Add a work around for validating XML documents (often TLDs) that use
+just the file name to refer to refer to the JavaEE schema on which they
+are based. (markt)
+  /add
 /changelog
   /subsection
   subsection name=Coyote



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



[Bug 56297] New: Attempted optimisation does not (improve performance)

2014-03-21 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56297

Bug ID: 56297
   Summary: Attempted optimisation does not (improve performance)
   Product: Tomcat Connectors
   Version: unspecified
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: mod_jk
  Assignee: dev@tomcat.apache.org
  Reporter: apa...@xenoc.demon.co.uk

Added Nov-2004 in JK 1.2.7 the COMPUTE_KEY_CHECKSUM macro 
is an attempt to allow us to check if we can skip a strcmp() invocation
but the key generated is always the same 
as all 'names' in mod_jk start with the same four characters ('work' - from
'worker.') so it does not improve performance.

http://svn.apache.org/viewvc?view=revisionrevision=299957

It can be changed to a digest to get the desired performance gain.

-- 
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 56297] Attempted optimisation does not (improve performance)

2014-03-21 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56297

--- Comment #1 from Thomas Schodt apa...@xenoc.demon.co.uk ---
Patch tested on linux.

$ svn diff jk_map.c
Index: jk_map.c
===
--- jk_map.c(revision 1579918)
+++ jk_map.c(working copy)
@@ -36,8 +36,8 @@
 #define JK_MAP_REFERENCE(.reference)
 #define JK_MAP_REFERENCE_SZ (strlen(JK_MAP_REFERENCE))

-/* Compute the checksum for a key, consisting of the first
- * 4 bytes, packed into an int.
+/* Compute the checksum for a key, consisting of
+ * a digest of the string (same as java hashcode).
  * This checksum allows us to do a single integer
  * comparison as a fast check to determine whether we can
  * skip a strcmp
@@ -45,23 +45,13 @@
 #define COMPUTE_KEY_CHECKSUM(key, checksum)\
 {  \
 const char *k = (key); \
-unsigned int c = (unsigned int)*k; \
-(checksum) = c;\
-(checksum) = 8;  \
-if (c) {   \
-c = (unsigned int)*++k;\
-checksum |= c; \
+(checksum) = 0;\
+unsigned int c = (unsigned int)*k++;   \
+while(c) { \
+(checksum) *= 31;  \
+(checksum) += c;   \
+c = (unsigned int)*k++;\
 }  \
-(checksum) = 8;  \
-if (c) {   \
-c = (unsigned int)*++k;\
-checksum |= c; \
-}  \
-(checksum) = 8;  \
-if (c) {   \
-c = (unsigned int)*++k;\
-checksum |= c; \
-}  \
 }

 static volatile int global_map_id = 0;

-- 
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: r1579933 - in /tomcat/trunk: java/org/apache/coyote/http11/InternalNio2OutputBuffer.java webapps/docs/changelog.xml

2014-03-21 Thread remm
Author: remm
Date: Fri Mar 21 12:30:40 2014
New Revision: 1579933

URL: http://svn.apache.org/r1579933
Log:
Add missing clear after writing the buffers (in practice this shouldn't be 
needed though). If an exception occurs the response will be recycled so no need 
for a finally.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
tomcat/trunk/webapps/docs/changelog.xml

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1579933r1=1579932r2=1579933view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
Fri Mar 21 12:30:40 2014
@@ -386,6 +386,7 @@ public class InternalNio2OutputBuffer ex
 buffer.flip();
 
socket.getSocket().write(buffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS);
 }
+bufferedWrites.clear();
 }
 if (byteBuffer.hasRemaining()) {
 
socket.getSocket().write(byteBuffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS);

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1579933r1=1579932r2=1579933view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Mar 21 12:30:40 2014
@@ -45,6 +45,14 @@
   issues to not pop up wrt. others).
 --
 section name=Tomcat 8.0.5 (markt)
+  subsection name=Coyote
+changelog
+  fix
+Fix possibly incomplete final flush with NIO2 when using non blocking
+mode. (remm)
+  /fix
+/changelog
+  /subsection
   subsection name=Jasper
 changelog
   fix



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

2014-03-21 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-7-trunk while 
building ASF Buildbot.
Full details are available at:
 http://ci.apache.org/builders/tomcat-7-trunk/builds/1824

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

Buildslave for this Build: bb-vm_ubuntu

Build Reason: scheduler
Build Source Stamp: [branch tomcat/tc7.0.x/trunk] 1579928
Blamelist: kkolinko

Build succeeded!

sincerely,
 -The Buildbot





ant version 1.8.2 or later is required for Tomcat 7 build

2014-03-21 Thread Violeta Georgieva
Hi,

With r1570844 Tomcat build requires ant  version 1.8.2 or later.
The BUILDING.txt describes Install Apache Ant 1.8.x on your computer.
 I will change it to Install Apache Ant 1.8.2 or later on your computer.
Wdyt?

Regards
Violeta


Debugging Tomcat 7 Cors Filter

2014-03-21 Thread mrs.nospam
I'm using Eclipse to remote debug a Tomcat 7.0.47 instance.  I'm trying to
figure out why a request isn't going through the
org.apache.cataline.filters.CorsFilter.   It's a complex web app with a lot
of filters configured. Some requests hit the filter and I can debug them
properly and others are not.

My CorsFilter in tomcat/conf/web.xml is set to use

  url-pattern/*/url-pattern

I know they are hitting tomcat because I see them in the access_log:

157.166.175.129 - - [21/Mar/2014:09:20:16 -0400] OPTIONS
/bonita/API/bpm/humanTask?p=0c=10f=state=ready HTTP/1.1 401 -

Will someone point me in the right direction of where to put a breakpoint
to track this down?


Re: ant version 1.8.2 or later is required for Tomcat 7 build

2014-03-21 Thread Konstantin Kolinko
2014-03-21 17:03 GMT+04:00 Violeta Georgieva miles...@gmail.com:
 Hi,

 With r1570844 Tomcat build requires ant  version 1.8.2 or later.
 The BUILDING.txt describes Install Apache Ant 1.8.x on your computer.
  I will change it to Install Apache Ant 1.8.2 or later on your computer.
 Wdyt?

+1.

Best regards,
Konstantin Kolinko


 Regards
 Violeta

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



svn commit: r1579941 - /tomcat/tc6.0.x/trunk/STATUS.txt

2014-03-21 Thread schultz
Author: schultz
Date: Fri Mar 21 13:46:53 2014
New Revision: 1579941

URL: http://svn.apache.org/r1579941
Log:
Updated votes.

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1579941r1=1579940r2=1579941view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Fri Mar 21 13:46:53 2014
@@ -36,45 +36,22 @@ PATCHES PROPOSED TO BACKPORT:
   +1: markt, kkolinko
   -1: schultz: The idea of the patch is fine: I'm actually +1.
I have some small nits:
-   1. DocumentBuilderFactory is not thread-safe, and shouldn't
-   be shared. 2. Two instances of swallowing IOException
+   2. Two instances of swallowing IOException
when closing File streams. We should at least log a warning.
-   It looks like there is an opportinity to use StringBuilder
-   instead of StringBuffer, there, too, if you want.
+   The case of InputStream vs OutputStream is not relevant:
+   a stream left open should be logged. Honestly, it will
+   pretty much never happen, but that's no excuse not to log
+   a potential problem.
   kkolinko:
-Re 1.:
-  The newDocumentBuilder() method is thread safe.
-
-  See JSR 206 (Final Release = JAXP 1.3)
-  https://jcp.org/en/jsr/detail?id=206
-  Ch.3 - Thread Safety
-  [quote]
- Implementations of the SAXParser, DocumentBuilder, Transformer, 
Validator and Validat
- orHandler abstract classes are not expected to be thread safe by 
this specification. (...)
-
- Configuration of a SAXParserFactory, DocumentBuilderFactory 
TransformerFactory or
- SchemaFactory is also not expected to be thread safe. (...)
-
- It is expected that the newSAXParser method of a SAXParserFactory 
implementation, the newDocument
- Builder method of a DocumentBuilderFactory and the newTransformer 
method of a Transformer
- Factory will be thread safe without side effects. (...)
-
- Note that Schema is thread safe.
-  [/quote]
-
 Re 2.:
   Those are input streams that are read, not written. Nothing
   should really happen when those are closed.
-
-Re StringBuilder:
-  I think it is not of much concern. But if there is any interest,
-  I am proposing a patch below. It is a 4 years old one.
   -1:
 
 * Use StringBuilder in DefaultServlet
   Apply only DefaultServlet.java part of the following patch:
   
https://people.apache.org/~kkolinko/patches/StringBuilder/2009-11-02_StringBuilder_o_a_c_servlets.patch
-  +1: kkolinko
+  +1: kkolinko, schultz
   -1:
 
 * Fix possible overflow when parsing long values from a byte array.



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



Re: Debugging Tomcat 7 Cors Filter

2014-03-21 Thread Konstantin Kolinko
2014-03-21 17:28 GMT+04:00 mrs.nospam mrs.nos...@gmail.com:
 I'm using Eclipse to remote debug a Tomcat 7.0.47 instance.  I'm trying to
 figure out why a request isn't going through the
 org.apache.cataline.filters.CorsFilter.   It's a complex web app with a lot
 of filters configured. Some requests hit the filter and I can debug them
 properly and others are not.

 My CorsFilter in tomcat/conf/web.xml is set to use

   url-pattern/*/url-pattern

 I know they are hitting tomcat because I see them in the access_log:

 157.166.175.129 - - [21/Mar/2014:09:20:16 -0400] OPTIONS
 /bonita/API/bpm/humanTask?p=0c=10f=state=ready HTTP/1.1 401 -

 Will someone point me in the right direction of where to put a breakpoint
 to track this down?

401 = Authentication required.

That is usually sent by a valve performing authentication such as
BasicAuthenticator, DigestAuthenticator. See references to
HttpServletResponse.SC_UNAUTHORIZED

You can always put a breakpoint in CoyoteAdapter.service().

You may put one at Response.sendError(), Response.setStatus().

Best regards,
Konstantin Kolinko

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



[Bug 53367] Database failure may cause pool to hang

2014-03-21 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53367

Filip Hanik fha...@apache.org changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Filip Hanik fha...@apache.org ---
I think you may experience a different scenario here, than the actual bug
reported.
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?view=markup

Line
throw new PoolExhaustedException([ + Thread.currentThread().getName()+]  +
Timeout: Pool empty. Unable to fetch a connection in 
+ (maxWait / 1000) +
 seconds, none available[size:+size.get() +;
busy:+busy.size()+; idle:+idle.size()+; lastwait:+timetowait+].);

The statement
  busy.size()
is not just a counter, it actually measures the number of connections that are
placed in the busy queue.

Here is what I would do

1. set logAbandoned=true
//this will print a log entry of places in your code that are leaking
connections (ie failing to call Connection.close())

With the log output from 1, we should be able to resolve all your problems.

-- 
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: svn commit: r1579941 - /tomcat/tc6.0.x/trunk/STATUS.txt

2014-03-21 Thread Konstantin Kolinko
2014-03-21 17:46 GMT+04:00  schu...@apache.org:
 Author: schultz
 Date: Fri Mar 21 13:46:53 2014
 New Revision: 1579941

 URL: http://svn.apache.org/r1579941
 Log:
 Updated votes.

 Modified:
 tomcat/tc6.0.x/trunk/STATUS.txt

 Modified: tomcat/tc6.0.x/trunk/STATUS.txt
 URL: 
 http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1579941r1=1579940r2=1579941view=diff
 ==
 --- tomcat/tc6.0.x/trunk/STATUS.txt (original)
 +++ tomcat/tc6.0.x/trunk/STATUS.txt Fri Mar 21 13:46:53 2014
 @@ -36,45 +36,22 @@ PATCHES PROPOSED TO BACKPORT:
+1: markt, kkolinko
-1: schultz: The idea of the patch is fine: I'm actually +1.
 I have some small nits:
 -   1. DocumentBuilderFactory is not thread-safe, and shouldn't
 -   be shared. 2. Two instances of swallowing IOException
 +   2. Two instances of swallowing IOException
 when closing File streams. We should at least log a warning.
 -   It looks like there is an opportinity to use StringBuilder
 -   instead of StringBuffer, there, too, if you want.
 +   The case of InputStream vs OutputStream is not relevant:
 +   a stream left open should be logged. Honestly, it will
 +   pretty much never happen, but that's no excuse not to log
 +   a potential problem.


1) Is your vote still -1,
 or -0, or +0?

2) If inputStream.close() fails it does not mean that the stream is left open.
Also no data is lost (unlike outputStream).

Anyway it cannot be a warning. It can be a debug message at best.

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: r1579953 - /tomcat/tc6.0.x/trunk/STATUS.txt

2014-03-21 Thread remm
Author: remm
Date: Fri Mar 21 15:03:05 2014
New Revision: 1579953

URL: http://svn.apache.org/r1579953
Log:
Votes.

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1579953r1=1579952r2=1579953view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Fri Mar 21 15:03:05 2014
@@ -33,7 +33,7 @@ PATCHES PROPOSED TO BACKPORT:
   Prevent user supplied XSLTs used by the DefaultServlet from defining external
   entities.
   
http://people.apache.org/~markt/patches/2014-03-17-globalXsltFile-tc6-v1.patch
-  +1: markt, kkolinko
+  +1: markt, kkolinko, remm
   -1: schultz: The idea of the patch is fine: I'm actually +1.
I have some small nits:
2. Two instances of swallowing IOException
@@ -46,23 +46,24 @@ PATCHES PROPOSED TO BACKPORT:
 Re 2.:
   Those are input streams that are read, not written. Nothing
   should really happen when those are closed.
+  remm: no need to add i18n for something that will not happen
   -1:
 
 * Use StringBuilder in DefaultServlet
   Apply only DefaultServlet.java part of the following patch:
   
https://people.apache.org/~kkolinko/patches/StringBuilder/2009-11-02_StringBuilder_o_a_c_servlets.patch
-  +1: kkolinko, schultz
+  +1: kkolinko, schultz, remm
   -1:
 
 * Fix possible overflow when parsing long values from a byte array.
   http://people.apache.org/~markt/patches/2014-03-18-ascii-tc6.patch
-  +1: markt, kkolinko, schultz
+  +1: markt, kkolinko, schultz, remm
   -1:
 
 * Fix http://issues.apache.org/bugzilla/show_bug.cgi?id=56283
   Add Java 8 support to Jasper's default configuration
   http://people.apache.org/~markt/patches/2014-03-19-Jasper-Java8-tc6-v1.patch
-  +1: markt
+  +1: markt, remm
   +0: kkolinko:
- See r1557990. There are noTldJars lists in TldConfig, 
TldLocationsCache
  that have to be updated. Maybe add support for ecj-*.jar pattern
@@ -77,27 +78,27 @@ PATCHES PROPOSED TO BACKPORT:
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56265
   Don't escape values for dynamic tag attributes
   http://people.apache.org/~markt/patches/2014-03-19-bug56265-tc6-v1.patch
-  +1: markt, kkolinko
+  +1: markt, kkolinko, remm
   -1:
 kkolinko: Beware that changelog part of this patch merges into a wrong
 place. This change belongs to Jasper, not Catalina.
 
 * Update tc-native to 1.1.29
   http://people.apache.org/~markt/patches/2014-03-19-tc-native-tc6-v1.patch
-  +1: markt, kkolinko, schultz
+  +1: markt, kkolinko, schultz, remm
   -1:
 
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56275
   Fix memory leak if a Filter throws an exception during its destroy() method
   http://people.apache.org/~markt/patches/2014-03-19-bug56275-tc6-v1.patch
-  +1: markt, schultz, kkolinko
+  +1: markt, schultz, kkolinko, remm
   -1:
 
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54475
   Add Java 8 support to SMAP generation for JSPs.
   Patch by Robbie Gibson.
   http://people.apache.org/~markt/patches/2014-03-20-smap-java8-tc6-v1.patch
-  +1: markt, kkolinko, schultz
+  +1: markt, kkolinko, schultz, remm
   -1:
 
 



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



[Bug 56297] Attempted optimisation does not (improve performance)

2014-03-21 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56297

Thomas Schodt apa...@xenoc.demon.co.uk changed:

   What|Removed |Added

Version|unspecified |1.2.37

-- 
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: r1579972 - /tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java

2014-03-21 Thread remm
Author: remm
Date: Fri Mar 21 16:21:22 2014
New Revision: 1579972

URL: http://svn.apache.org/r1579972
Log:
Fix time in test (oops).

Modified:
tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java

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=1579972r1=1579971r2=1579972view=diff
==
--- tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java 
Fri Mar 21 16:21:22 2014
@@ -627,7 +627,6 @@ public class TestNonBlockingAPI extends 
 @Override
 public void onWritePossible() throws IOException {
 long start = System.currentTimeMillis();
-long end = System.currentTimeMillis();
 int before = written;
 while (written  WRITE_SIZE 
 ctx.getResponse().getOutputStream().isReady()) {
@@ -640,7 +639,7 @@ public class TestNonBlockingAPI extends 
 // calling complete
 ctx.getResponse().flushBuffer();
 }
-log.info(Write took: + (end - start) +
+log.info(Write took:  + (System.currentTimeMillis() - start) +
  ms. Bytes before= + before +  after= + written);
 // only call complete if we have emptied the buffer
 if (ctx.getResponse().getOutputStream().isReady() 



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



Re: [VOTE] Release Apache Tomcat 8.0.4

2014-03-21 Thread Yoav Shapira
On Wed, Mar 19, 2014 at 5:14 PM, Mark Thomas ma...@apache.org wrote:
 The proposed Apache Tomcat 8.0.4 release is now available for voting.

 The main changes since 8.0.3 are:
 - Update Eclipse JDT compiler to enable full Java 8 support for JSPs in
   the default configuration
 - Add new, experimental HTTP and AJP connectors based on NIO2
 - Update the default connection pooling based on a repackaged Commons
   DBCP 2 to use the Commons DBCP 2.0 release


 It can be obtained from:
 https://dist.apache.org/repos/dist/dev/tomcat/tomcat-8/v8.0.4/
 The Maven staging repo is:
 https://repository.apache.org/content/repositories/orgapachetomcat-1008/
 The svn tag is:
 http://svn.apache.org/repos/asf/tomcat/tc8.0.x/tags/TOMCAT_8_0_4/

 The proposed 8.0.4 release is:
 [ ] Broken - do not release
 [ ] Alpha  - go ahead and release as 8.0.4 (alpha)
 [ ] Beta   - go ahead and release as 8.0.4 (beta)
 [ X ] Stable - go ahead and release as 8.0.4 (stable)

NIO and NIIO2 both worked well for me on home-grown apps, the same
ones I've always used.

As long as we clearly label NIO2 as experimental in the release notes...

Yoav




 Cheers,

 Mark

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


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



Re: [VOTE] Release Apache Tomcat 8.0.4

2014-03-21 Thread Christopher Schultz
All,

On 3/19/14, 5:14 PM, Mark Thomas wrote:
 The proposed Apache Tomcat 8.0.4 release is now available for voting.
 
 The main changes since 8.0.3 are:
 - Update Eclipse JDT compiler to enable full Java 8 support for JSPs in
   the default configuration
 - Add new, experimental HTTP and AJP connectors based on NIO2
 - Update the default connection pooling based on a repackaged Commons
   DBCP 2 to use the Commons DBCP 2.0 release
 
 
 It can be obtained from:
 https://dist.apache.org/repos/dist/dev/tomcat/tomcat-8/v8.0.4/
 The Maven staging repo is:
 https://repository.apache.org/content/repositories/orgapachetomcat-1008/
 The svn tag is:
 http://svn.apache.org/repos/asf/tomcat/tc8.0.x/tags/TOMCAT_8_0_4/
 
 The proposed 8.0.4 release is:
 [ ] Broken - do not release
 [ ] Alpha  - go ahead and release as 8.0.4 (alpha)
 [ ] Beta   - go ahead and release as 8.0.4 (beta)
 [ ] Stable - go ahead and release as 8.0.4 (stable)

It appears that the test has completely-stalled in NIO2 on Linux 2.6.32
x86_64 under Oracle's 1.7.0_45 JVM.

Here's the tail of the test log:

[junit] 21-Mar-2014 12:37:39.247 INFO [main]
org.apache.catalina.core.StandardEngine.startInternal Starting Servlet
Engine: Apache Tomcat/8.0.4
[junit] 21-Mar-2014 12:37:39.255 INFO [main]
org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
[http-nio2-127.0.0.1-auto-4-32905]
[junit] 21-Mar-2014 12:37:39.255 WARNING [main]
org.apache.tomcat.util.net.Nio2Endpoint.startInternal The NIO2 connector
is currently EXPERIMENTAL and should not be used in production
[junit] HTTP/1.1 200 OK
[junit] Server: Apache-Coyote/1.1
[junit] Content-Type: text/plain;charset=UTF-8
[junit] Transfer-Encoding: chunked
[junit] Date: Fri, 21 Mar 2014 16:37:38 GMT
[junit]
[junit] 4
[junit] TEST
[junit] 4
[junit] TEST

It hasn't generated any output in the last hour or so. I'm pasting a
thread dump of the junit test process below. If anyone wants me to
inspect the process, I've still got it running, stalled.

I'm happy to re-run with the NIO2 tests disabled, but I wanted to know
if anyone wanted to see anything else from this process before I
abandoned it and re-started the tests.

Thread dump:

2014-03-21 13:59:58
Full thread dump Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode):

Attach Listener daemon prio=10 tid=0x02581800 nid=0x6b44
waiting on condition [0x]
   java.lang.Thread.State: RUNNABLE

http-nio2-127.0.0.1-auto-4-exec-5 daemon prio=10
tid=0x0233c000 nid=0x66af waiting on condition [0x7f0422c08000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  0xd8dd94e8 (a
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
at
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:103)
at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:31)
at
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

http-nio2-127.0.0.1-auto-4-exec-4 daemon prio=10
tid=0x7f04140b3000 nid=0x66ae waiting on condition [0x7f0422e0a000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  0xd8dd94e8 (a
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
at
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:103)
at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:31)
at
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

http-nio2-127.0.0.1-auto-4-exec-3 daemon prio=10
tid=0x0268c800 nid=0x66ad waiting on condition [0x7f04223e6000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  0xd8dd94e8 (a

Re: svn commit: r1579941 - /tomcat/tc6.0.x/trunk/STATUS.txt

2014-03-21 Thread Christopher Schultz
Konstantin,

On 3/21/14, 10:44 AM, Konstantin Kolinko wrote:
 2014-03-21 17:46 GMT+04:00  schu...@apache.org:
 Author: schultz
 Date: Fri Mar 21 13:46:53 2014
 New Revision: 1579941

 URL: http://svn.apache.org/r1579941
 Log:
 Updated votes.

 Modified:
 tomcat/tc6.0.x/trunk/STATUS.txt

 Modified: tomcat/tc6.0.x/trunk/STATUS.txt
 URL: 
 http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1579941r1=1579940r2=1579941view=diff
 ==
 --- tomcat/tc6.0.x/trunk/STATUS.txt (original)
 +++ tomcat/tc6.0.x/trunk/STATUS.txt Fri Mar 21 13:46:53 2014
 @@ -36,45 +36,22 @@ PATCHES PROPOSED TO BACKPORT:
+1: markt, kkolinko
-1: schultz: The idea of the patch is fine: I'm actually +1.
 I have some small nits:
 -   1. DocumentBuilderFactory is not thread-safe, and shouldn't
 -   be shared. 2. Two instances of swallowing IOException
 +   2. Two instances of swallowing IOException
 when closing File streams. We should at least log a warning.
 -   It looks like there is an opportinity to use StringBuilder
 -   instead of StringBuffer, there, too, if you want.
 +   The case of InputStream vs OutputStream is not relevant:
 +   a stream left open should be logged. Honestly, it will
 +   pretty much never happen, but that's no excuse not to log
 +   a potential problem.
 
 
 1) Is your vote still -1,
  or -0, or +0?

Still -1, just like STATUS.txt still says.

 2) If inputStream.close() fails it does not mean that the stream is left open.
 Also no data is lost (unlike outputStream).

It doesn't mean that the stream is definitely left open. But the stream
*could* be left open.

 Anyway it cannot be a warning. It can be a debug message at best.

Why not a WARNING?

-chris



signature.asc
Description: OpenPGP digital signature


Re: [VOTE] Release Apache Tomcat 8.0.4

2014-03-21 Thread Rémy Maucherat
2014-03-21 19:02 GMT+01:00 Christopher Schultz ch...@christopherschultz.net
:

 It appears that the test has completely-stalled in NIO2 on Linux 2.6.32
 x86_64 under Oracle's 1.7.0_45 JVM.

 I haven't run into trouble with that particular test yet. Some tests could
use some timeout and clean fail, though, for example, this one has a while
(true) that is never going to exit if it doesn't get its exception, and
that's wrong (and the test also doesn't check any assertion, so it needs
improvements).

Does it always fail for you ?
(you can quickly check it by using test.name
=org/apache/catalina/connector/TestCoyoteAdapter.java)

Rémy


Re: [VOTE] Release Apache Tomcat 8.0.4

2014-03-21 Thread Christopher Schultz
Rémy,

On 3/21/14, 3:17 PM, Rémy Maucherat wrote:
 2014-03-21 19:02 GMT+01:00 Christopher Schultz ch...@christopherschultz.net
 :
 
 It appears that the test has completely-stalled in NIO2 on Linux 2.6.32
 x86_64 under Oracle's 1.7.0_45 JVM.

 I haven't run into trouble with that particular test yet. Some tests could
 use some timeout and clean fail, though, for example, this one has a while
 (true) that is never going to exit if it doesn't get its exception, and
 that's wrong (and the test also doesn't check any assertion, so it needs
 improvements).
 
 Does it always fail for you ?
 (you can quickly check it by using test.name
 =org/apache/catalina/connector/TestCoyoteAdapter.java)

I'll give it a try.

It looks like I have another hang, the first time I (re)tried. Here is
the tail of the console log:

[junit] 21-Mar-2014 15:21:41.229 INFO [main]
org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
[http-nio2-127.0.0.1-auto-4]
[junit] 21-Mar-2014 15:21:41.230 INFO [main]
org.apache.catalina.core.StandardService.startInternal Starting service
Tomcat
[junit] 21-Mar-2014 15:21:41.230 INFO [main]
org.apache.catalina.core.StandardEngine.startInternal Starting Servlet
Engine: Apache Tomcat/8.0.4
[junit] HTTP/1.1 200 OK
[junit] Server: Apache-Coyote/1.1
[junit] Content-Type: text/plain;charset=UTF-8
[junit] Transfer-Encoding: chunked
[junit] Date: Fri, 21 Mar 2014 19:21:40 GMT
[junit]
[junit] 4
[junit] TEST
[junit] 21-Mar-2014 15:21:41.239 INFO [main]
org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
[http-nio2-127.0.0.1-auto-4-59301]
[junit] 21-Mar-2014 15:21:41.239 WARNING [main]
org.apache.tomcat.util.net.Nio2Endpoint.startInternal The NIO2 connector
is currently EXPERIMENTAL and should not be used in production
[junit] 4
[junit] TEST


Sending SIGQUIT shows that the main method is again stuck in testBug54928:

[junit]java.lang.Thread.State: TIMED_WAITING (sleeping)
[junit] at java.lang.Thread.sleep(Native Method)
[junit] at
org.apache.catalina.connector.TestCoyoteAdapter.testBug54928(TestCoyoteAdapter.java:305)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

I can post the entire thread dump if that would be helpful.

For now, I'm going to re-test with nio2 disabled.

-chris



signature.asc
Description: OpenPGP digital signature


svn commit: r1580030 - /tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java

2014-03-21 Thread remm
Author: remm
Date: Fri Mar 21 19:45:39 2014
New Revision: 1580030

URL: http://svn.apache.org/r1580030
Log:
Improve test so that it cannot hang forever (it will check it gets an exception 
and completed, instead).

Modified:
tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java

Modified: tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java?rev=1580030r1=1580029r2=1580030view=diff
==
--- tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java Fri 
Mar 21 19:45:39 2014
@@ -304,6 +304,7 @@ public class TestCoyoteAdapter extends T
 while (servlet.getThread().isAlive()) {
 Thread.sleep(250);
 }
+Assert.assertTrue(servlet.isCompleted());
 }
 
 private static class AsyncServlet extends HttpServlet {
@@ -313,11 +314,16 @@ public class TestCoyoteAdapter extends T
 // This is a hack that won't work generally as servlets are expected to
 // handle more than one request.
 private Thread t;
+private boolean completed = false;
 
 public Thread getThread() {
 return t;
 }
 
+public boolean isCompleted() {
+return completed;
+}
+
 @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
 throws ServletException, IOException {
@@ -334,13 +340,14 @@ public class TestCoyoteAdapter extends T
 
 @Override
 public void run() {
-while (true) {
+for (int i = 0; i  20; i++) {
 try {
 os.write(TEST.getBytes(StandardCharsets.UTF_8));
 os.flush();
 Thread.sleep(1000);
 } catch (Exception e) {
 asyncCtxt.complete();
+completed = true;
 break;
 }
 }



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



Re: [VOTE] Release Apache Tomcat 8.0.4

2014-03-21 Thread Rémy Maucherat
2014-03-21 20:26 GMT+01:00 Christopher Schultz ch...@christopherschultz.net
:

 I'll give it a try.

 It looks like I have another hang, the first time I (re)tried. Here is
 the tail of the console log:

 [junit] 21-Mar-2014 15:21:41.229 INFO [main]
 org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
 [http-nio2-127.0.0.1-auto-4]
 [junit] 21-Mar-2014 15:21:41.230 INFO [main]
 org.apache.catalina.core.StandardService.startInternal Starting service
 Tomcat
 [junit] 21-Mar-2014 15:21:41.230 INFO [main]
 org.apache.catalina.core.StandardEngine.startInternal Starting Servlet
 Engine: Apache Tomcat/8.0.4
 [junit] HTTP/1.1 200 OK
 [junit] Server: Apache-Coyote/1.1
 [junit] Content-Type: text/plain;charset=UTF-8
 [junit] Transfer-Encoding: chunked
 [junit] Date: Fri, 21 Mar 2014 19:21:40 GMT
 [junit]
 [junit] 4
 [junit] TEST
 [junit] 21-Mar-2014 15:21:41.239 INFO [main]
 org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
 [http-nio2-127.0.0.1-auto-4-59301]
 [junit] 21-Mar-2014 15:21:41.239 WARNING [main]
 org.apache.tomcat.util.net.Nio2Endpoint.startInternal The NIO2 connector
 is currently EXPERIMENTAL and should not be used in production
 [junit] 4
 [junit] TEST


 Sending SIGQUIT shows that the main method is again stuck in testBug54928:

 [junit]java.lang.Thread.State: TIMED_WAITING (sleeping)
 [junit] at java.lang.Thread.sleep(Native Method)
 [junit] at

 org.apache.catalina.connector.TestCoyoteAdapter.testBug54928(TestCoyoteAdapter.java:305)
 [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
 Method)
 [junit] at

 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

 I can post the entire thread dump if that would be helpful.

 For now, I'm going to re-test with nio2 disabled.

 The test should now be improved and it shouldn't hang.

Rémy


svn commit: r1580031 - in /tomcat/trunk/java/org/apache/tomcat/util/net: Nio2Endpoint.java res/LocalStrings.properties

2014-03-21 Thread remm
Author: remm
Date: Fri Mar 21 19:50:11 2014
New Revision: 1580031

URL: http://svn.apache.org/r1580031
Log:
- Actually follow the instructions on proper NIO2 shutdown. Much cleaner indeed.
- The downside is that the executor is exclusive to the thread group (no way 
around this), so it cannot be shared with other connectors.
- Add a warning if using a shared executor.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1580031r1=1580030r2=1580031view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Fri Mar 21 
19:50:11 2014
@@ -93,6 +93,11 @@ public class Nio2Endpoint extends Abstra
 private static ThreadLocalBoolean inlineCompletion = new ThreadLocal();
 
 /**
+ * Thread group associated with the server socket.
+ */
+private AsynchronousChannelGroup threadGroup = null;
+
+/**
  * The oom parachute, when an OOM error happens,
  * will release the data, giving the JVM instantly
  * a chunk of data to be able to recover with.
@@ -288,10 +293,13 @@ public class Nio2Endpoint extends Abstra
 if ( getExecutor() == null ) {
 createExecutor();
 }
-AsynchronousChannelGroup threadGroup = null;
 if (getExecutor() instanceof ExecutorService) {
 threadGroup = 
AsynchronousChannelGroup.withThreadPool((ExecutorService) getExecutor());
 }
+// AsynchronousChannelGroup currently needs exclusive access to its 
executor service
+if (!internalExecutor) {
+log.warn(sm.getString(endpoint.nio2.exclusiveExecutor));
+}
 
 serverSock = AsynchronousServerSocketChannel.open(threadGroup);
 socketProperties.setProperties(serverSock);
@@ -420,6 +428,32 @@ public class Nio2Endpoint extends Abstra
 }
 
 
+@Override
+public void shutdownExecutor() {
+if (threadGroup != null  internalExecutor) {
+try {
+threadGroup.shutdownNow();
+} catch (IOException e) {
+getLog().warn(sm.getString(endpoint.warn.executorShutdown, 
getName()), e);
+}
+long timeout = getExecutorTerminationTimeoutMillis();
+if (timeout  0) {
+try {
+threadGroup.awaitTermination(timeout, 
TimeUnit.MILLISECONDS);
+} catch (InterruptedException e) {
+// Ignore
+}
+if (!threadGroup.isTerminated()) {
+
getLog().warn(sm.getString(endpoint.warn.executorShutdown, getName()));
+}
+}
+threadGroup = null;
+}
+// Mostly to cleanup references
+super.shutdownExecutor();
+}
+
+
 // -- Protected Methods
 
 

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties?rev=1580031r1=1580030r2=1580031view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties 
Fri Mar 21 19:50:11 2014
@@ -59,3 +59,4 @@ endpoint.apr.pollError=Poller failed wit
 endpoint.apr.pollUnknownEvent=A socket was returned from the poller with an 
unrecognized event [{0}]
 endpoint.apr.remoteport=APR socket [{0}] opened with remote port [{1}]
 endpoint.nio.selectorCloseFail=Failed to close selector when closing the poller
+endpoint.nio2.exclusiveExecutor=The NIO2 connector requires an exclusive 
executor to operate properly



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



svn commit: r1580032 - in /tomcat/trunk: java/org/apache/coyote/http11/InternalNio2OutputBuffer.java webapps/docs/changelog.xml

2014-03-21 Thread remm
Author: remm
Date: Fri Mar 21 19:50:51 2014
New Revision: 1580032

URL: http://svn.apache.org/r1580032
Log:
Improve trigger of the onWritePossible notification.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
tomcat/trunk/webapps/docs/changelog.xml

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1580032r1=1580031r2=1580032view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
Fri Mar 21 19:50:51 2014
@@ -454,15 +454,24 @@ public class InternalNio2OutputBuffer ex
 
 @Override
 protected boolean hasMoreDataToFlush() {
-return (flipped  
socket.getSocket().getBufHandler().getWriteBuffer().remaining()  0) ||
-(!flipped  
socket.getSocket().getBufHandler().getWriteBuffer().position()  0) ||
-(writePending.availablePermits() == 0) || 
bufferedWrites.size()  0 || e != null;
+synchronized (completionHandler) {
+return (flipped  
socket.getSocket().getBufHandler().getWriteBuffer().remaining()  0) ||
+(!flipped  
socket.getSocket().getBufHandler().getWriteBuffer().position()  0) ||
+bufferedWrites.size()  0 || e != null;
+}
 }
 
 
 @Override
 protected void registerWriteInterest() throws IOException {
-interest = true;
+synchronized (completionHandler) {
+if (writePending.availablePermits() == 0) {
+interest = true;
+} else {
+// If no write is pending, notify
+endpoint.processSocket(socket, SocketStatus.OPEN_WRITE, true);
+}
+}
 }
 
 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1580032r1=1580031r2=1580032view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Mar 21 19:50:51 2014
@@ -51,6 +51,13 @@
 Fix possibly incomplete final flush with NIO2 when using non blocking
 mode. (remm)
   /fix
+  fix
+Cleanup NIO2 endpoint shutdown. (remm)
+  /fix
+  fix
+Fix rare race condition notifying onWritePossible in the NIO2
+HTTP/1.1 connector. (remm)
+  /fix
 /changelog
   /subsection
   subsection name=Jasper



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



svn commit: r1580033 - /tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java

2014-03-21 Thread remm
Author: remm
Date: Fri Mar 21 19:55:48 2014
New Revision: 1580033

URL: http://svn.apache.org/r1580033
Log:
Forgot to check the return value for blocking writes as all other places do, 
oops (some platforms could be returning a negative value after a disconnect 
rather than throw an exception).

Modified:
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1580033r1=1580032r2=1580033view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
Fri Mar 21 19:55:48 2014
@@ -384,12 +384,16 @@ public class InternalNio2OutputBuffer ex
 if (bufferedWrites.size()  0) {
 for (ByteBuffer buffer : bufferedWrites) {
 buffer.flip();
-
socket.getSocket().write(buffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS);
+if 
(socket.getSocket().write(buffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS).intValue()  0) {
+throw new 
EOFException(sm.getString(iob.failedwrite));
+}
 }
 bufferedWrites.clear();
 }
 if (byteBuffer.hasRemaining()) {
-
socket.getSocket().write(byteBuffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS);
+if 
(socket.getSocket().write(byteBuffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS).intValue()  0) {
+throw new 
EOFException(sm.getString(iob.failedwrite));
+}
 }
 } catch (InterruptedException | ExecutionException e) {
 throw new IOException(e);



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



Re: Debugging Tomcat 7 Cors Filter

2014-03-21 Thread mrs.nospam
Great thanks, that helped me track it down.


On Fri, Mar 21, 2014 at 9:46 AM, Konstantin Kolinko
knst.koli...@gmail.comwrote:

 2014-03-21 17:28 GMT+04:00 mrs.nospam mrs.nos...@gmail.com:
  I'm using Eclipse to remote debug a Tomcat 7.0.47 instance.  I'm trying
 to
  figure out why a request isn't going through the
  org.apache.cataline.filters.CorsFilter.   It's a complex web app with a
 lot
  of filters configured. Some requests hit the filter and I can debug them
  properly and others are not.
 
  My CorsFilter in tomcat/conf/web.xml is set to use
 
url-pattern/*/url-pattern
 
  I know they are hitting tomcat because I see them in the access_log:
 
  157.166.175.129 - - [21/Mar/2014:09:20:16 -0400] OPTIONS
  /bonita/API/bpm/humanTask?p=0c=10f=state=ready HTTP/1.1 401 -
 
  Will someone point me in the right direction of where to put a breakpoint
  to track this down?

 401 = Authentication required.

 That is usually sent by a valve performing authentication such as
 BasicAuthenticator, DigestAuthenticator. See references to
 HttpServletResponse.SC_UNAUTHORIZED

 You can always put a breakpoint in CoyoteAdapter.service().

 You may put one at Response.sendError(), Response.setStatus().

 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: r1580072 - /tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java

2014-03-21 Thread markt
Author: markt
Date: Fri Mar 21 22:16:34 2014
New Revision: 1580072

URL: http://svn.apache.org/r1580072
Log:
Remove unused code.

Modified:
tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java

Modified: 
tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java?rev=1580072r1=1580071r2=1580072view=diff
==
--- tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java 
(original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java 
Fri Mar 21 22:16:34 2014
@@ -18,7 +18,6 @@ package async;
 
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -42,7 +41,6 @@ public class AsyncStockServlet extends H
 public static final String LONG_POLL = LONG-POLL;
 public static final String STREAM = STREAM;
 
-static final ArrayListStock ticks = new ArrayList();
 static final ConcurrentLinkedQueueAsyncContext clients =
 new ConcurrentLinkedQueue();
 static final AtomicInteger clientcount = new AtomicInteger(0);
@@ -75,7 +73,6 @@ public class AsyncStockServlet extends H
 
 @Override
 public void tick(Stock stock) {
-ticks.add((Stock)stock.clone());
 IteratorAsyncContext it = clients.iterator();
 while (it.hasNext()) {
 AsyncContext actx = it.next();



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



svn commit: r1580073 - /tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java

2014-03-21 Thread markt
Author: markt
Date: Fri Mar 21 22:20:28 2014
New Revision: 1580073

URL: http://svn.apache.org/r1580073
Log:
Remove more unused code.
Reduce visibility of static fields

Modified:
tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java

Modified: 
tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java?rev=1580073r1=1580072r2=1580073view=diff
==
--- tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java 
(original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java 
Fri Mar 21 22:20:28 2014
@@ -37,14 +37,10 @@ public class AsyncStockServlet extends H
 
 private static final long serialVersionUID = 1L;
 
-public static final String POLL = POLL;
-public static final String LONG_POLL = LONG-POLL;
-public static final String STREAM = STREAM;
-
-static final ConcurrentLinkedQueueAsyncContext clients =
+private static final ConcurrentLinkedQueueAsyncContext clients =
 new ConcurrentLinkedQueue();
-static final AtomicInteger clientcount = new AtomicInteger(0);
-static final Stockticker ticker = new Stockticker();
+private static final AtomicInteger clientcount = new AtomicInteger(0);
+private static final Stockticker ticker = new Stockticker();
 
 public AsyncStockServlet() {
 System.out.println(AsyncStockServlet created);



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



Re: [VOTE] Release Apache Tomcat 8.0.4

2014-03-21 Thread Mark Thomas
On 20/03/2014 13:58, Mark Thomas wrote:
 On 19/03/2014 21:14, Mark Thomas wrote:
 [X] Beta   - go ahead and release as 8.0.4 (beta)

I'm changing my vote to Broken after a regression was discovered in the
fix for bug 56190. I'll try and tag 8.0.5 over the weekend.

Mark


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



svn commit: r1580083 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/core/AsyncContextImpl.java java/org/apache/catalina/core/LocalStrings.properties java/org/apache/coyote/AsyncContextCallbac

2014-03-21 Thread markt
Author: markt
Date: Fri Mar 21 23:08:42 2014
New Revision: 1580083

URL: http://svn.apache.org/r1580083
Log:
Rework the fix for 56190 as the previous fix did not recycle the request in all 
cases leading to mis-routing of requests. 

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties
tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncContextCallback.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncStateMachine.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1580080

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1580083r1=1580082r2=1580083view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java 
Fri Mar 21 23:08:42 2014
@@ -92,9 +92,7 @@ public class AsyncContextImpl implements
 }
 
 @Override
-public void fireOnComplete() throws IOException {
-// Before firing the event, close the response
-request.getResponse().finishResponse();
+public void fireOnComplete() {
 ListAsyncListenerWrapper listenersCopy =
 new ArrayListAsyncListenerWrapper();
 listenersCopy.addAll(listeners);
@@ -132,6 +130,18 @@ public class AsyncContextImpl implements
 Thread.currentThread().setContextClassLoader(oldCL);
 }
 }
+
+// The application doesn't know it has to stop writing until it 
receives
+// the complete event so the response has to be closed after firing the
+// event.
+try {
+request.getResponse().finishResponse();
+} catch (IOException ioe) {
+// Catch this here and allow async context complete to continue
+// normally so a dispatch takes place which ensures that  the
+// request and response objects are correctly recycled.
+log.debug(sm.getString(asyncContextImpl.finishResponseError), 
ioe);
+}
 }
 
 public boolean timeout() {

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties?rev=1580083r1=1580082r2=1580083view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties 
Fri Mar 21 23:08:42 2014
@@ -72,6 +72,7 @@ aprListener.tooLateForSSLRandomSeed=Cann
 aprListener.tooLateForFIPSMode=Cannot setFIPSMode: SSL has already been 
initialized
 aprListener.initializedOpenSSL=OpenSSL successfully initialized ({0})
 
+asyncContextImpl.finishResponseError=Response did not finish cleanly after 
AsyncContext completed
 asyncContextImpl.requestEnded=The request associated with the AsyncContext has 
already completed processing.
 asyncContextImpl.noAsyncDispatcher=The dispatcher returned from the 
ServletContext does not support asynchronous dispatching
 asyncContextImpl.dispatchingStarted=Asynchronous dispatch operation has 
already been called. Additional asynchronous dispatch operation within the same 
asynchronous cycle is not allowed.

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncContextCallback.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncContextCallback.java?rev=1580083r1=1580082r2=1580083view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncContextCallback.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncContextCallback.java Fri 
Mar 21 23:08:42 2014
@@ -16,8 +16,6 @@
  */
 package org.apache.coyote;
 
-import java.io.IOException;
-
 /**
  * Provides a mechanism for the Coyote connectors to signal to a
  * {@link javax.servlet.AsyncContext} implementation that an action, such as
@@ -26,5 +24,5 @@ import java.io.IOException;
  * org.apache.coyote package.  
  */
 public interface AsyncContextCallback {
-public void fireOnComplete() throws IOException;
+public void fireOnComplete();
 }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncStateMachine.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncStateMachine.java?rev=1580083r1=1580082r2=1580083view=diff
==
--- 

svn commit: r1580084 - /tomcat/trunk/webapps/docs/changelog.xml

2014-03-21 Thread markt
Author: markt
Date: Fri Mar 21 23:09:26 2014
New Revision: 1580084

URL: http://svn.apache.org/r1580084
Log:
Fix changelog

Modified:
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1580084r1=1580083r2=1580084view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Mar 21 23:09:26 2014
@@ -47,8 +47,10 @@
 section name=Tomcat 8.0.5 (markt)
   subsection name=Catalina
 changelog
-  Rework the fix for bug56190/bug as the previous fix did not recycle
-  the request in all cases leading to mis-routing of requests. (markt)
+  fix
+Rework the fix for bug56190/bug as the previous fix did not recycle
+the request in all cases leading to mis-routing of requests. (markt)
+  /fix
 /changelog
   /subsection
   subsection name=Coyote



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



Re: [VOTE] Release Apache Tomcat 8.0.4

2014-03-21 Thread Christopher Schultz
All,

On 3/19/14, 5:14 PM, Mark Thomas wrote:
 The proposed 8.0.4 release is:
 [ ] Broken - do not release
 [ ] Alpha  - go ahead and release as 8.0.4 (alpha)
 [X] Beta   - go ahead and release as 8.0.4 (beta)
 [ ] Stable - go ahead and release as 8.0.4 (stable)

Notes for testing on Linux 2.6 x86_64, Oracle Java 1.7.0_45

* Signatures are okay
* Binary zip and tarball are identical
* tcnative builds with only a few warnings (it would be nice to clean
these up)
* Checkstyle is happy
* Java builds without any warnings or errors (there are some unchecked
warnings, and some deprecation warnings, but deprecations can't be
avoided when compiling servlet APIs)
* Tests compile without complaint
* Docs build without complaint
* All tests pass, except for NIO2 (experimental) and Tribes which is
known to fail in my environment.

I've also run some of our own applications without any strangeness. I
performed several client-tests that were failing under 8.0.3 due to a
bug in commons-dbcp (which has since been fixed). The problem indeed
appears to be resolved.

-chris



signature.asc
Description: OpenPGP digital signature


buildbot failure in ASF Buildbot on tomcat-trunk

2014-03-21 Thread buildbot
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/5624

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

Buildslave for this Build: bb-vm_ubuntu

Build Reason: scheduler
Build Source Stamp: [branch tomcat/trunk] 1580073
Blamelist: markt

BUILD FAILED: failed compile_1

sincerely,
 -The Buildbot





buildbot success in ASF Buildbot on tomcat-trunk

2014-03-21 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/5625

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

Buildslave for this Build: bb-vm_ubuntu

Build Reason: scheduler
Build Source Stamp: [branch tomcat/trunk] 1580084
Blamelist: markt

Build succeeded!

sincerely,
 -The Buildbot