Re: Tomcat 5.5.10: APR-SSL doesn't work in chrooted UML

2005-10-22 Thread Markus Schönhaber
Am Dienstag, 9. August 2005 14:37 schrieb Markus Schönhaber:
> Hello!
>
> I'm trying to run Tomcat 5.5.10 [1] on user mode linux which is started in
> a chrooted environment but Tomcat hangs when initializing the SSL-Connector
> - i. e. the message
> org.apache.coyote.http11.Http11AprProtocol init
> does never show up in the log. When I try to connect to the SSL-port the
> TCP handshake is made but no data at all is transmitted.
>
> Everything runs fine if:
> - The UML-kernel is *not* started in a chroot environment. (!)
> - APR is used but SSL is turned off (ex. the Connector has set the
> "SSLEngine" config attribute  to "off").
> - APR isn't used at all.
>
> I don't have the slightest idea why it should matter whether UML is started
> in a chroot environment or not. To tell the truth, I don't have the
> slightest idea whether it's a bug in Tomcat, APR, Tomcat's native binding
> to APR, openssl, UML or if it's myself overlooking something absolutely
> obvious.

Since there was such a tremendous amount of reactions on this topic, I can't 
help but share my findings here ;-)

OK, jokes aside. Just for the records and in case someone else stumbles over 
this issue, here's what I came up with:
The source of the problem is /dev/random. Processes running in a chroot'ed UML 
that try to read from /dev/random will get some bytes and then /dev/random 
will stall. The APR tries to read from /dev/random (to get some entropy for 
the SSL connector, I think) and this process doesn't finish - at least not in 
a reasonable time.
What helped for me was to bind-mount /dev/random into the chroot environment 
the user mode linux guest kernel is running in.

Regards
  mks

PS: It is only my machine where I experienced this problem and where the 
solution mentioned above helped to resolve it. So, YMMV.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r327657 - in /tomcat/connectors/trunk: http11/src/java/org/apache/coyote/http11/ jni/java/org/apache/tomcat/jni/ jni/native/include/ jni/native/src/ util/java/org/apache/tomcat/util/net/

2005-10-22 Thread mturk
Author: mturk
Date: Sat Oct 22 05:32:32 2005
New Revision: 327657

URL: http://svn.apache.org/viewcvs?rev=327657&view=rev
Log:
Add optimized function for send and recv using
presetting of internal ByteBuffer. This way the
number of JNI calls is lowered that gives much
higher speed, because each send or recv call now
have one function param and one JNI call less then before.

Modified:

tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java

tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Socket.java
tomcat/connectors/trunk/jni/native/include/tcn.h
tomcat/connectors/trunk/jni/native/src/network.c

tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java

Modified: 
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java
URL: 
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java?rev=327657&r1=327656&r2=327657&view=diff
==
--- 
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java
 (original)
+++ 
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java
 Sat Oct 22 05:32:32 2005
@@ -215,6 +215,7 @@
  */
 public void setSocket(long socket) {
 this.socket = socket;
+Socket.setrbb(this.socket, bbuf);
 }
 
 
@@ -405,8 +406,8 @@
 }
 // Do a simple read with a short timeout
 bbuf.clear();
-int nRead = Socket.recvbt
-(socket, bbuf, 0, buf.length - lastValid, readTimeout);
+int nRead = Socket.recvbbt
+(socket, 0, buf.length - lastValid, readTimeout);
 if (nRead > 0) {
 bbuf.limit(nRead);
 bbuf.get(buf, pos, nRead);
@@ -435,8 +436,8 @@
 }
 // Do a simple read with a short timeout
 bbuf.clear();
-int nRead = Socket.recvbt
-(socket, bbuf, 0, buf.length - lastValid, readTimeout);
+int nRead = Socket.recvbbt
+(socket, 0, buf.length - lastValid, readTimeout);
 if (nRead > 0) {
 bbuf.limit(nRead);
 bbuf.get(buf, pos, nRead);
@@ -779,8 +780,8 @@
 }
 
 bbuf.clear();
-nRead = Socket.recvb
-(socket, bbuf, 0, buf.length - lastValid);
+nRead = Socket.recvbb
+(socket, 0, buf.length - lastValid);
 if (nRead > 0) {
 bbuf.limit(nRead);
 bbuf.get(buf, pos, nRead);
@@ -799,8 +800,8 @@
 pos = 0;
 lastValid = 0;
 bbuf.clear();
-nRead = Socket.recvb
-(socket, bbuf, 0, buf.length);
+nRead = Socket.recvbb
+(socket, 0, buf.length);
 if (nRead > 0) {
 bbuf.limit(nRead);
 bbuf.get(buf, 0, nRead);

Modified: 
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL: 
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=327657&r1=327656&r2=327657&view=diff
==
--- 
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
 (original)
+++ 
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
 Sat Oct 22 05:32:32 2005
@@ -182,6 +182,7 @@
  */
 public void setSocket(long socket) {
 this.socket = socket;
+Socket.setsbb(this.socket, bbuf);
 }
 
 
@@ -694,7 +695,7 @@
 protected void flushBuffer()
 throws IOException {
 if (bbuf.position() > 0) {
-if (Socket.sendb(socket, bbuf, 0, bbuf.position()) < 0) {
+if (Socket.sendbb(socket, 0, bbuf.position()) < 0) {
 throw new IOException(sm.getString("iib.failedwrite"));
 }
 bbuf.clear();

Modified: tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Socket.java
URL: 
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Socket.java?rev=327657&r1=327656&r2=327657&view=diff
==
--- tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Socket.java 
(original)
+++ tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Socket.java Sat Oct 
22 05:32:32 2005
@@ -240,6 +240,11 @@
  */
 public static native int sendb(long sock, ByteBuffer buf,
int offset, int len);
+/*

svn commit: r327659 - /tomcat/connectors/trunk/jni/native/src/network.c

2005-10-22 Thread mturk
Author: mturk
Date: Sat Oct 22 05:55:02 2005
New Revision: 327659

URL: http://svn.apache.org/viewcvs?rev=327659&view=rev
Log:
Fix warnings for unused function parameters.
Those functions does not use JNI function params
any more.

Modified:
tomcat/connectors/trunk/jni/native/src/network.c

Modified: tomcat/connectors/trunk/jni/native/src/network.c
URL: 
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/jni/native/src/network.c?rev=327659&r1=327658&r2=327659&view=diff
==
--- tomcat/connectors/trunk/jni/native/src/network.c (original)
+++ tomcat/connectors/trunk/jni/native/src/network.c Sat Oct 22 05:55:02 2005
@@ -594,7 +594,7 @@
 apr_size_t nbytes = (apr_size_t)len;
 apr_status_t ss;
 
-UNREFERENCED(o);
+UNREFERENCED_STDARGS;
 TCN_ASSERT(sock != 0);
 TCN_ASSERT(s->opaque != NULL);
 TCN_ASSERT(s->jsbbuff != NULL);
@@ -854,7 +854,7 @@
 apr_status_t ss;
 apr_size_t nbytes = (apr_size_t)len;
 
-UNREFERENCED(o);
+UNREFERENCED_STDARGS;
 TCN_ASSERT(sock != 0);
 TCN_ASSERT(s->opaque != NULL);
 TCN_ASSERT(s->jrbbuff != NULL);
@@ -952,7 +952,7 @@
 apr_size_t nbytes = (apr_size_t)len;
 apr_interval_time_t t;
 
-UNREFERENCED(o);
+UNREFERENCED_STDARGS;
 TCN_ASSERT(sock != 0);
 TCN_ASSERT(s->jrbbuff != NULL);
 TCN_ASSERT(s->opaque != NULL);
@@ -1180,7 +1180,7 @@
 apr_hdtr_t hdrs;
 apr_status_t ss;
 
-UNREFERENCED(o);
+UNREFERENCED_STDARGS;
 TCN_ASSERT(sock != 0);
 TCN_ASSERT(file != 0);
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 37205] New: - DeployTask thinks that an exploded dir is a WAR file

2005-10-22 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37205

   Summary: DeployTask thinks that an exploded dir is a WAR file
   Product: Tomcat 5
   Version: 5.5.12
  Platform: Macintosh
OS/Version: Mac OS X 10.4
Status: NEW
  Severity: minor
  Priority: P2
 Component: Webapps:Manager
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: [EMAIL PROTECTED]


DeployTask is broken:

 

Manager believes that this is a .war file, not an exploded directory:

Oct 23, 2005 6:10:16 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive caveatemptor.war
Oct 23, 2005 6:10:16 AM org.apache.catalina.startup.ContextConfig init
SEVERE: Exception fixing docBase: {0} 
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:204)
at java.util.jar.JarFile.(JarFile.java:132)
at java.util.jar.JarFile.(JarFile.java:70)
at sun.net.www.protocol.jar.URLJarFile.(URLJarFile.java:56)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:41)
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:68)
at 
sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:102)
at 
sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:69)
at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:140)
at 
org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:865)
at 
org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:977)
at 
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:273)
at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at 
org.apache.catalina.core.StandardContext.init(StandardContext.java:5041)
at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:3908)
at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:804)
at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:497)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1195)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at 
org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)   
 
...

It also creates a $TOMCAT-HOME/webapps/foo.war file that contains a directory 
listing in ASCII of my 
exploded WAR directory.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]