[Bug 55686] make request.getParameterNames() and request.getParameterMap ordered

2013-10-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55686

Violeta Georgieva violet...@apache.org changed:

   What|Removed |Added

 Status|NEW |NEEDINFO

--- Comment #1 from Violeta Georgieva violet...@apache.org ---
Hi,

There was already a report for a similar issue - Bug 55576. The fix is
available in 8.0.0-RC4 and yesterday it was announced the availability of
8.0.0-RC6.

I tried your scenario with the current trunk and the parameters are ordered.
Please provide a reproducible scenario against trunk.

Regards
Violeta

-- 
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 55686] make request.getParameterNames() and request.getParameterMap ordered

2013-10-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55686

--- Comment #2 from quaff zhouyanm...@gmail.com ---
wonderful,thanks very much,I have tested with 8.0.0-RC5,can you fix this in
7.0.x?

-- 
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 55686] make request.getParameterNames() and request.getParameterMap ordered

2013-10-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55686

Violeta Georgieva violet...@apache.org changed:

   What|Removed |Added

 Status|NEEDINFO|RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #3 from Violeta Georgieva violet...@apache.org ---
It is fixed in 7.0.x also.

Currently we are voting 7.0.47 [1]. The fix is available in that version.

Regards
Violeta 

[1]
http://markmail.org/message/yus4osg2bgaoekp6?q=7%2E0%2E47+list:org%2Eapache%2Etomcat%2Edev/

*** This bug has been marked as a duplicate of bug 55576 ***

-- 
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 55576] Order of ServletRequest parameters is not preserved

2013-10-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55576

Violeta Georgieva violet...@apache.org changed:

   What|Removed |Added

 CC||zhouyanm...@gmail.com

--- Comment #8 from Violeta Georgieva violet...@apache.org ---
*** Bug 55686 has been marked as a duplicate of this bug. ***

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



APR/native with SSL usage questions

2013-10-22 Thread Mark Thomas
I've been doing some further research on the current issues with
WebSockets over HTTPS with the APR/native connector and I have a few
questions.

1. Is concurrent reading and writing from/to the socket supported with SSL?

2. Is non-blocking IO supported with SSL?


Background

The error observed with WebSockets and HTTPs with APR/native appears to
be some form of internal error. My suspicion is that I am triggering
this by using the API an an unexpected / unsupported manner. Therefore,
I'd like to get some clarification of what is supported and what isn't.

Regarding question 1, there appears to be a reduction in error rate if I
prevent concurrent reading and writing. Therefore I suspect that this is
part of the problem.

Regarding question 2, the method that enables non-blocking IO in OpenSSL
is never called.

If the answer to either or both of the questions above is no, I think I
can work around that but before I spend time doing that it would be
helpful to know if I am on the right track with this or if I should be
looking elsewhere for the cause of these issues.

Thanks,

Mark

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



Generating javadoc in Tomcat 7 with jdk 7 when java.7.home is set

2013-10-22 Thread Violeta Georgieva
Hi,

I'm looking at the issue with javadoc reported by Rainer [1]
I know that we've decided to use the quick-fix tool for javadoc instead of
jdk 7 [2].
But that was before websocket downport that require jdk 7 for building.

What do you think if we start generating javadoc with jdk 7 when
java.7.home is set as suggested by Rainer ?

Thanks
Violeta


[1] http://markmail.org/message/hv2e32eo5du22dyf?q=7%2E0%2E47page=2
[2]
http://markmail.org/message/344mf45rhjfttuim?q=CVE-2013-1571%2C+VU%23225657+list:org%2Eapache%2Etomcat%2Edev/


svn commit: r1534540 - in /tomcat/trunk/java/org/apache/coyote/http11/upgrade: AprServletInputStream.java AprServletOutputStream.java

2013-10-22 Thread markt
Author: markt
Date: Tue Oct 22 08:34:32 2013
New Revision: 1534540

URL: http://svn.apache.org/r1534540
Log:
Check for closed sockets earlier and reduce code duplication.

Modified:

tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java

tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletOutputStream.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java?rev=1534540r1=1534539r2=1534540view=diff
==
--- 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java 
(original)
+++ 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java 
Tue Oct 22 08:34:32 2013
@@ -44,6 +44,10 @@ public class AprServletInputStream exten
 protected int doRead(boolean block, byte[] b, int off, int len)
 throws IOException {
 
+if (closed) {
+throw new IOException(sm.getString(apr.closed, 
Long.valueOf(socket)));
+}
+
 Lock readLock = wrapper.getBlockingStatusReadLock();
 WriteLock writeLock = wrapper.getBlockingStatusWriteLock();
 
@@ -52,9 +56,6 @@ public class AprServletInputStream exten
 try {
 readLock.lock();
 if (wrapper.getBlockingStatus() == block) {
-if (closed) {
-throw new IOException(sm.getString(apr.closed, 
Long.valueOf(socket)));
-}
 result = Socket.recv(socket, b, off, len);
 readDone = true;
 }
@@ -72,9 +73,6 @@ public class AprServletInputStream exten
 try {
 readLock.lock();
 writeLock.unlock();
-if (closed) {
-throw new IOException(sm.getString(apr.closed, 
Long.valueOf(socket)));
-}
 result = Socket.recv(socket, b, off, len);
 } finally {
 readLock.unlock();

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletOutputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletOutputStream.java?rev=1534540r1=1534539r2=1534540view=diff
==
--- 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletOutputStream.java 
(original)
+++ 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletOutputStream.java 
Tue Oct 22 08:34:32 2013
@@ -56,15 +56,16 @@ public class AprServletOutputStream exte
 protected int doWrite(boolean block, byte[] b, int off, int len)
 throws IOException {
 
+if (closed) {
+throw new IOException(sm.getString(apr.closed, 
Long.valueOf(socket)));
+}
+
 Lock readLock = wrapper.getBlockingStatusReadLock();
 WriteLock writeLock = wrapper.getBlockingStatusWriteLock();
 
 try {
 readLock.lock();
 if (wrapper.getBlockingStatus() == block) {
-if (closed) {
-throw new IOException(sm.getString(apr.closed, 
Long.valueOf(socket)));
-}
 return doWriteInternal(b, off, len);
 }
 } finally {
@@ -85,9 +86,6 @@ public class AprServletOutputStream exte
 try {
 readLock.lock();
 writeLock.unlock();
-if (closed) {
-throw new IOException(sm.getString(apr.closed, 
Long.valueOf(socket)));
-}
 return doWriteInternal(b, off, len);
 } finally {
 readLock.unlock();



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



svn commit: r1534543 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

2013-10-22 Thread markt
Author: markt
Date: Tue Oct 22 08:55:07 2013
New Revision: 1534543

URL: http://svn.apache.org/r1534543
Log:
Remove socket from list of connections as soon as we know it is going to be 
closed.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1534543r1=1534542r2=1534543view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Tue Oct 22 
08:55:07 2013
@@ -923,6 +923,8 @@ public class AprEndpoint extends Abstrac
 // parent pool or acceptor socket.
 // In any case disable double free which would cause JVM core.
 
+connections.remove(Long.valueOf(socket));
+
 // While the connector is running, destroySocket() will call
 // countDownConnection(). Once the connector is stopped, the latch is
 // removed so it does not matter that destroySocket() does not call



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



svn commit: r1534544 - in /tomcat/trunk/java/org/apache/coyote/http11/upgrade: AprServletInputStream.java AprServletOutputStream.java LocalStrings.properties

2013-10-22 Thread markt
Author: markt
Date: Tue Oct 22 09:00:56 2013
New Revision: 1534544

URL: http://svn.apache.org/r1534544
Log:
Add wrapper information to error message

Modified:

tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java

tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletOutputStream.java
tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java?rev=1534544r1=1534543r2=1534544view=diff
==
--- 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java 
(original)
+++ 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java 
Tue Oct 22 09:00:56 2013
@@ -100,7 +100,7 @@ public class AprServletInputStream exten
 throw new EOFException(sm.getString(apr.clientAbort));
 } else {
 throw new IOException(sm.getString(apr.read.error,
-Integer.valueOf(-result), Long.valueOf(socket)));
+Integer.valueOf(-result), Long.valueOf(socket), wrapper));
 }
 }
 

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletOutputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletOutputStream.java?rev=1534544r1=1534543r2=1534544view=diff
==
--- 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletOutputStream.java 
(original)
+++ 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletOutputStream.java 
Tue Oct 22 09:00:56 2013
@@ -141,7 +141,7 @@ public class AprServletOutputStream exte
 throw new EOFException(sm.getString(apr.clientAbort));
 } else if (written  0) {
 throw new IOException(sm.getString(apr.write.error,
-Integer.valueOf(-written), Long.valueOf(socket)));
+Integer.valueOf(-written), Long.valueOf(socket), 
wrapper));
 }
 start += written;
 left -= written;

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties?rev=1534544r1=1534543r2=1534544view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties 
Tue Oct 22 09:00:56 2013
@@ -25,7 +25,7 @@ upgrade.sos.writeListener.null=It is ill
 upgrade.sis.write.ise=It is illegal to call any of the write() methods in 
non-blocking mode without first checking that there is space available by 
calling isReady()
 
 apr.clientAbort=The client aborted the connection.
-apr.read.error=Unexpected error [{0}] reading data from the APR/native socket 
[{1}].
-apr.write.error=Unexpected error [{0}] writing data to the APR/native socket 
[{1}].
+apr.read.error=Unexpected error [{0}] reading data from the APR/native socket 
[{1}] with wrapper [{2}].
+apr.write.error=Unexpected error [{0}] writing data to the APR/native socket 
[{1}] with wrapper [{2}].
 apr.closed=The socket [{0}] associated with this connection has been closed.
 



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



[Bug 55688] New: SendRedirect does not work with AsyncContext

2013-10-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55688

Bug ID: 55688
   Summary: SendRedirect does not work with AsyncContext
   Product: Tomcat 7
   Version: 7.0.42
  Hardware: PC
Status: NEW
  Severity: major
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: vicky...@gmail.com

Created attachment 30951
  -- https://issues.apache.org/bugzilla/attachment.cgi?id=30951action=edit
Sample war file which can help reproduce the issue.

Hi,

I recently moved from Tomcat 7.0.32 to 7.0.42. One of my application logic has
stopped working since the upgrade.

The problem seems to be with using response.sendRedirect and AsyncContext.
Without the AsyncContext in picture sendRedirect seems to work fine.

Follow the below steps to reproduce this,
1. Copy the attached war in to 7.0.32/Webapps
2. Hit localhost:8080/Sample/test
3. In some time you should get redirected to http://www.google.com

Do the same steps with 7.0.42, i don't see any error/exceptions, but the
request just times out i guess. To see more details, when i put a proxy tool in
between, the response i got was,
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Location: http://www.google.com/
Transfer-Encoding: chunked
Date: Tue, 22 Oct 2013 08:15:03 GMT
Connection: close

0

Note - I did see issue no 51197, it talks about similar issue and is marked as
resolved, but it seems that the fix was only relative to sendError and not
sendRedirect.

-- 
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 55688] SendRedirect does not work with AsyncContext

2013-10-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55688

Vikram vicky...@gmail.com changed:

   What|Removed |Added

 CC||vicky...@gmail.com
 OS||All

-- 
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 55688] SendRedirect does not work with AsyncContext

2013-10-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55688

--- Comment #1 from Vikram vicky...@gmail.com ---
Some more details, my sample servlet get code looks like this,

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse response)
throws ServletException, IOException {
req.setAttribute(org.apache.catalina.ASYNC_SUPPORTED, true);

AsyncContext asyncContext = req.startAsync();
asyncContext.setTimeout(1);

HttpServletResponse httpServletResponse =
(HttpServletResponse)asyncContext.getResponse();
try {
httpServletResponse.sendRedirect(http://www.google.com/;);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}

-- 
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 55688] SendRedirect does not work with AsyncContext

2013-10-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55688

Vikram vicky...@gmail.com changed:

   What|Removed |Added

 OS|All |Windows 7

-- 
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: r1534566 - /tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java

2013-10-22 Thread kfujino
Author: kfujino
Date: Tue Oct 22 09:39:30 2013
New Revision: 1534566

URL: http://svn.apache.org/r1534566
Log:
The logger of AbstractReplicatedMap should be non-static in order to enable 
logging of each application.

Modified:

tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java

Modified: 
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java?rev=1534566r1=1534565r2=1534566view=diff
==
--- 
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java 
(original)
+++ 
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java 
Tue Oct 22 09:39:30 2013
@@ -56,7 +56,7 @@ public abstract class AbstractReplicated
 
 private static final long serialVersionUID = 1L;
 
-private static final Log log = 
LogFactory.getLog(AbstractReplicatedMap.class);
+private final Log log = LogFactory.getLog(AbstractReplicatedMap.class);
 
 /**
  * The default initial capacity - MUST be a power of two.
@@ -1375,8 +1375,7 @@ public abstract class AbstractReplicated
 try {
 return key(null);
 } catch ( Exception x ) {
-log.error(Deserialization error of the MapMessage.key,x);
-return null;
+throw new RuntimeException(Deserialization error of the 
MapMessage.key, x);
 }
 }
 
@@ -1396,8 +1395,7 @@ public abstract class AbstractReplicated
 try {
 return value(null);
 } catch ( Exception x ) {
-log.error(Deserialization error of the MapMessage.value,x);
-return null;
+throw new RuntimeException(Deserialization error of the 
MapMessage.value, x);
 }
 }
 



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



svn commit: r1534572 - /tomcat/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java

2013-10-22 Thread kfujino
Author: kfujino
Date: Tue Oct 22 09:42:08 2013
New Revision: 1534572

URL: http://svn.apache.org/r1534572
Log:
follow-up r1534566.

Modified:
tomcat/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java

Modified: 
tomcat/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java?rev=1534572r1=1534571r2=1534572view=diff
==
--- tomcat/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java 
Tue Oct 22 09:42:08 2013
@@ -65,7 +65,7 @@ import org.apache.juli.logging.LogFactor
  */
 public class LazyReplicatedMapK,V extends AbstractReplicatedMapK,V {
 private static final long serialVersionUID = 1L;
-private static final Log log = LogFactory.getLog(LazyReplicatedMap.class);
+private final Log log = LogFactory.getLog(LazyReplicatedMap.class);
 
 
 
//--



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



svn commit: r1534575 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java webapps/docs/changelog.xm

2013-10-22 Thread kfujino
Author: kfujino
Date: Tue Oct 22 09:45:25 2013
New Revision: 1534575

URL: http://svn.apache.org/r1534575
Log:
The logger of AbstractReplicatedMap should be non-static in order to enable 
logging of each application.

Modified:

tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java

tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java?rev=1534575r1=1534574r2=1534575view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
 Tue Oct 22 09:45:25 2013
@@ -57,7 +57,7 @@ import org.apache.juli.logging.LogFactor
 public abstract class AbstractReplicatedMap extends ConcurrentHashMap 
implements RpcCallback, ChannelListener, MembershipListener, Heartbeat {
 private static final long serialVersionUID = 1L;
 
-private static final Log log = 
LogFactory.getLog(AbstractReplicatedMap.class);
+private final Log log = LogFactory.getLog(AbstractReplicatedMap.class);
 
 /**
  * The default initial capacity - MUST be a power of two.
@@ -1396,8 +1396,7 @@ public abstract class AbstractReplicated
 try {
 return key(null);
 } catch ( Exception x ) {
-log.error(Deserialization error of the MapMessage.key,x);
-return null;
+throw new RuntimeException(Deserialization error of the 
MapMessage.key, x);
 }
 }
 
@@ -1417,8 +1416,7 @@ public abstract class AbstractReplicated
 try {
 return value(null);
 } catch ( Exception x ) {
-log.error(Deserialization error of the MapMessage.value,x);
-return null;
+throw new RuntimeException(Deserialization error of the 
MapMessage.value, x);
 }
 }
 

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java?rev=1534575r1=1534574r2=1534575view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
 Tue Oct 22 09:45:25 2013
@@ -65,7 +65,7 @@ import org.apache.juli.logging.LogFactor
  */
 public class LazyReplicatedMap extends AbstractReplicatedMap {
 private static final long serialVersionUID = 1L;
-private static final Log log = LogFactory.getLog(LazyReplicatedMap.class);
+private final Log log = LogFactory.getLog(LazyReplicatedMap.class);
 
 
 
//--


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=1534575r1=1534574r2=1534575view=diff
==
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Oct 22 09:45:25 2013
@@ -86,6 +86,10 @@
 Add log message that initialization of
 codeAbstractReplicatedMap/code has been completed. (kfujino)
   /add
+  fix
+The logger of codeAbstractReplicatedMap/code should be non-static 
in
+order to enable logging of each application. (kfujino)
+  /fix
 /changelog
   /subsection
 /section



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



Re: svn commit: r1534575 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java webapps/docs/changelo

2013-10-22 Thread Konstantin Kolinko
2013/10/22  kfuj...@apache.org:
 Author: kfujino
 Date: Tue Oct 22 09:45:25 2013
 New Revision: 1534575

 URL: http://svn.apache.org/r1534575
 Log:
 The logger of AbstractReplicatedMap should be non-static in order to enable 
 logging of each application.

 Modified:
 
 tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
 
 tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
 tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

 Modified: 
 tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
 URL: 
 http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java?rev=1534575r1=1534574r2=1534575view=diff
 ==
 --- 
 tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
  (original)
 +++ 
 tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
  Tue Oct 22 09:45:25 2013
 @@ -57,7 +57,7 @@ import org.apache.juli.logging.LogFactor
  public abstract class AbstractReplicatedMap extends ConcurrentHashMap 
 implements RpcCallback, ChannelListener, MembershipListener, Heartbeat {
  private static final long serialVersionUID = 1L;

 -private static final Log log = 
 LogFactory.getLog(AbstractReplicatedMap.class);
 +private final Log log = LogFactory.getLog(AbstractReplicatedMap.class);


OK.


  /**
   * The default initial capacity - MUST be a power of two.
 @@ -1396,8 +1396,7 @@ public abstract class AbstractReplicated
  try {
  return key(null);
  } catch ( Exception x ) {
 -log.error(Deserialization error of the MapMessage.key,x);
 -return null;
 +throw new RuntimeException(Deserialization error of the 
 MapMessage.key, x);
  }
  }

 @@ -1417,8 +1416,7 @@ public abstract class AbstractReplicated
  try {
  return value(null);
  } catch ( Exception x ) {
 -log.error(Deserialization error of the MapMessage.value,x);
 -return null;
 +throw new RuntimeException(Deserialization error of the 
 MapMessage.value, x);

Are the above changes to exception handling intended? They are not
mentioned in the commit message, nor in the changelog.


Best regards,
Konstantin Kolinko


  }
  }


 Modified: 
 tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
 URL: 
 http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java?rev=1534575r1=1534574r2=1534575view=diff
 ==
 --- 
 tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
  (original)
 +++ 
 tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
  Tue Oct 22 09:45:25 2013
 @@ -65,7 +65,7 @@ import org.apache.juli.logging.LogFactor
   */
  public class LazyReplicatedMap extends AbstractReplicatedMap {
  private static final long serialVersionUID = 1L;
 -private static final Log log = 
 LogFactory.getLog(LazyReplicatedMap.class);
 +private final Log log = LogFactory.getLog(LazyReplicatedMap.class);


  
 //--

 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=1534575r1=1534574r2=1534575view=diff
 ==
 --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
 +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Oct 22 09:45:25 2013
 @@ -86,6 +86,10 @@
  Add log message that initialization of
  codeAbstractReplicatedMap/code has been completed. (kfujino)
/add
 +  fix
 +The logger of codeAbstractReplicatedMap/code should be 
 non-static in
 +order to enable logging of each application. (kfujino)
 +  /fix
  /changelog
/subsection
  /section



 -
 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



svn commit: r1534612 - /tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java

2013-10-22 Thread markt
Author: markt
Date: Tue Oct 22 12:24:06 2013
New Revision: 1534612

URL: http://svn.apache.org/r1534612
Log:
Improve debug logging of SocketWrapper that just uses toString()

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java?rev=1534612r1=1534611r2=1534612view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java Tue Oct 22 
12:24:06 2013
@@ -162,4 +162,16 @@ public class SocketWrapperE {
 this.timeout = timeout;
 upgraded = false;
 }
+
+/**
+ * Overridden for debug purposes. No guarantees are made about the format 
of
+ * this message which may vary significantly between poitn releases.
+ * p
+ * {@inheritDoc}
+ */
+@Override
+public String toString() {
+return super.toString() + : +
+(socket == null ? null : socket.toString());
+}
 }



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



Re: svn commit: r1534612 - /tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java

2013-10-22 Thread Konstantin Kolinko
2013/10/22  ma...@apache.org:
 Author: markt
 Date: Tue Oct 22 12:24:06 2013
 New Revision: 1534612

 URL: http://svn.apache.org/r1534612
 Log:
 Improve debug logging of SocketWrapper that just uses toString()

 Modified:
 tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java

 Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java
 URL: 
 http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java?rev=1534612r1=1534611r2=1534612view=diff
 ==
 --- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java (original)
 +++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java Tue Oct 
 22 12:24:06 2013
 @@ -162,4 +162,16 @@ public class SocketWrapperE {
  this.timeout = timeout;
  upgraded = false;
  }
 +
 +/**
 + * Overridden for debug purposes. No guarantees are made about the 
 format of
 + * this message which may vary significantly between poitn releases.

s/poitn/point/

 + * p
 + * {@inheritDoc}
 + */
 +@Override
 +public String toString() {
 +return super.toString() + : +
 +(socket == null ? null : socket.toString());

String.valueOf(socket) will print the same with less code.

 +}
  }



 -
 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



svn commit: r1534616 - /tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java

2013-10-22 Thread markt
Author: markt
Date: Tue Oct 22 12:43:24 2013
New Revision: 1534616

URL: http://svn.apache.org/r1534616
Log:
kkolinko review
Fix typo
Use less code

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java?rev=1534616r1=1534615r2=1534616view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java Tue Oct 22 
12:43:24 2013
@@ -165,13 +165,12 @@ public class SocketWrapperE {
 
 /**
  * Overridden for debug purposes. No guarantees are made about the format 
of
- * this message which may vary significantly between poitn releases.
+ * this message which may vary significantly between point releases.
  * p
  * {@inheritDoc}
  */
 @Override
 public String toString() {
-return super.toString() + : +
-(socket == null ? null : socket.toString());
+return super.toString() + : + String.valueOf(socket);
 }
 }



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



o.a.c.c.Request.getParameterMap duplicates a pre-existing parameters Map

2013-10-22 Thread Christopher Schultz
All,

I was reading-through the request-parameters processing code and I
noticed that while the Parameters class is used to build a Map of
parameter names - value arrays, that same Map is not used when
Request.getParameterNames is called.

Instead, Request.getParameterNames builds a copy of that same Map and
returns it:

public MapString, String[] getParameterMap() {

if (parameterMap.isLocked()) {
return parameterMap;
}

EnumerationString enumeration = getParameterNames();
while (enumeration.hasMoreElements()) {
String name = enumeration.nextElement();
String[] values = getParameterValues(name);
parameterMap.put(name, values);
}

parameterMap.setLocked(true);

return parameterMap;

}

Is there any particular reason not to return the internal Map from the
Parameters class? Spec says that the Map should be immutable, but that
can be easily done in a number of ways.

Is the map being defensively-copied so that the client code can't
destroy the internal representation? That's the only reason I can think
of for this behavior.

I was just thinking that the copy technique of course requires twice
the memory (and a bit of CPU time for the copy) for request parameters
in any request that calls any of the getParameter* family of calls.

I don't have any performance data but I'm wondering if anyone might want
to be able to disable this defensive-copy perhaps in a trusted
environment to squeeze a bit more performance out of their server.

Any comments? I'm not suggesting a patch just yet... just wondering if
anyone has any thoughts on the subject.

Thanks,
-chris



signature.asc
Description: OpenPGP digital signature


[Bug 55686] make request.getParameterNames() and request.getParameterMap ordered

2013-10-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55686

--- Comment #4 from Christopher Schultz ch...@christopherschultz.net ---
The fix for bug #55576 might not entirely fix this enhancement as written.

For example, in this case:

/path/to/servlet?a=1b=2c=3a=4

One might expect the return value of getParameterNames to be:

[ a, b, c, a ]

...but it will instead be [ a, b, c ].

Ordering the parameter map has the same problem, but there is absolutely
nothing to be done about that AFAICT.

I'm not suggesting that either of the above problems can be fixed... I just
wanted to point-out the possible expectations users might have and how those
expectations can't necessarily be met.

-- 
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: r1534619 - in /tomcat/trunk/java/org/apache/coyote/http11/upgrade: AprServletInputStream.java LocalStrings.properties

2013-10-22 Thread markt
Author: markt
Date: Tue Oct 22 12:54:33 2013
New Revision: 1534619

URL: http://svn.apache.org/r1534619
Log:
Latest attempt to address issues with APR/native, SSL and the drawboard example

Modified:

tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java
tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java?rev=1534619r1=1534618r2=1534619view=diff
==
--- 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java 
(original)
+++ 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java 
Tue Oct 22 12:54:33 2013
@@ -21,6 +21,8 @@ import java.io.IOException;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
 
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.jni.OS;
 import org.apache.tomcat.jni.Socket;
 import org.apache.tomcat.jni.Status;
@@ -28,6 +30,8 @@ import org.apache.tomcat.util.net.Socket
 
 public class AprServletInputStream extends AbstractServletInputStream {
 
+private static final Log log = 
LogFactory.getLog(AprServletInputStream.class);
+
 private final SocketWrapperLong wrapper;
 private final long socket;
 private volatile boolean eagain = false;
@@ -92,6 +96,16 @@ public class AprServletInputStream exten
 } else if (-result == Status.EAGAIN) {
 eagain = true;
 return 0;
+} else if (-result == Status.APR_EGENERAL  wrapper.isSecure()) {
+// Not entirely sure why this is necessary. Testing to date has not
+// identified any issues with this but log it so it can be tracked
+// if it is suspected of causing issues in the future.
+if (log.isDebugEnabled()) {
+log.debug(sm.getString(apr.read.sslGeneralError,
+Long.valueOf(socket), wrapper));
+}
+eagain = true;
+return 0;
 } else if (-result == Status.APR_EOF) {
 throw new EOFException(sm.getString(apr.clientAbort));
 } else if ((OS.IS_WIN32 || OS.IS_WIN64) 

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties?rev=1534619r1=1534618r2=1534619view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties 
Tue Oct 22 12:54:33 2013
@@ -26,6 +26,7 @@ upgrade.sis.write.ise=It is illegal to c
 
 apr.clientAbort=The client aborted the connection.
 apr.read.error=Unexpected error [{0}] reading data from the APR/native socket 
[{1}] with wrapper [{2}].
+apr.read.sslGeneralError=An APR general error was returned by the SSL read 
operation on APR/native socket [{0}] with wrapper [{1}]. It will be treated as 
EAGAIN and the socket returned to the poller.
 apr.write.error=Unexpected error [{0}] writing data to the APR/native socket 
[{1}] with wrapper [{2}].
 apr.closed=The socket [{0}] associated with this connection has been closed.
 



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



Re: Tomcat closes Websocket connection when using a SSL HTTP APR connector (was: RE: Tagging 7.0.46)

2013-10-22 Thread Mark Thomas
On 21/10/2013 15:26, Mark Thomas wrote:
 On 19/10/2013 23:31, Mark Thomas wrote:
 On 18/10/2013 19:37, Mark Thomas wrote:
 On 18/10/2013 13:54, Mark Thomas wrote:
 On 18/10/2013 12:48, Mark Thomas wrote:
 When it goes wrong, the sequence is:
 Read result [1]
 Read result [48]
 Read result [-20014]
 18-Oct-2013 12:23:25.298 SEVERE [http-apr-8443-exec-1]
 websocket.drawboard.DrawboardEndpoint.onError onError:
 java.io.IOException: Unexpected error [20,014] reading data from the
 APR/native socket [364,180,784].

 I've dug in to what could trigger the 20014 error code. I've got as far
 as ssl_socket_recv() in native\src\sslnetwork.c

 There appear to be a number of ways that the code could end up returning
 20014. The next step is to figure out which it is.

 I've made some progress. I've captured a failure with Wireshark with an
 SSL configuration that Wireshark can decrypt with the server's private
 key (SSLProtocol=SSLv3, SSLCipherSuite=RC4-MD5) and it shows nothing
 unusual until Tomcat initiates the close.

 To progress I need to create a new tcnative with some debug info so I
 guess I'll have to return to trying to get my local build environment
 set up correctly.

 No joy getting a Windows build environment created but the error also
 occurs on Linux and I do have a working build environment there. The
 various errors reported in ssl_socket_recv() are:

 SSL_READ returns -1
 SSL_get_error returns 5 (SSL_ERROR_SYSCALL)
 apr_get_netos_error returns 11 (APR_STATUS_IS_ENOTSOCK)

 At this point it looks like the issue is in the tcnative / APR / OpenSSL
 integration and I am way out of my depth.

 Looking at the source code for APR reads, the InternalAprInputBuffer
 uses Socket.recvbb() whereas AprServletInputStream current uses
 Socket.recv(). My short-term plan is to switch AprServletInputStream to
 Socket.recvbb() for SSL and see if that fixes the problem.
 
 It doesn't. I have removed the code that swallowed this error and the
 easiest way to reproduce it is to open the drawing board app and hold
 down F5 to refresh the page.
 
 I'm going to spend a little more time looking at the Tomcat side of this
 but I'm fairly sure it is going to need someone more familiar with C to
 provide some pointers.

Having tested various theories as to why this was happened I tried
tested the theory is isn't an error, carry on and that appears to
have worked. Treating the error in the same manner as EAGAIN does not
drop the client connection and that connection continues to work.

I have added some debug logging we can enable if we suspect this is
causing problems in the future.

Mark

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



Re: Proposal for a more flexible tomcat embedding api

2013-10-22 Thread Pid
Hi,

I've already got reasonably far with a similar idea.

 https://github.com/pidster-dot-org/embed-apache-tomcat

There's a core utility for embedding Tomcat[1] and a JUnit Rule[2] for
testing that uses it, e.g.

1.
https://github.com/pidster-dot-org/embed-apache-tomcat/blob/master/embed-apache-tomcat-core/src/test/java/org/pidster/tomcat/embed/TomcatSimpleTest.java

2.
https://github.com/pidster-dot-org/embed-apache-tomcat/blob/master/embed-apache-tomcat-test/src/test/java/org/pidster/tomcat/embed/junit/TomcatServerRuleTest.java

I'd call it an alpha right now, because I need to nail the test coverage
and there's a few TODOs.

I've snuck it into Maven Central here:

 http://search.maven.org/#search%7Cga%7C1%7Corg.pidster

I'd be interested to hear feedback from the list:


p




On 9 October 2013 16:36, Adib Saikali adib.saik...@gmail.com wrote:

 I am creating the API in such a way that if an attribute was added to the
 component but not to the builder API the user of the API should be
 able to participate in the creation of the underlying tomcat component
 object and override its setting. They would have to write more code but
 could account for properties that are left out of the builder API. And when
 that happens the Java doc will encourage them to file a bug report to
 add the missing attributes to the builder api.

 I want a version 1.0 of the builder api to work with no changes to the
 existing
 tomcat apis. However, I am sure I will run into situations where changes
 to API
 might make the implementation easier, and or could be good cleanups for the
 tomcat itself, in which case I will open bug reports in bugzilla and
 explain issues
 so that they can be handled in the normal course of tomcat development.

 On 2013-10-09, at 6:59 AM, Mark Thomas ma...@apache.org wrote:

  On 09/10/2013 04:24, Adib Saikali wrote:
 
  snip/
 
  1. Has anyone already done such as API?
 
  I'm not aware of any.
 
  2. Would the tomcat committers accept an implementation of this
 proposal into
  the tomcat distribution ?
 
  The main question for me is maintainability and how much work would be
  required to handle any new attributes added to a component.
 
  3. there still time to include such an API in tomcat 8?
 
  The deadline depends on what API changes would be required to Tomcat. It
  looks like none so could be added at any point.
 
  4.  Is there any chance that such a jar would be included in the core
 tomcat 7
  distribution as an add on jar in a future 7.x point release?
 
  Again, it depends on the required API changes. The fewer the changes the
  greater the chance of inclusion.
 
  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




-- 
pidster.com


Re: websocket connection (at startup) between 2 webapps in same Tomcat 7.0.47 instance hangs indefinitely

2013-10-22 Thread Mark Thomas
On 18/10/2013 22:09, Bob DeRemer wrote:
 Hi Guys,
 
  
 
 In our implementation, we have a gateway app that uses jsr websockets to
 communication with our main application server.  In a small system, we
 want to run them both on a single Tomcat instance using the same Tomcat
 NIO connector, but directing to different respective WS paths.  This
 works fine if you deploy the MAIN first, then the GW – so that MAIN is
 already up and running.  If you restart Tomcat when both webapps are
 deployed – and the GW (client) starts first, it hangs indefinitely in
 the following code trying to establish a WS connection:
 
  
 
 Is this a bug or a known limitation when a client/server in the same
 webapp try to connect at startup?

It certainly shouldn't hang indefinitely - I'll take a look.

However, there is no guarantee made about application start order so
your code will need to handle failures and re-try after a suitable wait.

Mark


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



svn commit: r1534727 - /tomcat/trunk/webapps/docs/web-socket-howto.xml

2013-10-22 Thread markt
Author: markt
Date: Tue Oct 22 18:45:46 2013
New Revision: 1534727

URL: http://svn.apache.org/r1534727
Log:
Document client side SSL config

Modified:
tomcat/trunk/webapps/docs/web-socket-howto.xml

Modified: tomcat/trunk/webapps/docs/web-socket-howto.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/web-socket-howto.xml?rev=1534727r1=1534726r2=1534727view=diff
==
--- tomcat/trunk/webapps/docs/web-socket-howto.xml (original)
+++ tomcat/trunk/webapps/docs/web-socket-howto.xml Tue Oct 22 18:45:46 2013
@@ -81,6 +81,17 @@
codeorg.apache.tomcat.websocket.STRICT_SPEC_COMPLIANCE/code system
property to codetrue/code but any explicit setting on the servlet 
context
will always take priority./p
+
+pWhen using the WebSocket client to connect to secure server endpoints, the
+   client SSL configuration is controlled by the codeuserProperties/code
+   of the provided codejavax.websocket.ClientEndpointConfig/code. The
+   following user properties are supported:/p
+   ul
+ licodeorg.apache.tomcat.websocket.SSL_PROTOCOLS/code/li
+ licodeorg.apache.tomcat.websocket.SSL_TRUSTSTORE/code/li
+ licodeorg.apache.tomcat.websocket.SSL_TRUSTSTORE_PWD/code/li
+   /ul
+   pThe default truststore password is codechangeit/code./p
 /section
 
 /body



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



svn commit: r1534744 - in /tomcat/trunk: java/org/apache/tomcat/websocket/WsWebSocketContainer.java webapps/docs/web-socket-howto.xml

2013-10-22 Thread markt
Author: markt
Date: Tue Oct 22 19:31:11 2013
New Revision: 1534744

URL: http://svn.apache.org/r1534744
Log:
Add some timouts rather for IO operations while establishing a WebSocket client 
connection.

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
tomcat/trunk/webapps/docs/web-socket-howto.xml

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1534744r1=1534743r2=1534744view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java Tue 
Oct 22 19:31:11 2013
@@ -47,6 +47,7 @@ import java.util.concurrent.Future;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.net.ssl.SSLContext;
@@ -87,6 +88,16 @@ public class WsWebSocketContainer
 org.apache.tomcat.websocket.SSL_TRUSTSTORE_PWD;
 public static final String SSL_TRUSTSTORE_PWD_DEFAULT = changeit;
 
+/**
+ * Property name to set to configure the timeout (in milliseconds) when
+ * establishing a WebSocket connection to server. The default is
+ * {@link #IO_TIMEOUT_MS_DEFAULT}.
+ */
+public static final String IO_TIMEOUT_MS_PROPERTY =
+org.apache.tomcat.websocket.IO_TIMEOUT_MS;
+
+public static final long IO_TIMEOUT_MS_DEFAULT = 5000;
+
 private static final StringManager sm =
 StringManager.getManager(Constants.PACKAGE_NAME);
 private static final Random random = new Random();
@@ -281,30 +292,38 @@ public class WsWebSocketContainer
 channel = new AsyncChannelWrapperNonSecure(socketChannel);
 }
 
+// Get the connection timeout
+long timeout = IO_TIMEOUT_MS_DEFAULT;
+String timeoutValue = (String) 
clientEndpointConfiguration.getUserProperties().get(
+IO_TIMEOUT_MS_PROPERTY);
+if (timeoutValue != null) {
+timeout = Long.valueOf(timeoutValue).intValue();
+}
+
 ByteBuffer response;
 String subProtocol;
 try {
-fConnect.get();
+fConnect.get(timeout, TimeUnit.MILLISECONDS);
 
 FutureVoid fHandshake = channel.handshake();
-fHandshake.get();
+fHandshake.get(timeout, TimeUnit.MILLISECONDS);
 
 int toWrite = request.limit();
 
 FutureInteger fWrite = channel.write(request);
-Integer thisWrite = fWrite.get();
+Integer thisWrite = fWrite.get(timeout, TimeUnit.MILLISECONDS);
 toWrite -= thisWrite.intValue();
 
 while (toWrite  0) {
 fWrite = channel.write(request);
-thisWrite = fWrite.get();
+thisWrite = fWrite.get(timeout, TimeUnit.MILLISECONDS);
 toWrite -= thisWrite.intValue();
 }
 // Same size as the WsFrame input buffer
 response = ByteBuffer.allocate(maxBinaryMessageBufferSize);
 
 HandshakeResponse handshakeResponse =
-processResponse(response, channel);
+processResponse(response, channel, timeout);
 clientEndpointConfiguration.getConfigurator().
 afterResponse(handshakeResponse);
 
@@ -321,7 +340,7 @@ public class WsWebSocketContainer
 sm.getString(Sec-WebSocket-Protocol));
 }
 } catch (ExecutionException | InterruptedException | SSLException |
-EOFException e) {
+EOFException | TimeoutException e) {
 throw new DeploymentException(
 sm.getString(wsWebSocketContainer.httpRequestFailed), e);
 }
@@ -533,10 +552,12 @@ public class WsWebSocketContainer
  * @throws ExecutionException
  * @throws InterruptedException
  * @throws DeploymentException
+ * @throws TimeoutException
  */
 private HandshakeResponse processResponse(ByteBuffer response,
-AsyncChannelWrapper channel) throws InterruptedException,
-ExecutionException, DeploymentException, EOFException {
+AsyncChannelWrapper channel, long timeout) throws 
InterruptedException,
+ExecutionException, DeploymentException, EOFException,
+TimeoutException {
 
 MapString,ListString headers = new HashMap();
 
@@ -546,7 +567,7 @@ public class WsWebSocketContainer
 while (!readHeaders) {
 // Blocking read
 FutureInteger read = channel.read(response);
-Integer bytesRead = read.get();
+Integer bytesRead = 

Re: websocket connection (at startup) between 2 webapps in same Tomcat 7.0.47 instance hangs indefinitely

2013-10-22 Thread Mark Thomas
On 22/10/2013 16:17, Mark Thomas wrote:
 On 18/10/2013 22:09, Bob DeRemer wrote:
 Hi Guys,

  

 In our implementation, we have a gateway app that uses jsr websockets to
 communication with our main application server.  In a small system, we
 want to run them both on a single Tomcat instance using the same Tomcat
 NIO connector, but directing to different respective WS paths.  This
 works fine if you deploy the MAIN first, then the GW – so that MAIN is
 already up and running.  If you restart Tomcat when both webapps are
 deployed – and the GW (client) starts first, it hangs indefinitely in
 the following code trying to establish a WS connection:

  

 Is this a bug or a known limitation when a client/server in the same
 webapp try to connect at startup?
 
 It certainly shouldn't hang indefinitely - I'll take a look.

I have fixed the indefinite hang. There is now a user configurable IO
timeout the defaults to 5 seconds.

If you enable parallel starting of containers (set startStopThreads on
the host to more than 1) you might be able to work around this but I
haven't tested it.

To avoid random timing issues, you'll still need to handle the failure
and retry after a short wait.

Mark

 
 However, there is no guarantee made about application start order so
 your code will need to handle failures and re-try after a suitable wait.
 
 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



svn commit: r1534751 - in /tomcat/tc7.0.x/trunk: ./ webapps/docs/changelog.xml webapps/docs/web-socket-howto.xml

2013-10-22 Thread markt
Author: markt
Date: Tue Oct 22 19:36:46 2013
New Revision: 1534751

URL: http://svn.apache.org/r1534751
Log:
Document client side SSL config

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
tomcat/tc7.0.x/trunk/webapps/docs/web-socket-howto.xml

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

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=1534751r1=1534750r2=1534751view=diff
==
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Oct 22 19:36:46 2013
@@ -92,6 +92,14 @@
   /fix
 /changelog
   /subsection
+  subsection
+changelog
+  add
+Add some documentation on the SSL configuration options for WebSocket
+clients. (markt)
+  /add
+/changelog
+  /subsection
 /section
 section name=Tomcat 7.0.47 (violetagg)
   subsection name=Coyote

Modified: tomcat/tc7.0.x/trunk/webapps/docs/web-socket-howto.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/web-socket-howto.xml?rev=1534751r1=1534750r2=1534751view=diff
==
--- tomcat/tc7.0.x/trunk/webapps/docs/web-socket-howto.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/web-socket-howto.xml Tue Oct 22 19:36:46 
2013
@@ -84,6 +84,17 @@
codeorg.apache.tomcat.websocket.STRICT_SPEC_COMPLIANCE/code system
property to codetrue/code but any explicit setting on the servlet 
context
will always take priority./p
+
+pWhen using the WebSocket client to connect to secure server endpoints, the
+   client SSL configuration is controlled by the codeuserProperties/code
+   of the provided codejavax.websocket.ClientEndpointConfig/code. The
+   following user properties are supported:/p
+   ul
+ licodeorg.apache.tomcat.websocket.SSL_PROTOCOLS/code/li
+ licodeorg.apache.tomcat.websocket.SSL_TRUSTSTORE/code/li
+ licodeorg.apache.tomcat.websocket.SSL_TRUSTSTORE_PWD/code/li
+   /ul
+   pThe default truststore password is codechangeit/code./p
 /section
 
 section name=Deprecated proprietary API



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



svn commit: r1534752 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/websocket/WsWebSocketContainer.java webapps/docs/web-socket-howto.xml

2013-10-22 Thread markt
Author: markt
Date: Tue Oct 22 19:38:33 2013
New Revision: 1534752

URL: http://svn.apache.org/r1534752
Log:
Add some timouts rather for IO operations while establishing a WebSocket client 
connection.

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

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
tomcat/tc7.0.x/trunk/webapps/docs/web-socket-howto.xml

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

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1534752r1=1534751r2=1534752view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 
Tue Oct 22 19:38:33 2013
@@ -47,6 +47,7 @@ import java.util.concurrent.Future;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.net.ssl.SSLContext;
@@ -87,6 +88,16 @@ public class WsWebSocketContainer
 org.apache.tomcat.websocket.SSL_TRUSTSTORE_PWD;
 public static final String SSL_TRUSTSTORE_PWD_DEFAULT = changeit;
 
+/**
+ * Property name to set to configure the timeout (in milliseconds) when
+ * establishing a WebSocket connection to server. The default is
+ * {@link #IO_TIMEOUT_MS_DEFAULT}.
+ */
+public static final String IO_TIMEOUT_MS_PROPERTY =
+org.apache.tomcat.websocket.IO_TIMEOUT_MS;
+
+public static final long IO_TIMEOUT_MS_DEFAULT = 5000;
+
 private static final StringManager sm =
 StringManager.getManager(Constants.PACKAGE_NAME);
 private static final Random random = new Random();
@@ -292,30 +303,38 @@ public class WsWebSocketContainer
 channel = new AsyncChannelWrapperNonSecure(socketChannel);
 }
 
+// Get the connection timeout
+long timeout = IO_TIMEOUT_MS_DEFAULT;
+String timeoutValue = (String) 
clientEndpointConfiguration.getUserProperties().get(
+IO_TIMEOUT_MS_PROPERTY);
+if (timeoutValue != null) {
+timeout = Long.valueOf(timeoutValue).intValue();
+}
+
 ByteBuffer response;
 String subProtocol;
 try {
-fConnect.get();
+fConnect.get(timeout, TimeUnit.MILLISECONDS);
 
 FutureVoid fHandshake = channel.handshake();
-fHandshake.get();
+fHandshake.get(timeout, TimeUnit.MILLISECONDS);
 
 int toWrite = request.limit();
 
 FutureInteger fWrite = channel.write(request);
-Integer thisWrite = fWrite.get();
+Integer thisWrite = fWrite.get(timeout, TimeUnit.MILLISECONDS);
 toWrite -= thisWrite.intValue();
 
 while (toWrite  0) {
 fWrite = channel.write(request);
-thisWrite = fWrite.get();
+thisWrite = fWrite.get(timeout, TimeUnit.MILLISECONDS);
 toWrite -= thisWrite.intValue();
 }
 // Same size as the WsFrame input buffer
 response = ByteBuffer.allocate(maxBinaryMessageBufferSize);
 
 HandshakeResponse handshakeResponse =
-processResponse(response, channel);
+processResponse(response, channel, timeout);
 clientEndpointConfiguration.getConfigurator().
 afterResponse(handshakeResponse);
 
@@ -343,6 +362,9 @@ public class WsWebSocketContainer
 } catch (EOFException e) {
 throw new DeploymentException(
 sm.getString(wsWebSocketContainer.httpRequestFailed), e);
+} catch (TimeoutException e) {
+throw new DeploymentException(
+sm.getString(wsWebSocketContainer.httpRequestFailed), e);
 }
 
 // Switch to WebSocket
@@ -552,10 +574,12 @@ public class WsWebSocketContainer
  * @throws ExecutionException
  * @throws InterruptedException
  * @throws DeploymentException
+ * @throws TimeoutException
  */
 private HandshakeResponse processResponse(ByteBuffer response,
-AsyncChannelWrapper channel) throws InterruptedException,
-ExecutionException, DeploymentException, EOFException {
+AsyncChannelWrapper channel, long timeout) throws 
InterruptedException,
+ExecutionException, DeploymentException, EOFException,
+TimeoutException {
 
 MapString,ListString headers = new HashMapString, ListString();
 
@@ -565,7 

RE: websocket connection (at startup) between 2 webapps in same Tomcat 7.0.47 instance hangs indefinitely

2013-10-22 Thread Bob DeRemer


 -Original Message-
 From: Mark Thomas [mailto:ma...@apache.org]
 Sent: Tuesday, October 22, 2013 3:34 PM
 To: Tomcat Developers List
 Subject: Re: websocket connection (at startup) between 2 webapps in same
 Tomcat 7.0.47 instance hangs indefinitely
 
 On 22/10/2013 16:17, Mark Thomas wrote:
  On 18/10/2013 22:09, Bob DeRemer wrote:
  Hi Guys,
 
 
 
  In our implementation, we have a gateway app that uses jsr websockets
  to communication with our main application server.  In a small
  system, we want to run them both on a single Tomcat instance using
  the same Tomcat NIO connector, but directing to different respective
  WS paths.  This works fine if you deploy the MAIN first, then the GW
  - so that MAIN is already up and running.  If you restart Tomcat when
  both webapps are deployed - and the GW (client) starts first, it
  hangs indefinitely in the following code trying to establish a WS 
  connection:
 
 
 
  Is this a bug or a known limitation when a client/server in the same
  webapp try to connect at startup?
 
  It certainly shouldn't hang indefinitely - I'll take a look.
 
 I have fixed the indefinite hang. There is now a user configurable IO timeout
 the defaults to 5 seconds.
 
 If you enable parallel starting of containers (set startStopThreads on the 
 host to
 more than 1) you might be able to work around this but I haven't tested it.
 
 To avoid random timing issues, you'll still need to handle the failure and 
 retry
 after a short wait.
 

Outta curiosity, what was going on?  Also, will this be in 7.0.48?
Thx for such a quick turnaround - bob

 Mark
 
 
  However, there is no guarantee made about application start order so
  your code will need to handle failures and re-try after a suitable wait.
 
  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


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



Re: websocket connection (at startup) between 2 webapps in same Tomcat 7.0.47 instance hangs indefinitely

2013-10-22 Thread Mark Thomas
On 22/10/2013 20:41, Bob DeRemer wrote:
 
 
 -Original Message-
 From: Mark Thomas [mailto:ma...@apache.org]
 Sent: Tuesday, October 22, 2013 3:34 PM
 To: Tomcat Developers List
 Subject: Re: websocket connection (at startup) between 2 webapps in same
 Tomcat 7.0.47 instance hangs indefinitely

 On 22/10/2013 16:17, Mark Thomas wrote:
 On 18/10/2013 22:09, Bob DeRemer wrote:
 Hi Guys,



 In our implementation, we have a gateway app that uses jsr websockets
 to communication with our main application server.  In a small
 system, we want to run them both on a single Tomcat instance using
 the same Tomcat NIO connector, but directing to different respective
 WS paths.  This works fine if you deploy the MAIN first, then the GW
 - so that MAIN is already up and running.  If you restart Tomcat when
 both webapps are deployed - and the GW (client) starts first, it
 hangs indefinitely in the following code trying to establish a WS 
 connection:



 Is this a bug or a known limitation when a client/server in the same
 webapp try to connect at startup?

 It certainly shouldn't hang indefinitely - I'll take a look.

 I have fixed the indefinite hang. There is now a user configurable IO timeout
 the defaults to 5 seconds.

 If you enable parallel starting of containers (set startStopThreads on the 
 host to
 more than 1) you might be able to work around this but I haven't tested it.

 To avoid random timing issues, you'll still need to handle the failure and 
 retry
 after a short wait.

 
 Outta curiosity, what was going on?  Also, will this be in 7.0.48?
 Thx for such a quick turnaround - bob

All the IO was configured to use infinite timeouts (that would be my fault).

The client app started, made an HTTP request to initiate the connection.

The connector was listening on the socket since init() has been called
(default is to bind on init) but the acceptor thread had not been
started so the connection was not processed.

The client then started to block, waiting for the response.

Since the client was in a ServletContextListener it blocked. That in
turn blocked the start of the content which in turn blocked the styart
sequence.

Since the start sequence was blocked the connectors were never going to
be started which is when the acceptors start so you had a deadlock.

The reason it worked when you deployed while Tomcat was running was that
the connectors were all up and running handling connections so nothing
blocked.

This was never going to work regardless of the order the apps start in
because the acceptor doesn't start until after all the web applications
have started.

Yes, I have just back-ported it to 7.0.48.

Mark


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



RE: websocket connection (at startup) between 2 webapps in same Tomcat 7.0.47 instance hangs indefinitely

2013-10-22 Thread Bob DeRemer


 -Original Message-
 From: Mark Thomas [mailto:ma...@apache.org]
 Sent: Tuesday, October 22, 2013 4:00 PM
 To: Tomcat Developers List
 Subject: Re: websocket connection (at startup) between 2 webapps in same
 Tomcat 7.0.47 instance hangs indefinitely
 
 On 22/10/2013 20:41, Bob DeRemer wrote:
 
 
  -Original Message-
  From: Mark Thomas [mailto:ma...@apache.org]
  Sent: Tuesday, October 22, 2013 3:34 PM
  To: Tomcat Developers List
  Subject: Re: websocket connection (at startup) between 2 webapps in
  same Tomcat 7.0.47 instance hangs indefinitely
 
  On 22/10/2013 16:17, Mark Thomas wrote:
  On 18/10/2013 22:09, Bob DeRemer wrote:
  Hi Guys,
 
 
 
  In our implementation, we have a gateway app that uses jsr
  websockets to communication with our main application server.  In a
  small system, we want to run them both on a single Tomcat instance
  using the same Tomcat NIO connector, but directing to different
  respective WS paths.  This works fine if you deploy the MAIN first,
  then the GW
  - so that MAIN is already up and running.  If you restart Tomcat
  when both webapps are deployed - and the GW (client) starts first,
  it hangs indefinitely in the following code trying to establish a WS
 connection:
 
 
 
  Is this a bug or a known limitation when a client/server in the
  same webapp try to connect at startup?
 
  It certainly shouldn't hang indefinitely - I'll take a look.
 
  I have fixed the indefinite hang. There is now a user configurable IO
  timeout the defaults to 5 seconds.
 
  If you enable parallel starting of containers (set startStopThreads
  on the host to more than 1) you might be able to work around this but I
 haven't tested it.
 
  To avoid random timing issues, you'll still need to handle the
  failure and retry after a short wait.
 
 
  Outta curiosity, what was going on?  Also, will this be in 7.0.48?
  Thx for such a quick turnaround - bob
 
 All the IO was configured to use infinite timeouts (that would be my fault).
 
 The client app started, made an HTTP request to initiate the connection.
 
 The connector was listening on the socket since init() has been called 
 (default is
 to bind on init) but the acceptor thread had not been started so the 
 connection
 was not processed.
 
 The client then started to block, waiting for the response.
 
 Since the client was in a ServletContextListener it blocked. That in turn 
 blocked
 the start of the content which in turn blocked the styart sequence.
 
 Since the start sequence was blocked the connectors were never going to be
 started which is when the acceptors start so you had a deadlock.
 
 The reason it worked when you deployed while Tomcat was running was that
 the connectors were all up and running handling connections so nothing
 blocked.
 
 This was never going to work regardless of the order the apps start in because
 the acceptor doesn't start until after all the web applications have started.
 
 Yes, I have just back-ported it to 7.0.48.
 
 Mark
 
Excellent - thx

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

2013-10-22 Thread Olivier Lamy
On 18 October 2013 22:14, Violeta Georgieva miles...@gmail.com wrote:
 The proposed Apache Tomcat 7.0.47 release is now available for voting.
 This release candidate contains JSR-356 Java WebSocket 1.0 implementation.
 Note that use of this functionality requires Java 7.

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

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


Tested the maven plugin and applications


 Regards
 Violeta



-- 
Olivier Lamy
Ecetera: http://ecetera.com.au
http://twitter.com/olamy | http://linkedin.com/in/olamy

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



[Bug 55691] New: javax.el.ArrayELResolver.setValue not supporting arrays of primitives

2013-10-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55691

Bug ID: 55691
   Summary: javax.el.ArrayELResolver.setValue not supporting
arrays of primitives
   Product: Tomcat 6
   Version: 6.0.37
  Hardware: All
OS: Linux
Status: NEW
  Severity: blocker
  Priority: P2
 Component: Servlet  JSP API
  Assignee: dev@tomcat.apache.org
  Reporter: taly81...@yahoo.com

was working in tomcat 6.0.20

ERROR javax.faces.context.ExceptionHandlerWrapper -
javax.faces.component.UpdateModelException: java.lang.ClassCastException:
Unable to add an object of type [java.lang.Integer] to an array of objects of
type [int]
java.lang.ClassCastException: Unable to add an object of type
[java.lang.Integer] to an array of objects of type [int]
at javax.el.ArrayELResolver.setValue(ArrayELResolver.java:94)
at
com.sun.faces.el.DemuxCompositeELResolver._setValue(DemuxCompositeELResolver.java:255)
at
com.sun.faces.el.DemuxCompositeELResolver.setValue(DemuxCompositeELResolver.java:281)
at org.apache.el.parser.AstValue.setValue(AstValue.java:158)
at org.apache.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
at
com.sun.faces.facelets.el.TagValueExpression.setValue(TagValueExpression.java:131)
at javax.faces.component.UIInput.updateModel(UIInput.java:818)
at javax.faces.component.UIInput.processUpdates(UIInput.java:735)
at javax.faces.component.UIData.iterate(UIData.java:2001)
at javax.faces.component.UIData.processUpdates(UIData.java:1253)
at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1242)
at javax.faces.component.UIForm.processUpdates(UIForm.java:281)
at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1242)
at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1242)
at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:1231)
at
com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

-- 
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: r1534846 - in /tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard: Client.java DrawboardEndpoint.java Room.java

2013-10-22 Thread kpreisser
Author: kpreisser
Date: Tue Oct 22 23:29:14 2013
New Revision: 1534846

URL: http://svn.apache.org/r1534846
Log:
- Prevent recursive invocation of Runnables by Room.invokeAndWait() to prevent 
errors like ConcurrentModificationException when Room.broadcastRoomMessage() 
iterates over an ArrayList and then calls Room.invokeAndWait() recursivly, 
iterating again over the array.
- Add comment about blocking Session.close() method.

Modified:

tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java

tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java

Modified: 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java?rev=1534846r1=1534845r2=1534846view=diff
==
--- 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java 
(original)
+++ 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java 
Tue Oct 22 23:29:14 2013
@@ -105,6 +105,17 @@ public class Client {
 CloseCodes.VIOLATED_POLICY,
 Send Buffer exceeded);
 try {
+// TODO: close() may block if the remote endpoint 
doesn't read the data
+// (eventually there will be a TimeoutException). 
However, this method
+// (sendMessage) is intended to run asynchronous 
code and shouldn't
+// block. Otherwise it would temporarily stop 
processing of messages
+// from other clients.
+// Maybe call this method on another thread.
+// Note that when this method is called, the 
RemoteEndpoint.Async
+// is still in the process of sending data, so 
there probably should
+// be another way to abort the Websocket 
connection.
+// Ideally, there should be some abort() method 
that cancels the
+// connection immediately...
 session.close(cr);
 } catch (IOException e) {
 // Ignore
@@ -184,6 +195,21 @@ public class Client {
 private final SendHandler sendHandler = new SendHandler() {
 @Override
 public void onResult(SendResult result) {
+if (!result.isOK()) {
+// Message could not be sent. In this case, we don't
+// set isSendingMessage to false because we must assume the 
connection
+// broke (and onClose will be called), so we don't try to send
+// other messages.
+// As a precaution, we close the session (e.g. if a send 
timeout occured).
+// TODO: session.close() blocks, while this handler shouldn't 
block.
+// Ideally, there should be some abort() method that cancels 
the
+// connection immediately...
+try {
+session.close();
+} catch (IOException ex) {
+// Ignore
+}
+}
 synchronized (messagesToSend) {
 
 if (!messagesToSend.isEmpty()) {

Modified: 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java?rev=1534846r1=1534845r2=1534846view=diff
==
--- 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
 (original)
+++ 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
 Tue Oct 22 23:29:14 2013
@@ -123,6 +123,11 @@ public final class DrawboardEndpoint ext
 if (player != null) {
 // Remove this player from the room.
 player.removeFromRoom();
+
+// Set player to null to prevent NPEs when 
onMessage events
+// are processed (from other threads) after 
onClose has been
+// called from different thread which closed the 
Websocket session.
+player = null;
 }
 } catch (RuntimeException ex) {
 log.error(Unexpected exception:  + ex.toString(), 
ex);

Modified: 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java
URL: 

svn commit: r1534848 - in /tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard: Client.java DrawboardEndpoint.java Room.java

2013-10-22 Thread kpreisser
Author: kpreisser
Date: Tue Oct 22 23:32:26 2013
New Revision: 1534848

URL: http://svn.apache.org/r1534848
Log:
Merged revision(s) 1534846 from tomcat/trunk:
- Prevent recursive invocation of Runnables by Room.invokeAndWait() to prevent 
errors like ConcurrentModificationException when Room.broadcastRoomMessage() 
iterates over an ArrayList and then calls Room.invokeAndWait() recursivly, 
iterating again over the array.
- Add comment about blocking Session.close() method.

Modified:

tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java

tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java

tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java

Modified: 
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java?rev=1534848r1=1534847r2=1534848view=diff
==
--- 
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java
 Tue Oct 22 23:32:26 2013
@@ -105,6 +105,17 @@ public class Client {
 CloseCodes.VIOLATED_POLICY,
 Send Buffer exceeded);
 try {
+// TODO: close() may block if the remote endpoint 
doesn't read the data
+// (eventually there will be a TimeoutException). 
However, this method
+// (sendMessage) is intended to run asynchronous 
code and shouldn't
+// block. Otherwise it would temporarily stop 
processing of messages
+// from other clients.
+// Maybe call this method on another thread.
+// Note that when this method is called, the 
RemoteEndpoint.Async
+// is still in the process of sending data, so 
there probably should
+// be another way to abort the Websocket 
connection.
+// Ideally, there should be some abort() method 
that cancels the
+// connection immediately...
 session.close(cr);
 } catch (IOException e) {
 // Ignore
@@ -188,6 +199,21 @@ public class Client {
 private final SendHandler sendHandler = new SendHandler() {
 @Override
 public void onResult(SendResult result) {
+if (!result.isOK()) {
+// Message could not be sent. In this case, we don't
+// set isSendingMessage to false because we must assume the 
connection
+// broke (and onClose will be called), so we don't try to send
+// other messages.
+// As a precaution, we close the session (e.g. if a send 
timeout occured).
+// TODO: session.close() blocks, while this handler shouldn't 
block.
+// Ideally, there should be some abort() method that cancels 
the
+// connection immediately...
+try {
+session.close();
+} catch (IOException ex) {
+// Ignore
+}
+}
 synchronized (messagesToSend) {
 
 if (!messagesToSend.isEmpty()) {

Modified: 
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java?rev=1534848r1=1534847r2=1534848view=diff
==
--- 
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
 Tue Oct 22 23:32:26 2013
@@ -123,6 +123,11 @@ public final class DrawboardEndpoint ext
 if (player != null) {
 // Remove this player from the room.
 player.removeFromRoom();
+
+// Set player to null to prevent NPEs when 
onMessage events
+// are processed (from other threads) after 
onClose has been
+// called from different thread which closed the 
Websocket session.
+player = null;
 }
 } catch (RuntimeException ex) {
 log.error(Unexpected exception:  + ex.toString(), 
ex);


[Bug 55686] make request.getParameterNames() and request.getParameterMap ordered

2013-10-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55686

--- Comment #5 from quaff zhouyanm...@gmail.com ---
@Christopher Schultz, it should be [a, b, c],and
request.getParameterValues(a) will be [1,4]

-- 
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: r1534869 - /tomcat/tc7.0.x/trunk/

2013-10-22 Thread kpreisser
Author: kpreisser
Date: Wed Oct 23 00:15:46 2013
New Revision: 1534869

URL: http://svn.apache.org/r1534869
Log:
Add mergeinfo.

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

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



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



RE: Tomcat closes Websocket connection when using a SSL HTTP APR connector (was: RE: Tagging 7.0.46)

2013-10-22 Thread Konstantin Preißer
Hi Mark,

 -Original Message-
 From: Mark Thomas [mailto:ma...@apache.org]
 Sent: Tuesday, October 22, 2013 2:57 PM
 To: Tomcat Developers List
 Subject: Re: Tomcat closes Websocket connection when using a SSL HTTP
 APR connector (was: RE: Tagging 7.0.46)
 
 On 21/10/2013 15:26, Mark Thomas wrote:
  On 19/10/2013 23:31, Mark Thomas wrote:
  On 18/10/2013 19:37, Mark Thomas wrote:
  On 18/10/2013 13:54, Mark Thomas wrote:
  On 18/10/2013 12:48, Mark Thomas wrote:
  When it goes wrong, the sequence is:
  Read result [1]
  Read result [48]
  Read result [-20014]
  18-Oct-2013 12:23:25.298 SEVERE [http-apr-8443-exec-1]
  websocket.drawboard.DrawboardEndpoint.onError onError:
  java.io.IOException: Unexpected error [20,014] reading data from the
  APR/native socket [364,180,784].
 
  I've dug in to what could trigger the 20014 error code. I've got as far
  as ssl_socket_recv() in native\src\sslnetwork.c
 
  There appear to be a number of ways that the code could end up
 returning
  20014. The next step is to figure out which it is.
 
  I've made some progress. I've captured a failure with Wireshark with an
  SSL configuration that Wireshark can decrypt with the server's private
  key (SSLProtocol=SSLv3, SSLCipherSuite=RC4-MD5) and it shows
 nothing
  unusual until Tomcat initiates the close.
 
  To progress I need to create a new tcnative with some debug info so I
  guess I'll have to return to trying to get my local build environment
  set up correctly.
 
  No joy getting a Windows build environment created but the error also
  occurs on Linux and I do have a working build environment there. The
  various errors reported in ssl_socket_recv() are:
 
  SSL_READ returns -1
  SSL_get_error returns 5 (SSL_ERROR_SYSCALL)
  apr_get_netos_error returns 11 (APR_STATUS_IS_ENOTSOCK)
 
  At this point it looks like the issue is in the tcnative / APR / OpenSSL
  integration and I am way out of my depth.
 
  Looking at the source code for APR reads, the InternalAprInputBuffer
  uses Socket.recvbb() whereas AprServletInputStream current uses
  Socket.recv(). My short-term plan is to switch AprServletInputStream to
  Socket.recvbb() for SSL and see if that fixes the problem.
 
  It doesn't. I have removed the code that swallowed this error and the
  easiest way to reproduce it is to open the drawing board app and hold
  down F5 to refresh the page.
 
  I'm going to spend a little more time looking at the Tomcat side of this
  but I'm fairly sure it is going to need someone more familiar with C to
  provide some pointers.
 
 Having tested various theories as to why this was happened I tried
 tested the theory is isn't an error, carry on and that appears to
 have worked. Treating the error in the same manner as EAGAIN does not
 drop the client connection and that connection continues to work.
 
 I have added some debug logging we can enable if we suspect this is
 causing problems in the future.
 
 Mark

Thanks a lot for fixing the problems.
I can confirm that with r1534619, I can no longer reproduce the connection 
close issue.


Regards,
Konstantin Preißer


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