svn commit: r469090 - /tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c

2006-10-30 Thread mturk
Author: mturk
Date: Mon Oct 30 00:29:31 2006
New Revision: 469090

URL: http://svn.apache.org/viewvc?view=rev&rev=469090
Log:
Call the flush after sending headers if flush_header is defined.

Modified:
tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?view=diff&rev=469090&r1=469089&r2=469090
==
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Mon Oct 30 
00:29:31 2006
@@ -1385,6 +1385,8 @@
   (const char *const *)res.header_names,
   (const char *const *)res.header_values,
   res.num_headers);
+if (r->flush && r->flush_header)
+r->flush(r);
 }
 return JK_AJP13_SEND_HEADERS;
 



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



svn commit: r469091 - /tomcat/connectors/trunk/jni/native/src/sslutils.c

2006-10-30 Thread mturk
Author: mturk
Date: Mon Oct 30 00:33:28 2006
New Revision: 469091

URL: http://svn.apache.org/viewvc?view=rev&rev=469091
Log:
Fix JNIEnv initialization order for password callback

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

Modified: tomcat/connectors/trunk/jni/native/src/sslutils.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/src/sslutils.c?view=diff&rev=469091&r1=469090&r2=469091
==
--- tomcat/connectors/trunk/jni/native/src/sslutils.c (original)
+++ tomcat/connectors/trunk/jni/native/src/sslutils.c Mon Oct 30 00:33:28 2006
@@ -81,8 +81,9 @@
 if (data->cb.obj) {
 JNIEnv *e;
 jobject  o;
-jstring  prompt = AJP_TO_JSTRING(data->prompt);
+jstring  prompt;
 tcn_get_java_env(&e);
+prompt = AJP_TO_JSTRING(data->prompt);
 if ((o = (*e)->CallObjectMethod(e, data->cb.obj,
 data->cb.mid[0], prompt))) {
 TCN_ALLOC_CSTRING(o);



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



svn commit: r469092 - in /tomcat/connectors/trunk/jni/native: include/tcn_version.h os/win32/libtcnative.rc

2006-10-30 Thread mturk
Author: mturk
Date: Mon Oct 30 00:33:58 2006
New Revision: 469092

URL: http://svn.apache.org/viewvc?view=rev&rev=469092
Log:
Increment working version

Modified:
tomcat/connectors/trunk/jni/native/include/tcn_version.h
tomcat/connectors/trunk/jni/native/os/win32/libtcnative.rc

Modified: tomcat/connectors/trunk/jni/native/include/tcn_version.h
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/include/tcn_version.h?view=diff&rev=469092&r1=469091&r2=469092
==
--- tomcat/connectors/trunk/jni/native/include/tcn_version.h (original)
+++ tomcat/connectors/trunk/jni/native/include/tcn_version.h Mon Oct 30 
00:33:58 2006
@@ -69,7 +69,7 @@
 #define TCN_MINOR_VERSION   1
 
 /** patch level */
-#define TCN_PATCH_VERSION   6
+#define TCN_PATCH_VERSION   7
 
 /**
  *  This symbol is defined for internal, "development" copies of TCN. This

Modified: tomcat/connectors/trunk/jni/native/os/win32/libtcnative.rc
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/os/win32/libtcnative.rc?view=diff&rev=469092&r1=469091&r2=469092
==
--- tomcat/connectors/trunk/jni/native/os/win32/libtcnative.rc (original)
+++ tomcat/connectors/trunk/jni/native/os/win32/libtcnative.rc Mon Oct 30 
00:33:58 2006
@@ -19,7 +19,7 @@
 "specific language governing permissions and " \
 "limitations under the License."
 
-#define TCN_VERISON "1.1.6"
+#define TCN_VERISON "1.1.7"
 1000 ICON "apache.ico"
 
 1001 DIALOGEX 0, 0, 252, 51
@@ -35,8 +35,8 @@
 END
 
 1 VERSIONINFO
- FILEVERSION 1,1,6,0
- PRODUCTVERSION 1,1,6,0
+ FILEVERSION 1,1,7,0
+ PRODUCTVERSION 1,1,7,0
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L



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



Scott Johnson/Raleigh/IBM is out of the office.

2006-10-30 Thread Scott Johnson

I will be out of the office starting  10/30/2006 and will not return until
11/02/2006.

I am in class and will be checking email sporadically.  If you need
assistance please contact Will Gregory  ([EMAIL PROTECTED]).

It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc

2006-10-30 Thread Peter Rossbach

Hi Filip,

I am starting testing your new NioProtocol handler, but I got  
following exception:


30.10.2006 13:37:24 org.apache.tomcat.util.net.NioEndpoint  
setSocketOptions

SCHWERWIEGEND:
java.net.SocketException: Invalid argument
at sun.nio.ch.Net.setIntOption0(Native Method)
at sun.nio.ch.Net.setIntOption(Net.java:152)
at sun.nio.ch.SocketChannelImpl$1.setInt 
(SocketChannelImpl.java:372)

at sun.nio.ch.SocketOptsImpl.setInt(SocketOptsImpl.java:46)
at sun.nio.ch.SocketOptsImpl$IP.typeOfService 
(SocketOptsImpl.java:249)
at sun.nio.ch.OptionAdaptor.setTrafficClass 
(OptionAdaptor.java:158)
at sun.nio.ch.SocketAdaptor.setTrafficClass 
(SocketAdaptor.java:320)
at org.apache.tomcat.util.net.SocketProperties.setProperties 
(SocketProperties.java:107)
at org.apache.tomcat.util.net.NioEndpoint.setSocketOptions 
(NioEndpoint.java:742)
at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
(NioEndpoint.java:1423)

at java.lang.Thread.run(Thread.java:613)


==

My connector config is:



After some google search I found that soTrafficClass are not  
supported at mac os x :-(

s. http://jira.safehaus.org/browse/PENROSE-71

I comment out  L 106 at class o.a.t.util.net.SocketProperties.

//socket.setTrafficClass(soTrafficClass);

Before I did this: I check starting connector with some different  
values without success


ex.


After that patch the Connector work, but with the comet style chat  
example I have more trouble:


INFO: Server startup in 3025 ms
Exception in thread "http-8080-1" java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
(NioEndpoint.java:1441)

at java.lang.Thread.run(Thread.java:613)
Exception in thread "http-8080-2" java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
(NioEndpoint.java:1441)

at java.lang.Thread.run(Thread.java:613)

--
Chat example really working? I see the posted messages only after  
socket is closed (with Firefox 1.5)...


Next I test the chat example with APR handler, again.

Regards
Peter Roßbach
[EMAIL PROTECTED]





Re: It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc

2006-10-30 Thread Filip Hanik - Dev Lists

try to set the property socket.soTrafficClass to some other value,
if it's not working, what JDK are you running, here is the flag 
described by SUN


http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#setTrafficClass(int)



Peter Rossbach wrote:

Hi Filip,

I am starting testing your new NioProtocol handler, but I got 
following exception:


30.10.2006 13:37:24 org.apache.tomcat.util.net.NioEndpoint 
setSocketOptions

SCHWERWIEGEND:
java.net.SocketException: Invalid argument
at sun.nio.ch.Net.setIntOption0(Native Method)
at sun.nio.ch.Net.setIntOption(Net.java:152)
at 
sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:372)

at sun.nio.ch.SocketOptsImpl.setInt(SocketOptsImpl.java:46)
at 
sun.nio.ch.SocketOptsImpl$IP.typeOfService(SocketOptsImpl.java:249)
at 
sun.nio.ch.OptionAdaptor.setTrafficClass(OptionAdaptor.java:158)
at 
sun.nio.ch.SocketAdaptor.setTrafficClass(SocketAdaptor.java:320)
at 
org.apache.tomcat.util.net.SocketProperties.setProperties(SocketProperties.java:107) 

at 
org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:742) 

at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1423)

at java.lang.Thread.run(Thread.java:613)


==

My connector config is:



After some google search I found that soTrafficClass are not supported 
at mac os x :-(

s. http://jira.safehaus.org/browse/PENROSE-71

I comment out  L 106 at class o.a.t.util.net.SocketProperties.

//socket.setTrafficClass(soTrafficClass);

Before I did this: I check starting connector with some different 
values without success


ex.


After that patch the Connector work, but with the comet style chat 
example I have more trouble:


INFO: Server startup in 3025 ms
Exception in thread "http-8080-1" java.lang.NullPointerException
at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1441)

at java.lang.Thread.run(Thread.java:613)
Exception in thread "http-8080-2" java.lang.NullPointerException
at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1441)

at java.lang.Thread.run(Thread.java:613)

--
Chat example really working? I see the posted messages only after 
socket is closed (with Firefox 1.5)...


Next I test the chat example with APR handler, again.

Regards
Peter Roßbach
[EMAIL PROTECTED]






No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.17/505 - Release Date: 10/27/2006

  



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



Re: It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc

2006-10-30 Thread Peter Rossbach

Hi Filip,

I found that MAC OS X only support setTrafficClass with following JDK  
option


-Djava.net.preferIPv4Stack=true

http://lists.apple.com/archives/java-dev/2006/Jun/msg00414.html

It seems a older IPV6 bug. At which place we can document those  
things? -> F&Q



The chat example flush the messages only I got NPE:

INFO: Server startup in 2642 ms
Exception in thread "http-8080-1" java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
(NioEndpoint.java:1441)

at java.lang.Thread.run(Thread.java:613)

After this NPE the messages flush to the browser an connection are  
closed.


Regards
Peter


Am 30.10.2006 um 15:04 schrieb Filip Hanik - Dev Lists:


try to set the property socket.soTrafficClass to some other value,
if it's not working, what JDK are you running, here is the flag  
described by SUN


http://java.sun.com/j2se/1.5.0/docs/api/java/net/ 
Socket.html#setTrafficClass(int)




Peter Rossbach wrote:

Hi Filip,

I am starting testing your new NioProtocol handler, but I got  
following exception:


30.10.2006 13:37:24 org.apache.tomcat.util.net.NioEndpoint  
setSocketOptions

SCHWERWIEGEND:
java.net.SocketException: Invalid argument
at sun.nio.ch.Net.setIntOption0(Native Method)
at sun.nio.ch.Net.setIntOption(Net.java:152)
at sun.nio.ch.SocketChannelImpl$1.setInt 
(SocketChannelImpl.java:372)

at sun.nio.ch.SocketOptsImpl.setInt(SocketOptsImpl.java:46)
at sun.nio.ch.SocketOptsImpl$IP.typeOfService 
(SocketOptsImpl.java:249)
at sun.nio.ch.OptionAdaptor.setTrafficClass 
(OptionAdaptor.java:158)
at sun.nio.ch.SocketAdaptor.setTrafficClass 
(SocketAdaptor.java:320)
at  
org.apache.tomcat.util.net.SocketProperties.setProperties 
(SocketProperties.java:107)
at org.apache.tomcat.util.net.NioEndpoint.setSocketOptions 
(NioEndpoint.java:742)
at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
(NioEndpoint.java:1423)

at java.lang.Thread.run(Thread.java:613)


==

My connector config is:


protocol="org.apache.coyote.http11.Http11NioProtocol" />


After some google search I found that soTrafficClass are not  
supported at mac os x :-(

s. http://jira.safehaus.org/browse/PENROSE-71

I comment out  L 106 at class o.a.t.util.net.SocketProperties.

//socket.setTrafficClass(soTrafficClass);

Before I did this: I check starting connector with some different  
values without success


ex.


After that patch the Connector work, but with the comet style chat  
example I have more trouble:


INFO: Server startup in 3025 ms
Exception in thread "http-8080-1" java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
(NioEndpoint.java:1441)

at java.lang.Thread.run(Thread.java:613)
Exception in thread "http-8080-2" java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
(NioEndpoint.java:1441)

at java.lang.Thread.run(Thread.java:613)

--
Chat example really working? I see the posted messages only after  
socket is closed (with Firefox 1.5)...


Next I test the chat example with APR handler, again.

Regards
Peter Roßbach
[EMAIL PROTECTED]




- 
---


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.17/505 - Release Date:  
10/27/2006






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






Re: It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc

2006-10-30 Thread Filip Hanik - Dev Lists

interesting, I will take a look

thanks for the feedback
Filip

Peter Rossbach wrote:

Hi Filip,

I found that MAC OS X only support setTrafficClass with following JDK 
option


-Djava.net.preferIPv4Stack=true

http://lists.apple.com/archives/java-dev/2006/Jun/msg00414.html

It seems a older IPV6 bug. At which place we can document those 
things? -> F&Q



The chat example flush the messages only I got NPE:

INFO: Server startup in 2642 ms
Exception in thread "http-8080-1" java.lang.NullPointerException
at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1441)

at java.lang.Thread.run(Thread.java:613)

After this NPE the messages flush to the browser an connection are 
closed.


Regards
Peter


Am 30.10.2006 um 15:04 schrieb Filip Hanik - Dev Lists:


try to set the property socket.soTrafficClass to some other value,
if it's not working, what JDK are you running, here is the flag 
described by SUN


http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#setTrafficClass(int) 





Peter Rossbach wrote:

Hi Filip,

I am starting testing your new NioProtocol handler, but I got 
following exception:


30.10.2006 13:37:24 org.apache.tomcat.util.net.NioEndpoint 
setSocketOptions

SCHWERWIEGEND:
java.net.SocketException: Invalid argument
at sun.nio.ch.Net.setIntOption0(Native Method)
at sun.nio.ch.Net.setIntOption(Net.java:152)
at 
sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:372)

at sun.nio.ch.SocketOptsImpl.setInt(SocketOptsImpl.java:46)
at 
sun.nio.ch.SocketOptsImpl$IP.typeOfService(SocketOptsImpl.java:249)
at 
sun.nio.ch.OptionAdaptor.setTrafficClass(OptionAdaptor.java:158)
at 
sun.nio.ch.SocketAdaptor.setTrafficClass(SocketAdaptor.java:320)
at 
org.apache.tomcat.util.net.SocketProperties.setProperties(SocketProperties.java:107) 

at 
org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:742) 

at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1423) 


at java.lang.Thread.run(Thread.java:613)


==

My connector config is:



After some google search I found that soTrafficClass are not 
supported at mac os x :-(

s. http://jira.safehaus.org/browse/PENROSE-71

I comment out  L 106 at class o.a.t.util.net.SocketProperties.

//socket.setTrafficClass(soTrafficClass);

Before I did this: I check starting connector with some different 
values without success


ex.


After that patch the Connector work, but with the comet style chat 
example I have more trouble:


INFO: Server startup in 3025 ms
Exception in thread "http-8080-1" java.lang.NullPointerException
at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1441) 


at java.lang.Thread.run(Thread.java:613)
Exception in thread "http-8080-2" java.lang.NullPointerException
at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1441) 


at java.lang.Thread.run(Thread.java:613)

--Chat example really working? I see the posted messages only after 
socket is closed (with Firefox 1.5)...


Next I test the chat example with APR handler, again.

Regards
Peter Roßbach
[EMAIL PROTECTED]




 



No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.17/505 - Release Date: 
10/27/2006






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







No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.17/505 - Release Date: 10/27/2006

  



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



Re: It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc

2006-10-30 Thread Peter Rossbach

Hi Filip.

you see at my situation the key can be null:

30.10.2006 16:03:20 org.apache.tomcat.util.net.NioEndpoint$Worker run
INFO:  
[EMAIL PROTECTED]:java.nio.channels.So 
cketChannel[connected local=/127.0.0.1:8080 remote=/127.0.0.1:50517]  
[EMAIL PROTECTED]

30.10.2006 16:03:40 org.apache.tomcat.util.net.NioEndpoint$Worker run
INFO:  
[EMAIL PROTECTED]:java.nio.channels.So 
cketChannel[closed] key=null


   #


Exception in thread "http-8080-2" java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
(NioEndpoint.java:1442)

at java.lang.Thread.run(Thread.java:613)


Here my patch:

=== L 1436 f

NioChannel socket = (NioChannel)channel;

SelectionKey key = socket.getIOChannel 
().keyFor(socket.getPoller().getSelector());

int handshake = -1;
log.info("socket=" + socket + " key=" + key );
if(key != null) {
try {
handshake = socket.handshake 
(key.isReadable(), key.isWritable());

}catch ( IOException x ) {
handshake = -1;
if ( log.isDebugEnabled() ) log.debug 
("Error during SSL handshake",x);

}catch ( CancelledKeyException ckx ) {
handshake = -1;
}
} else {
   handshake = -1;
}

if ( handshake == 0 ) {
// Process the request from this socket
if ((status != null) && (handler.event 
(socket, status) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att =  
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch  
(Exception ignore){}
if ( socket.isOpen() )  
socket.close(true);

nioChannels.offer(socket);
if ( att!=null ) keyCache.offer 
(att);

}catch ( Exception x ) {
log.error("",x);
}
} else if ((status == null) &&  
(handler.process(socket) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att =  
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch  
(Exception ignore){}
if ( socket.isOpen() )  
socket.close(true);

nioChannels.offer(socket);
if ( att!=null ) keyCache.offer 
(att);

}catch ( Exception x ) {
log.error("",x);
}
}
} else if (handshake == -1 ) {
if ( key != null && key.isValid() )  
key.cancel();
try {socket.close(true);}catch  
(IOException ignore){}

nioChannels.offer(socket);
} else {
final SelectionKey fk = key;
final int intops = handshake;
final KeyAttachment ka = (KeyAttachment) 
fk.attachment();

ka.getPoller().add(socket,intops);
}
}
} finally {
//dereference socket to let GC do its job
socket = null;
// Finish up this request
recycleWorkerThread(this);
}
}
}



But why the chat messages don't responce only as socket close?



I only see comet begin event?
==
30.10.2006 16:19:28 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded 
('org.apache.jasper.runtime.JspApplicationC
ontextImpl',  
'[EMAIL PROTECTED]')

30.10.2006 16:19:32 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: attributeReplaced 
('C3E6394AC176D22B752C75D55343AA02', 'ni

ckname', 'pero')
30.10.2006 16:19:35 org.apache.catalina.core.ApplicationContext log
INFO: ChatServlet: Begin for session: C3E6394AC176D22B752C75D55343AA02
30.10.2006 16:25:17 org.apache.catalina.

Re: It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc

2006-10-30 Thread Filip Hanik - Dev Lists
how do you reproduce this? I've added in your fix, but cant reproduce 
the problem


Filip

Peter Rossbach wrote:

Hi Filip.

you see at my situation the key can be null:

30.10.2006 16:03:20 org.apache.tomcat.util.net.NioEndpoint$Worker run
INFO: 
[EMAIL PROTECTED]:java.nio.channels.SocketChannel[connected 
local=/127.0.0.1:8080 remote=/127.0.0.1:50517] 
[EMAIL PROTECTED]

30.10.2006 16:03:40 org.apache.tomcat.util.net.NioEndpoint$Worker run
INFO: 
[EMAIL PROTECTED]:java.nio.channels.SocketChannel[closed] 
key=null
   
   
   #


Exception in thread "http-8080-2" java.lang.NullPointerException
at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1442)

at java.lang.Thread.run(Thread.java:613)


Here my patch:

=== L 1436 f

NioChannel socket = (NioChannel)channel;

SelectionKey key = 
socket.getIOChannel().keyFor(socket.getPoller().getSelector());

int handshake = -1;
log.info("socket=" + socket + " key=" + key );
if(key != null) {
try {
handshake = 
socket.handshake(key.isReadable(), key.isWritable());

}catch ( IOException x ) {
handshake = -1;
if ( log.isDebugEnabled() ) 
log.debug("Error during SSL handshake",x);

}catch ( CancelledKeyException ckx ) {
handshake = -1;
}
} else {
   handshake = -1;
}

if ( handshake == 0 ) {
// Process the request from this socket
if ((status != null) && 
(handler.event(socket, status) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att = 
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch 
(Exception ignore){}
if ( socket.isOpen() ) 
socket.close(true);

nioChannels.offer(socket);
if ( att!=null ) keyCache.offer(att);
}catch ( Exception x ) {
log.error("",x);
}
} else if ((status == null) && 
(handler.process(socket) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att = 
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch 
(Exception ignore){}
if ( socket.isOpen() ) 
socket.close(true);

nioChannels.offer(socket);
if ( att!=null ) keyCache.offer(att);
}catch ( Exception x ) {
log.error("",x);
}
}
} else if (handshake == -1 ) {
if ( key != null && key.isValid() ) 
key.cancel();
try {socket.close(true);}catch 
(IOException ignore){}

nioChannels.offer(socket);
} else {
final SelectionKey fk = key;
final int intops = handshake;
final KeyAttachment ka = 
(KeyAttachment)fk.attachment();

ka.getPoller().add(socket,intops);
}
}
} finally {
//dereference socket to let GC do its job
socket = null;
// Finish up this request
recycleWorkerThread(this);
}
}
}



But why the chat messages don't responce only as socket close?



I only see comet begin event?
==
30.10.2006 16:19:28 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: 
attributeAdded('org.apache.jasper.runtime.JspApplicationC
ontextImpl', 
'[EMAIL PROTECTED]')

30.10.2006 16:19:32 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: 
attributeReplaced('C3E6394AC176D22B752C75D55343AA02', 'ni

ckname', 'pero')
30.10.2006 16:19:35 org.apache.catalina.core.ApplicationContext log
INFO: ChatServlet: Begin for

Re: It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc

2006-10-30 Thread Filip Hanik - Dev Lists
yeah, that fix is not entirely correct and can lead to problems down the 
road,
the problem is bigger than that, I have to catch the socket being closed 
earlier so that I can unattach the attachment from the key


Filip

Filip Hanik - Dev Lists wrote:
how do you reproduce this? I've added in your fix, but cant reproduce 
the problem


Filip

Peter Rossbach wrote:

Hi Filip.

you see at my situation the key can be null:

30.10.2006 16:03:20 org.apache.tomcat.util.net.NioEndpoint$Worker run
INFO: 
[EMAIL PROTECTED]:java.nio.channels.SocketChannel[connected 
local=/127.0.0.1:8080 remote=/127.0.0.1:50517] 
[EMAIL PROTECTED]

30.10.2006 16:03:40 org.apache.tomcat.util.net.NioEndpoint$Worker run
INFO: 
[EMAIL PROTECTED]:java.nio.channels.SocketChannel[closed] 
key=null
   
   
   #


Exception in thread "http-8080-2" java.lang.NullPointerException
at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1442)

at java.lang.Thread.run(Thread.java:613)


Here my patch:

=== L 1436 f

NioChannel socket = (NioChannel)channel;

SelectionKey key = 
socket.getIOChannel().keyFor(socket.getPoller().getSelector());

int handshake = -1;
log.info("socket=" + socket + " key=" + key );
if(key != null) {
try {
handshake = 
socket.handshake(key.isReadable(), key.isWritable());

}catch ( IOException x ) {
handshake = -1;
if ( log.isDebugEnabled() ) 
log.debug("Error during SSL handshake",x);

}catch ( CancelledKeyException ckx ) {
handshake = -1;
}
} else {
   handshake = -1;
}

if ( handshake == 0 ) {
// Process the request from this socket
if ((status != null) && 
(handler.event(socket, status) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att = 
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch 
(Exception ignore){}
if ( socket.isOpen() ) 
socket.close(true);

nioChannels.offer(socket);
if ( att!=null ) 
keyCache.offer(att);

}catch ( Exception x ) {
log.error("",x);
}
} else if ((status == null) && 
(handler.process(socket) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att = 
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch 
(Exception ignore){}
if ( socket.isOpen() ) 
socket.close(true);

nioChannels.offer(socket);
if ( att!=null ) 
keyCache.offer(att);

}catch ( Exception x ) {
log.error("",x);
}
}
} else if (handshake == -1 ) {
if ( key != null && key.isValid() ) 
key.cancel();
try {socket.close(true);}catch 
(IOException ignore){}

nioChannels.offer(socket);
} else {
final SelectionKey fk = key;
final int intops = handshake;
final KeyAttachment ka = 
(KeyAttachment)fk.attachment();

ka.getPoller().add(socket,intops);
}
}
} finally {
//dereference socket to let GC do its job
socket = null;
// Finish up this request
recycleWorkerThread(this);
}
}
}



But why the chat messages don't responce only as socket close?



I only see comet begin event?
==
30.10.2006 16:19:28 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: 
attributeAdded('org.apache.jasper.runtime.JspApplicationC
ontextImpl', 
'[EMAIL PROTECTED]')

30.10.2

Re: It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc

2006-10-30 Thread Peter Rossbach

Hi Filip,

I have use newest tomcat 6 svn head, with jdk 1.5.0_06, MAC OS X  
10.4.8, PPC,

fresh build.

Used Safari and FireFox 1.5

Open a Window 1

http://localhost:8080/examples/jsp/chat/login.jsp
-> get post.jsp dialog

Open new Window 2 with
http://localhost:8080/examples/jsp/chat/chat

-> send a message at window 1

result: see nothing at window 2
after 20 Sec (connectiontimeout from connector)
the messages flush at window 2

without my patch I git before a NPE at catalina.out.

Regards
Peter


Am 30.10.2006 um 16:52 schrieb Filip Hanik - Dev Lists:

how do you reproduce this? I've added in your fix, but cant  
reproduce the problem


Filip

Peter Rossbach wrote:

Hi Filip.

you see at my situation the key can be null:

30.10.2006 16:03:20 org.apache.tomcat.util.net.NioEndpoint$Worker run
INFO:  
[EMAIL PROTECTED]:java.nio.channels 
.SocketChannel[connected local=/127.0.0.1:8080 remote=/ 
127.0.0.1:50517] [EMAIL PROTECTED]

30.10.2006 16:03:40 org.apache.tomcat.util.net.NioEndpoint$Worker run
INFO:  
[EMAIL PROTECTED]:java.nio.channels 
.SocketChannel[closed] key=null
  
  
   #


Exception in thread "http-8080-2" java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
(NioEndpoint.java:1442)

at java.lang.Thread.run(Thread.java:613)


Here my patch:

=== L 1436 f

NioChannel socket = (NioChannel)channel;

SelectionKey key = socket.getIOChannel 
().keyFor(socket.getPoller().getSelector());

int handshake = -1;
log.info("socket=" + socket + " key=" +  
key );

if(key != null) {
try {
handshake = socket.handshake 
(key.isReadable(), key.isWritable());

}catch ( IOException x ) {
handshake = -1;
if ( log.isDebugEnabled() )  
log.debug("Error during SSL handshake",x);

}catch ( CancelledKeyException ckx ) {
handshake = -1;
}
} else {
   handshake = -1;
}

if ( handshake == 0 ) {
// Process the request from this socket
if ((status != null) && (handler.event 
(socket, status) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att =  
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch  
(Exception ignore){}
if ( socket.isOpen() )  
socket.close(true);

nioChannels.offer(socket);
if ( att!=null ) keyCache.offer 
(att);

}catch ( Exception x ) {
log.error("",x);
}
} else if ((status == null) &&  
(handler.process(socket) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att =  
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch  
(Exception ignore){}
if ( socket.isOpen() )  
socket.close(true);

nioChannels.offer(socket);
if ( att!=null ) keyCache.offer 
(att);

}catch ( Exception x ) {
log.error("",x);
}
}
} else if (handshake == -1 ) {
if ( key != null && key.isValid() )  
key.cancel();
try {socket.close(true);}catch  
(IOException ignore){}

nioChannels.offer(socket);
} else {
final SelectionKey fk = key;
final int intops = handshake;
final KeyAttachment ka =  
(KeyAttachment)fk.attachment();

ka.getPoller().add(socket,intops);
}
}
} finally {
//dereference socket to let GC do its job
socket = null;
// Finish up this request
recycleWorkerThread(this);

Re: It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc

2006-10-30 Thread Peter Rossbach

Oops, as you find a fix, I will test it :-)

regards
Peter


Am 30.10.2006 um 17:05 schrieb Filip Hanik - Dev Lists:

yeah, that fix is not entirely correct and can lead to problems  
down the road,
the problem is bigger than that, I have to catch the socket being  
closed earlier so that I can unattach the attachment from the key


Filip

Filip Hanik - Dev Lists wrote:
how do you reproduce this? I've added in your fix, but cant  
reproduce the problem


Filip

Peter Rossbach wrote:

Hi Filip.

you see at my situation the key can be null:

30.10.2006 16:03:20 org.apache.tomcat.util.net.NioEndpoint$Worker  
run
INFO:  
[EMAIL PROTECTED]:java.nio.channel 
s.SocketChannel[connected local=/127.0.0.1:8080 remote=/ 
127.0.0.1:50517] [EMAIL PROTECTED]
30.10.2006 16:03:40 org.apache.tomcat.util.net.NioEndpoint$Worker  
run
INFO:  
[EMAIL PROTECTED]:java.nio.channel 
s.SocketChannel[closed] key=null
 
 
  
#


Exception in thread "http-8080-2" java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
(NioEndpoint.java:1442)

at java.lang.Thread.run(Thread.java:613)


Here my patch:

=== L 1436 f

NioChannel socket = (NioChannel)channel;

SelectionKey key = socket.getIOChannel 
().keyFor(socket.getPoller().getSelector());

int handshake = -1;
log.info("socket=" + socket + " key=" +  
key );

if(key != null) {
try {
handshake = socket.handshake 
(key.isReadable(), key.isWritable());

}catch ( IOException x ) {
handshake = -1;
if ( log.isDebugEnabled() )  
log.debug("Error during SSL handshake",x);

}catch ( CancelledKeyException ckx ) {
handshake = -1;
}
} else {
   handshake = -1;
}

if ( handshake == 0 ) {
// Process the request from this socket
if ((status != null) && (handler.event 
(socket, status) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att =  
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch  
(Exception ignore){}
if ( socket.isOpen() )  
socket.close(true);

nioChannels.offer(socket);
if ( att!=null )  
keyCache.offer(att);

}catch ( Exception x ) {
log.error("",x);
}
} else if ((status == null) &&  
(handler.process(socket) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att =  
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch  
(Exception ignore){}
if ( socket.isOpen() )  
socket.close(true);

nioChannels.offer(socket);
if ( att!=null )  
keyCache.offer(att);

}catch ( Exception x ) {
log.error("",x);
}
}
} else if (handshake == -1 ) {
if ( key != null && key.isValid() )  
key.cancel();
try {socket.close(true);}catch  
(IOException ignore){}

nioChannels.offer(socket);
} else {
final SelectionKey fk = key;
final int intops = handshake;
final KeyAttachment ka =  
(KeyAttachment)fk.attachment();

ka.getPoller().add(socket,intops);
}
}
} finally {
//dereference socket to let GC do its job
socket = null;
// Finish up this request
recycleWorkerThread(this);
}
}
}



But why the chat messages don't responce only as socket close?



I only see comet begin event?
==
30.10.2006 16:19:28 org.apache.catalina

Find some compiler warnings at tcnative network.c at mac os x

2006-10-30 Thread Peter Rossbach

Hi,

I see following compiler warning at mac os x 10.4.8 gcc 4.0.1.

===
I/Users/peter/tools/local/include  -I/Users/peter/tools/local// 
include/apr-1   -o src/network.lo -c src/network.c && touch src/ 
network.lo

src/network.c: In function 'Java_org_apache_tomcat_jni_Socket_send':
src/network.c:414: warning: pointer targets in passing argument 2 of  
's->net->send' differ in signedness
src/network.c:421: warning: pointer targets in passing argument 2 of  
's->net->send' differ in signedness

src/network.c: In function 'Java_org_apache_tomcat_jni_Socket_recvt':
src/network.c:674: warning: pointer targets in passing argument 2 of  
's->net->recv' differ in signedness
src/network.c:681: warning: pointer targets in passing argument 2 of  
's->net->recv' differ in signedness



Regards
Peter





Re: It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc

2006-10-30 Thread Filip Hanik - Dev Lists
ok, I fixed the NPE, thanks for bringing to my attention. I haven't used 
the chat app yet, so I can't speak for how it works.


Filip

Peter Rossbach wrote:

Hi Filip,

I have use newest tomcat 6 svn head, with jdk 1.5.0_06, MAC OS X 
10.4.8, PPC,

fresh build.

Used Safari and FireFox 1.5

Open a Window 1

http://localhost:8080/examples/jsp/chat/login.jsp
-> get post.jsp dialog

Open new Window 2 with
http://localhost:8080/examples/jsp/chat/chat

-> send a message at window 1

result: see nothing at window 2
after 20 Sec (connectiontimeout from connector)
the messages flush at window 2

without my patch I git before a NPE at catalina.out.

Regards
Peter


Am 30.10.2006 um 16:52 schrieb Filip Hanik - Dev Lists:

how do you reproduce this? I've added in your fix, but cant reproduce 
the problem


Filip

Peter Rossbach wrote:

Hi Filip.

you see at my situation the key can be null:

30.10.2006 16:03:20 org.apache.tomcat.util.net.NioEndpoint$Worker run
INFO: 
[EMAIL PROTECTED]:java.nio.channels.SocketChannel[connected 
local=/127.0.0.1:8080 remote=/127.0.0.1:50517] 
[EMAIL PROTECTED]

30.10.2006 16:03:40 org.apache.tomcat.util.net.NioEndpoint$Worker run
INFO: 
[EMAIL PROTECTED]:java.nio.channels.SocketChannel[closed] 
key=null
 
 
   #


Exception in thread "http-8080-2" java.lang.NullPointerException
at 
org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1442) 


at java.lang.Thread.run(Thread.java:613)


Here my patch:

=== L 1436 f

NioChannel socket = (NioChannel)channel;

SelectionKey key = 
socket.getIOChannel().keyFor(socket.getPoller().getSelector());

int handshake = -1;
log.info("socket=" + socket + " key=" + key );
if(key != null) {
try {
handshake = 
socket.handshake(key.isReadable(), key.isWritable());

}catch ( IOException x ) {
handshake = -1;
if ( log.isDebugEnabled() ) 
log.debug("Error during SSL handshake",x);

}catch ( CancelledKeyException ckx ) {
handshake = -1;
}
} else {
   handshake = -1;
}

if ( handshake == 0 ) {
// Process the request from this socket
if ((status != null) && 
(handler.event(socket, status) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att = 
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch 
(Exception ignore){}
if ( socket.isOpen() ) 
socket.close(true);

nioChannels.offer(socket);
if ( att!=null ) 
keyCache.offer(att);

}catch ( Exception x ) {
log.error("",x);
}
} else if ((status == null) && 
(handler.process(socket) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att = 
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch 
(Exception ignore){}
if ( socket.isOpen() ) 
socket.close(true);

nioChannels.offer(socket);
if ( att!=null ) 
keyCache.offer(att);

}catch ( Exception x ) {
log.error("",x);
}
}
} else if (handshake == -1 ) {
if ( key != null && key.isValid() ) 
key.cancel();
try {socket.close(true);}catch 
(IOException ignore){}

nioChannels.offer(socket);
} else {
final SelectionKey fk = key;
final int intops = handshake;
final KeyAttachment ka = 
(KeyAttachment)fk.attachment();

ka.getPoller().add(socket,intops);
}
}
} finally {
//dereference socket to let GC do its job
 

Strange tcnative version at tomcat60

2006-10-30 Thread Peter Rossbach

Hi Malden,

I have check the tcnative connector at tomcat 60. Strange, the  
version numbers differ


tomcat60/native/connector/include/tcn_version.h

* @version $Revision: 466609 $, $Date: 2006-10-22 01:30:39 +0200  
(Sun, 22 Oct 2


tomcat55/connectors/jni/native/include/tcn_version.h

* @version $Revision: 469092 $, $Date: 2006-10-30 09:33:58 +0100  
(Mon, 30 Oct 2

006) $
*/

Must be tcnative at tomcat60 not an external svn link?

Regards
Peter





Re: Strange tcnative version at tomcat60

2006-10-30 Thread Mladen Turk

Peter Rossbach wrote:

Hi Malden,

Must be tcnative at tomcat60 not an external svn link?



I would like that we have the subset of connectors/jni
inside tc6/native (only the parts that are used).

The probable version will be 2.x while the version
in connectors/jni will stay as 1.x for tc 5.5.x

This BTW, follows the general concept for tc6, where
core parts are disconnected from their origin.
This would require extra effort for maintaining, but
it would allow to have the future development decoupled
from the versions needed for 5.5.x branch.

Regards,
Mladen.

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



Re: It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc

2006-10-30 Thread Peter Rossbach

Hi Filip,

ok, next step:

30.10.2006 19:51:44 org.apache.catalina.core.ApplicationContext log
INFO: ChatServlet: Begin for session: DC3A87204AA3AE2A441848596CF77373
30.10.2006 19:52:27 org.apache.catalina.core.ApplicationContext log
INFO: ChatServlet: Error for session: DC3A87204AA3AE2A441848596CF77373

===

It seems that the buffer flush at ChatServlet work, but browser not  
showing the result. The connection connection timeout

close the socket and then browser get the results.

Can you send me a working comet style example?

Regards
Peter






Am 30.10.2006 um 18:58 schrieb Filip Hanik - Dev Lists:

ok, I fixed the NPE, thanks for bringing to my attention. I haven't  
used the chat app yet, so I can't speak for how it works.


Filip

Peter Rossbach wrote:

Hi Filip,

I have use newest tomcat 6 svn head, with jdk 1.5.0_06, MAC OS X  
10.4.8, PPC,

fresh build.

Used Safari and FireFox 1.5

Open a Window 1

http://localhost:8080/examples/jsp/chat/login.jsp
-> get post.jsp dialog

Open new Window 2 with
http://localhost:8080/examples/jsp/chat/chat

-> send a message at window 1

result: see nothing at window 2
after 20 Sec (connectiontimeout from connector)
the messages flush at window 2

without my patch I git before a NPE at catalina.out.

Regards
Peter


Am 30.10.2006 um 16:52 schrieb Filip Hanik - Dev Lists:

how do you reproduce this? I've added in your fix, but cant  
reproduce the problem


Filip

Peter Rossbach wrote:

Hi Filip.

you see at my situation the key can be null:

30.10.2006 16:03:20 org.apache.tomcat.util.net.NioEndpoint 
$Worker run
INFO:  
[EMAIL PROTECTED]:java.nio.channe 
ls.SocketChannel[connected local=/127.0.0.1:8080 remote=/ 
127.0.0.1:50517] [EMAIL PROTECTED]
30.10.2006 16:03:40 org.apache.tomcat.util.net.NioEndpoint 
$Worker run
INFO:  
[EMAIL PROTECTED]:java.nio.channe 
ls.SocketChannel[closed] key=null



#


Exception in thread "http-8080-2" java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint$Worker.run 
(NioEndpoint.java:1442)

at java.lang.Thread.run(Thread.java:613)


Here my patch:

=== L 1436 f

NioChannel socket = (NioChannel)channel;

SelectionKey key = socket.getIOChannel 
().keyFor(socket.getPoller().getSelector());

int handshake = -1;
log.info("socket=" + socket + " key=" +  
key );

if(key != null) {
try {
handshake = socket.handshake 
(key.isReadable(), key.isWritable());

}catch ( IOException x ) {
handshake = -1;
if ( log.isDebugEnabled() )  
log.debug("Error during SSL handshake",x);

}catch ( CancelledKeyException ckx ) {
handshake = -1;
}
} else {
   handshake = -1;
}

if ( handshake == 0 ) {
// Process the request from this socket
if ((status != null) &&  
(handler.event(socket, status) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att =  
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch  
(Exception ignore){}
if ( socket.isOpen() )  
socket.close(true);

nioChannels.offer(socket);
if ( att!=null )  
keyCache.offer(att);

}catch ( Exception x ) {
log.error("",x);
}
} else if ((status == null) &&  
(handler.process(socket) == Handler.SocketState.CLOSED)) {

// Close socket and pool
try {
KeyAttachment att =  
(KeyAttachment)socket.getAttachment(true);
try {socket.close();}catch  
(Exception ignore){}
if ( socket.isOpen() )  
socket.close(true);

nioChannels.offer(socket);
if ( att!=null )  
keyCache.offer(att);

}catch ( Exception x ) {
log.error("",x);
}
}
} else if (handshake == -1 ) {
   

Re: Strange tcnative version at tomcat60

2006-10-30 Thread Peter Rossbach

OK,

at which time you plan the 2.x cut?

regards
Peter


Am 30.10.2006 um 20:03 schrieb Mladen Turk:


Peter Rossbach wrote:

Hi Malden,
Must be tcnative at tomcat60 not an external svn link?



I would like that we have the subset of connectors/jni
inside tc6/native (only the parts that are used).

The probable version will be 2.x while the version
in connectors/jni will stay as 1.x for tc 5.5.x

This BTW, follows the general concept for tc6, where
core parts are disconnected from their origin.
This would require extra effort for maintaining, but
it would allow to have the future development decoupled
from the versions needed for 5.5.x branch.

Regards,
Mladen.

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






svn commit: r469213 - /tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java

2006-10-30 Thread fhanik
Author: fhanik
Date: Mon Oct 30 10:09:38 2006
New Revision: 469213

URL: http://svn.apache.org/viewvc?view=rev&rev=469213
Log:
after close has been called we are no longer a comet thingy

Modified:
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?view=diff&rev=469213&r1=469212&r2=469213
==
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java 
Mon Oct 30 10:09:38 2006
@@ -1057,6 +1057,7 @@
 //then execute the connection closure at the next selector 
loop
 
request.getAttributes().remove("org.apache.tomcat.comet.timeout");
 attach.setError(true);
+attach.setComet(false);
 }
 }
 



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



svn commit: r469189 - /tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

2006-10-30 Thread fhanik
Author: fhanik
Date: Mon Oct 30 08:47:10 2006
New Revision: 469189

URL: http://svn.apache.org/viewvc?view=rev&rev=469189
Log:
Fixed bug where OP interest is different for the first time the key is used, 
hence a key that never has been read would never timeout.

Modified:
tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?view=diff&rev=469189&r1=469188&r2=469189
==
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon 
Oct 30 08:47:10 2006
@@ -1129,6 +1129,7 @@
 final KeyAttachment ka = key!=null?key:new KeyAttachment();
 ka.reset(this,socket);
 PollerEvent r = eventCache.poll();
+ka.interestOps(SelectionKey.OP_READ);//this is what OP_REGISTER 
turns into.
 if ( r==null) r = new PollerEvent(socket,ka,OP_REGISTER);
 else r.reset(socket,ka,OP_REGISTER);
 addEvent(r);



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



svn commit: r469211 - /tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java

2006-10-30 Thread pero
Author: pero
Date: Mon Oct 30 10:06:52 2006
New Revision: 469211

URL: http://svn.apache.org/viewvc?view=rev&rev=469211
Log:
Fix some html smells

Modified:
tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java

Modified: 
tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java?view=diff&rev=469211&r1=469210&r2=469211
==
--- tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java 
(original)
+++ tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java 
Mon Oct 30 10:06:52 2006
@@ -114,7 +114,7 @@
 
 PrintWriter writer = response.getWriter();
 writer.println("");
-writer.println("JSP Chat");
+writer.println("JSP Chat");
 writer.flush();
 
 synchronized(connections) {
@@ -166,7 +166,7 @@
 // Compatibility method: equivalent method using the regular 
connection model
 PrintWriter writer = response.getWriter();
 writer.println("");
-writer.println("JSP Chat");
+writer.println("JSP Chat");
 writer.println("Chat example only supports Comet processing");
 writer.println("");
 }
@@ -233,7 +233,7 @@
 PrintWriter writer = 
connections.get(i).getWriter();
 for (int j = 0; j < pendingMessages.length; j++) {
 // FIXME: Add HTML filtering
-writer.println(pendingMessages[j] + "");
+writer.println(pendingMessages[j] + "");
 }
 writer.flush();
 } catch (IOException e) {



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



svn commit: r469212 - /tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

2006-10-30 Thread fhanik
Author: fhanik
Date: Mon Oct 30 10:07:22 2006
New Revision: 469212

URL: http://svn.apache.org/viewvc?view=rev&rev=469212
Log:
cancel the keys

Modified:
tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?view=diff&rev=469212&r1=469211&r2=469212
==
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon 
Oct 30 10:07:22 2006
@@ -1457,6 +1457,8 @@
 KeyAttachment att = 
(KeyAttachment)socket.getAttachment(true);
 try {socket.close();}catch (Exception 
ignore){}
 if ( socket.isOpen() ) socket.close(true);
+key.cancel();
+key.attach(null);
 nioChannels.offer(socket);
 if ( att!=null ) keyCache.offer(att);
 }catch ( Exception x ) {
@@ -1468,6 +1470,8 @@
 KeyAttachment att = 
(KeyAttachment)socket.getAttachment(true);
 try {socket.close();}catch (Exception 
ignore){}
 if ( socket.isOpen() ) socket.close(true);
+key.cancel();
+key.attach(null);
 nioChannels.offer(socket);
 if ( att!=null ) keyCache.offer(att);
 }catch ( Exception x ) {



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



svn commit: r469198 - /tomcat/container/tc5.5.x/webapps/docs/logging.xml

2006-10-30 Thread rjung
Author: rjung
Date: Mon Oct 30 09:10:40 2006
New Revision: 469198

URL: http://svn.apache.org/viewvc?view=rev&rev=469198
Log:
Correct URL typo for java.util.logging API docs.

Modified:
tomcat/container/tc5.5.x/webapps/docs/logging.xml

Modified: tomcat/container/tc5.5.x/webapps/docs/logging.xml
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/logging.xml?view=diff&rev=469198&r1=469197&r2=469198
==
--- tomcat/container/tc5.5.x/webapps/docs/logging.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/logging.xml Mon Oct 30 09:10:40 2006
@@ -320,7 +320,7 @@
 
   
 The fully-qualified class name of a class that implements the
-http://java.suncom/j2se/1.4.2/docs/api/java/util/logging/Formatter.html";>java.util.logging.Formatter
+http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Formatter.html";>java.util.logging.Formatter
 interface.  JULI will load this class and associate it with this 
handler to format its messages.
 By default, there is no Formatter associated with the handler.
   



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



svn commit: r469141 - in /tomcat/tc6.0.x/trunk/webapps/examples/jsp/chat: chat.jsp login.jsp

2006-10-30 Thread pero
Author: pero
Date: Mon Oct 30 05:10:02 2006
New Revision: 469141

URL: http://svn.apache.org/viewvc?view=rev&rev=469141
Log:
fix small html smells

Modified:
tomcat/tc6.0.x/trunk/webapps/examples/jsp/chat/chat.jsp
tomcat/tc6.0.x/trunk/webapps/examples/jsp/chat/login.jsp

Modified: tomcat/tc6.0.x/trunk/webapps/examples/jsp/chat/chat.jsp
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/jsp/chat/chat.jsp?view=diff&rev=469141&r1=469140&r2=469141
==
--- tomcat/tc6.0.x/trunk/webapps/examples/jsp/chat/chat.jsp (original)
+++ tomcat/tc6.0.x/trunk/webapps/examples/jsp/chat/chat.jsp Mon Oct 30 05:10:02 
2006
@@ -29,5 +29,4 @@
 
 
 
-
 

Modified: tomcat/tc6.0.x/trunk/webapps/examples/jsp/chat/login.jsp
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/jsp/chat/login.jsp?view=diff&rev=469141&r1=469140&r2=469141
==
--- tomcat/tc6.0.x/trunk/webapps/examples/jsp/chat/login.jsp (original)
+++ tomcat/tc6.0.x/trunk/webapps/examples/jsp/chat/login.jsp Mon Oct 30 
05:10:02 2006
@@ -28,4 +28,4 @@
 
 
 
-
+



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



svn commit: r469168 - /tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

2006-10-30 Thread fhanik
Author: fhanik
Date: Mon Oct 30 07:53:19 2006
New Revision: 469168

URL: http://svn.apache.org/viewvc?view=rev&rev=469168
Log:
If the key is null, channel is closed,not sure this is the correct fix, since 
the key potentially had an attachment this could lead to NIO mem leak, must 
track down how this happens

Modified:
tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?view=diff&rev=469168&r1=469167&r2=469168
==
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon 
Oct 30 07:53:19 2006
@@ -1432,13 +1432,11 @@
 
 }
 } else {
-
 NioChannel socket = (NioChannel)channel;
-
 SelectionKey key = 
socket.getIOChannel().keyFor(socket.getPoller().getSelector());
 int handshake = -1;
 try {
-handshake = socket.handshake(key.isReadable(), 
key.isWritable());
+handshake = 
key!=null?socket.handshake(key.isReadable(), key.isWritable()):-1;
 }catch ( IOException x ) {
 handshake = -1;
 if ( log.isDebugEnabled() ) log.debug("Error 
during SSL handshake",x);



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



svn commit: r469178 - /tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

2006-10-30 Thread fhanik
Author: fhanik
Date: Mon Oct 30 08:15:35 2006
New Revision: 469178

URL: http://svn.apache.org/viewvc?view=rev&rev=469178
Log:
Revert fix, suggestion was incorrect and can lead to memory leaks

Modified:
tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?view=diff&rev=469178&r1=469177&r2=469178
==
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon 
Oct 30 08:15:35 2006
@@ -1432,11 +1432,13 @@
 
 }
 } else {
+
 NioChannel socket = (NioChannel)channel;
+
 SelectionKey key = 
socket.getIOChannel().keyFor(socket.getPoller().getSelector());
 int handshake = -1;
 try {
-handshake = 
key!=null?socket.handshake(key.isReadable(), key.isWritable()):-1;
+handshake = socket.handshake(key.isReadable(), 
key.isWritable());
 }catch ( IOException x ) {
 handshake = -1;
 if ( log.isDebugEnabled() ) log.debug("Error 
during SSL handshake",x);
@@ -1469,7 +1471,7 @@
 }
 }
 } else if (handshake == -1 ) {
-if ( key.isValid() ) key.cancel();
+
socket.getPoller().cancelledKey(key,SocketStatus.DISCONNECT);
 try {socket.close(true);}catch (IOException 
ignore){}
 nioChannels.offer(socket);
 } else {



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



svn commit: r469207 - /tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

2006-10-30 Thread fhanik
Author: fhanik
Date: Mon Oct 30 09:47:26 2006
New Revision: 469207

URL: http://svn.apache.org/viewvc?view=rev&rev=469207
Log:
Fixed null pointer exception on comet socket timeout

Modified:
tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?view=diff&rev=469207&r1=469206&r2=469207
==
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon 
Oct 30 09:47:26 2006
@@ -1138,13 +1138,14 @@
 public void cancelledKey(SelectionKey key, SocketStatus status) {
 try {
 KeyAttachment ka = (KeyAttachment) key.attachment();
-if ( key.isValid() ) key.cancel();
-if (ka != null && ka.getComet()) processSocket( 
ka.getChannel(), status);
-// FIXME: closing in all these cases is a bit mean. IMO, it 
should leave it
-// to the worker (or executor) depending on what the request 
processor
-// returns
-if ( key.channel().isOpen() ) key.channel().close();
-key.attach(null);
+if (ka != null && ka.getComet()) {
+//the comet event takes care of clean up
+processSocket(ka.getChannel(), status);
+}else {
+if (key.isValid()) key.cancel();
+if (key.channel().isOpen()) key.channel().close();
+key.attach(null);
+}
 } catch (Throwable e) {
 if ( log.isDebugEnabled() ) log.error("",e);
 // Ignore
@@ -1257,6 +1258,8 @@
 long timeout = (ka.getTimeout()==-1)?((long) 
socketProperties.getSoTimeout()):(ka.getTimeout());
 boolean isTimedout = delta > timeout;
 if (isTimedout) {
+key.interestOps(0); 
+ka.interestOps(0); //avoid duplicate timeout calls
 cancelledKey(key, SocketStatus.TIMEOUT);
 } else {
 long nextTime = now+(timeout-delta);



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



Re: It seems that Http11NioProtocol handler not working at mac os x 10.4.8 ppc

2006-10-30 Thread Remy Maucherat

Peter Rossbach wrote:

Hi Filip,

ok, next step:

30.10.2006 19:51:44 org.apache.catalina.core.ApplicationContext log
INFO: ChatServlet: Begin for session: DC3A87204AA3AE2A441848596CF77373
30.10.2006 19:52:27 org.apache.catalina.core.ApplicationContext log
INFO: ChatServlet: Error for session: DC3A87204AA3AE2A441848596CF77373

===

It seems that the buffer flush at ChatServlet work, but browser not 
showing the result. The connection connection timeout

close the socket and then browser get the results.

Can you send me a working comet style example?


The example doesn't "really" work right now, as the browser won't 
render. The data was sent last time I checked (that's all I was 
interested in).


It would be good to improve it :)

Rémy


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



svn commit: r469360 - in /tomcat/container/tc5.5.x: catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java webapps/docs/changelog.xml

2006-10-30 Thread markt
Author: markt
Date: Mon Oct 30 19:51:44 2006
New Revision: 469360

URL: http://svn.apache.org/viewvc?view=rev&rev=469360
Log:
Fix bug 37458 where concurrent attempts to load the same class could set 
entry.manifest to null in one thread whilst the other thread(s) were operating 
under the assumption it was still non-null.
I had to add a largish sync block to do this (since the package sealing check 
also uses entry) but it is on entry rather than this 
so the impact should be minimal.
I also fixed a rare but possible IAE in the package definition section. Looking 
at the dev archive, at least one user has seen this problem so it isn't 
entirely theoretical.

Modified:

tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java?view=diff&rev=469360&r1=469359&r2=469360
==
--- 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
 (original)
+++ 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
 Mon Oct 30 19:51:44 2006
@@ -1793,63 +1793,59 @@
 if (clazz != null)
 return clazz;
 
-synchronized (this) {
+synchronized (entry) {
 if (entry.binaryContent == null && entry.loadedClass == null)
 throw new ClassNotFoundException(name);
-}
 
-// Looking up the package
-String packageName = null;
-int pos = name.lastIndexOf('.');
-if (pos != -1)
-packageName = name.substring(0, pos);
-
-Package pkg = null;
-
-if (packageName != null) {
-
-pkg = getPackage(packageName);
-
-// Define the package (if null)
-if (pkg == null) {
-if (entry.manifest == null) {
-definePackage(packageName, null, null, null, null, null,
-  null, null);
-} else {
-definePackage(packageName, entry.manifest, entry.codeBase);
+// Looking up the package
+String packageName = null;
+int pos = name.lastIndexOf('.');
+if (pos != -1)
+packageName = name.substring(0, pos);
+
+Package pkg = null;
+
+if (packageName != null) {
+
+synchronized(this) {
+pkg = getPackage(packageName);
+
+// Define the package (if null)
+if (pkg == null) {
+if (entry.manifest == null) {
+definePackage(packageName, null, null, null, null,
+null, null, null);
+} else {
+definePackage(packageName, entry.manifest,
+entry.codeBase);
+}
+}
 }
 }
 
-}
-
-// Create the code source object
-CodeSource codeSource =
-new CodeSource(entry.codeBase, entry.certificates);
-
-if (securityManager != null) {
-
-// Checking sealing
-if (pkg != null) {
-boolean sealCheck = true;
-if (pkg.isSealed()) {
-sealCheck = pkg.isSealed(entry.codeBase);
-} else {
-sealCheck = (entry.manifest == null)
-|| !isPackageSealed(packageName, entry.manifest);
+if (securityManager != null) {
+
+// Checking sealing
+if (pkg != null) {
+boolean sealCheck = true;
+if (pkg.isSealed()) {
+sealCheck = pkg.isSealed(entry.codeBase);
+} else {
+sealCheck = (entry.manifest == null)
+|| !isPackageSealed(packageName, entry.manifest);
+}
+if (!sealCheck)
+throw new SecurityException
+("Sealing violation loading " + name + " : Package 
"
+ + packageName + " is sealed.");
 }
-if (!sealCheck)
-throw new SecurityException
-("Sealing violation loading " + name + " : Package "
- + packageName + " is sealed.");
+
 }
 
-}
-
-synchronized (this) {
 if (entry.loadedClass == null) {
 clazz = defineClass(name, entry.binaryContent, 0,