You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/09/20 13:02:42 UTC

svn commit: r1173082 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11NioProtocol.java test/org/apache/catalina/comet/TestCometProcessor.java

Author: markt
Date: Tue Sep 20 11:02:41 2011
New Revision: 1173082

URL: http://svn.apache.org/viewvc?rev=1173082&view=rev
Log:
Remove empty comment

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
    tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1173082&r1=1173081&r2=1173082&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Tue Sep 20 11:02:41 2011
@@ -93,8 +93,6 @@ public class Http11NioProtocol extends A
     public long getSelectorTimeout() {
         return ((NioEndpoint)endpoint).getSelectorTimeout();
     }
-    // *
-
     
     public void setAcceptorThreadPriority(int threadPriority) {
         ((NioEndpoint)endpoint).setAcceptorThreadPriority(threadPriority);

Modified: tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java?rev=1173082&r1=1173081&r2=1173082&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java (original)
+++ tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java Tue Sep 20 11:02:41 2011
@@ -124,6 +124,7 @@ public class TestCometProcessor extends 
 
         // Setup Tomcat instance
         Tomcat tomcat = getTomcatInstance();
+        tomcat.getConnector().setAttribute("connectionTimeout", "200000");
         Context root = tomcat.addContext("", TEMP_DIR);
         Tomcat.addServlet(root, "comet", new SimpleCometServlet());
         root.addServletMapping("/", "comet");
@@ -132,7 +133,8 @@ public class TestCometProcessor extends 
         // Create connection to Comet servlet
         final Socket socket =
             SocketFactory.getDefault().createSocket("localhost", getPort());
-        socket.setSoTimeout(10000);
+        socket.setSoTimeout(100000);
+        System.out.println(socket.getLocalPort());
         
         final OutputStream os = socket.getOutputStream();
         String requestLine = "POST http://localhost:" + getPort() +
@@ -160,7 +162,12 @@ public class TestCometProcessor extends 
             Thread.sleep(100);
             count ++;
         }
-
+        System.out.println("Writer sent " + writeThread.getPingCount() +
+                " pings");
+        if (writeThread.isAlive()) {
+            System.out.println("Writer not stopped");
+        }
+        
         // Wait for the read thread to stop
         count = 0;
         while (readThread.isAlive() && count < 100) {
@@ -228,12 +235,13 @@ public class TestCometProcessor extends 
 
     private static class PingWriterThread extends Thread {
         
-        private int pingCount;
+        private int maxPingCount;
+        private volatile int pingCount;
         private OutputStream os;
         private volatile Exception e = null;
 
-        public PingWriterThread(int pingCount, OutputStream os) {
-            this.pingCount = pingCount;
+        public PingWriterThread(int maxPingCount, OutputStream os) {
+            this.maxPingCount = maxPingCount;
             this.os = os;
         }
 
@@ -241,10 +249,14 @@ public class TestCometProcessor extends 
             return e;
         }
 
+        public int getPingCount() {
+            return pingCount;
+        }
+
         @Override
         public void run() {
             try {
-                for (int i = 0; i < pingCount; i++) {
+                for (pingCount = 0; pingCount < maxPingCount; pingCount++) {
                     os.write("4\r\n".getBytes());
                     os.write("PING\r\n".getBytes());
                     os.flush();



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


Re: svn commit: r1173082 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11NioProtocol.java test/org/apache/catalina/comet/TestCometProcessor.java

Posted by Rainer Jung <ra...@kippdata.de>.
On 21.09.2011 20:17, Rainer Jung wrote:
> On 21.09.2011 12:44, Mark Thomas wrote:
>> On 21/09/2011 01:41, Konstantin Kolinko wrote:
>>> 2011/9/20 Mark Thomas <ma...@apache.org>:
>>>> On 20/09/2011 13:41, Konstantin Kolinko wrote:
>>>>>
>>>>> BTW: I am unable to reproduce Gump failure for TestCometProcessor with NIO
>>>>> (running with JDK 6u26/WinXP),
>>>>> but this test fails for me when running it with APR connector.
>>>>
>>>> I *think* I have all these issues fixed now. The unit tests pass for me
>>>> on Linux and Windows. We'll find out tomorrow if Gump is happy now. If
>>>> you could test APR as well that would be great.
>>
>> Thanks for the test results.
>>
>>> Running trunk @r1173433,
>>> BIO - OK (it actually skips the test)
>>> APR - OK
>>> NIO failed first 2 of 8 runs:
>>>
>>> [[[
>>> ------------- ---------------- ---------------
>>>
>>> Testcase: testSimpleCometClient took 17,813 sec
>>> 	FAILED
>>> expected:<Client: READ: [4] bytes> but was:<Client: READ: [8] bytes>
>>> junit.framework.AssertionFailedError: expected:<Client: READ: [4]
>>> bytes> but was:<Client: READ: [8] bytes>
>>> 	at org.apache.catalina.comet.TestCometProcessor.testSimpleCometClient(TestCometProcessor.java:97)
>>>
>>> Testcase: testCometConnectorStop took 5,328 sec
>>> ]]]
>>>
>>> IIRC it is expected (two subsequent network packets arriving to Tomcat
>>> without a delay between them)
>>
>> That is unusual but not unexpected. We could handle that to prevent
>> false positives if you find it happening a lot.
> 
> That's the type of failure I saw intermittent with the old code. I
> didn't yet have a chance to retest. Last time I saw those failures it
> was always the first two "PING" messages that came in combined as
> PINGPING. When I added a 2 second delay before starting the write in the
> PingWriterThread, I could no longer reproduce the problem.

I checked the timing behaviour without the additional delay when the
problem occurs (this time first three PINGs concatenated):

PingWriterThread starting at 1316702527978
PING sent at 1316702527979
PingReaderThread starting at 1316702527980
BEGIN received at 1316702528903
PING sent at 1316702529003
PING sent at 1316702530009
READ starts at 1316702530013
READ first three PINGs
READ ends at 1316702530014
READ starts at 1316702531014
READ: PING-1316702531010
READ ends at 1316702531014
END received at 1316702532015
PingWriterThread ended at 1316702532010
PingReaderThread ended at 1316702535019

Regards,

Rainer

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


Re: svn commit: r1173082 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11NioProtocol.java test/org/apache/catalina/comet/TestCometProcessor.java

Posted by Rainer Jung <ra...@kippdata.de>.
On 21.09.2011 12:44, Mark Thomas wrote:
> On 21/09/2011 01:41, Konstantin Kolinko wrote:
>> 2011/9/20 Mark Thomas <ma...@apache.org>:
>>> On 20/09/2011 13:41, Konstantin Kolinko wrote:
>>>>
>>>> BTW: I am unable to reproduce Gump failure for TestCometProcessor with NIO
>>>> (running with JDK 6u26/WinXP),
>>>> but this test fails for me when running it with APR connector.
>>>
>>> I *think* I have all these issues fixed now. The unit tests pass for me
>>> on Linux and Windows. We'll find out tomorrow if Gump is happy now. If
>>> you could test APR as well that would be great.
> 
> Thanks for the test results.
> 
>> Running trunk @r1173433,
>> BIO - OK (it actually skips the test)
>> APR - OK
>> NIO failed first 2 of 8 runs:
>>
>> [[[
>> ------------- ---------------- ---------------
>>
>> Testcase: testSimpleCometClient took 17,813 sec
>> 	FAILED
>> expected:<Client: READ: [4] bytes> but was:<Client: READ: [8] bytes>
>> junit.framework.AssertionFailedError: expected:<Client: READ: [4]
>> bytes> but was:<Client: READ: [8] bytes>
>> 	at org.apache.catalina.comet.TestCometProcessor.testSimpleCometClient(TestCometProcessor.java:97)
>>
>> Testcase: testCometConnectorStop took 5,328 sec
>> ]]]
>>
>> IIRC it is expected (two subsequent network packets arriving to Tomcat
>> without a delay between them)
> 
> That is unusual but not unexpected. We could handle that to prevent
> false positives if you find it happening a lot.

That's the type of failure I saw intermittent with the old code. I
didn't yet have a chance to retest. Last time I saw those failures it
was always the first two "PING" messages that came in combined as
PINGPING. When I added a 2 second delay before starting the write in the
PingWriterThread, I could no longer reproduce the problem.

Regards,

Rainer


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


Re: svn commit: r1173082 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11NioProtocol.java test/org/apache/catalina/comet/TestCometProcessor.java

Posted by Mark Thomas <ma...@apache.org>.
On 21/09/2011 01:41, Konstantin Kolinko wrote:
> 2011/9/20 Mark Thomas <ma...@apache.org>:
>> On 20/09/2011 13:41, Konstantin Kolinko wrote:
>>>
>>> BTW: I am unable to reproduce Gump failure for TestCometProcessor with NIO
>>> (running with JDK 6u26/WinXP),
>>> but this test fails for me when running it with APR connector.
>>
>> I *think* I have all these issues fixed now. The unit tests pass for me
>> on Linux and Windows. We'll find out tomorrow if Gump is happy now. If
>> you could test APR as well that would be great.

Thanks for the test results.

> Running trunk @r1173433,
> BIO - OK (it actually skips the test)
> APR - OK
> NIO failed first 2 of 8 runs:
> 
> [[[
> ------------- ---------------- ---------------
> 
> Testcase: testSimpleCometClient took 17,813 sec
> 	FAILED
> expected:<Client: READ: [4] bytes> but was:<Client: READ: [8] bytes>
> junit.framework.AssertionFailedError: expected:<Client: READ: [4]
> bytes> but was:<Client: READ: [8] bytes>
> 	at org.apache.catalina.comet.TestCometProcessor.testSimpleCometClient(TestCometProcessor.java:97)
> 
> Testcase: testCometConnectorStop took 5,328 sec
> ]]]
> 
> IIRC it is expected (two subsequent network packets arriving to Tomcat
> without a delay between them)

That is unusual but not unexpected. We could handle that to prevent
false positives if you find it happening a lot.

> Also the following messages (they existed before),
>     [junit] 21.09.2011 4:18:14
> org.apache.catalina.util.SessionIdGenerator createSecureRandom
>     [junit] INFO: Creation of SecureRandom instance for session ID
> generation using [SHA1PRNG] took [5,016] milliseconds.

I think that is a side effect of starting lots of Tomcat instances one
after the other and using up the available entropy.

> (...)
>     [junit] 21.09.2011 4:18:22
> org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
>     [junit] SEVERE: The web application [] appears to have started a
> thread named [SeedGenerator Thread] but has failed to stop it. This is
> very likely to create a memory leak.

That looks like something triggered by the use of SecureRandom and may
be a genuine memory leak.

> and for APR connector (but it does not make it to fail):
> 
>     [junit] 21.09.2011 4:18:22 org.apache.tomcat.util.net.AprEndpoint
> allocatePoller
>     [junit] INFO: Failed to create poller with specified size of 8192

That is expected with Windows that can't handle the default poller size.

Mark

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


Re: svn commit: r1173082 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11NioProtocol.java test/org/apache/catalina/comet/TestCometProcessor.java

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/9/20 Mark Thomas <ma...@apache.org>:
> On 20/09/2011 13:41, Konstantin Kolinko wrote:
>>
>> BTW: I am unable to reproduce Gump failure for TestCometProcessor with NIO
>> (running with JDK 6u26/WinXP),
>> but this test fails for me when running it with APR connector.
>
> I *think* I have all these issues fixed now. The unit tests pass for me
> on Linux and Windows. We'll find out tomorrow if Gump is happy now. If
> you could test APR as well that would be great.

Running trunk @r1173433,
BIO - OK (it actually skips the test)
APR - OK
NIO failed first 2 of 8 runs:

[[[
------------- ---------------- ---------------

Testcase: testSimpleCometClient took 17,813 sec
	FAILED
expected:<Client: READ: [4] bytes> but was:<Client: READ: [8] bytes>
junit.framework.AssertionFailedError: expected:<Client: READ: [4]
bytes> but was:<Client: READ: [8] bytes>
	at org.apache.catalina.comet.TestCometProcessor.testSimpleCometClient(TestCometProcessor.java:97)

Testcase: testCometConnectorStop took 5,328 sec
]]]

IIRC it is expected (two subsequent network packets arriving to Tomcat
without a delay between them)


Also the following messages (they existed before),
    [junit] 21.09.2011 4:18:14
org.apache.catalina.util.SessionIdGenerator createSecureRandom
    [junit] INFO: Creation of SecureRandom instance for session ID
generation using [SHA1PRNG] took [5,016] milliseconds.
(...)
    [junit] 21.09.2011 4:18:22
org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
    [junit] SEVERE: The web application [] appears to have started a
thread named [SeedGenerator Thread] but has failed to stop it. This is
very likely to create a memory leak.

and for APR connector (but it does not make it to fail):

    [junit] 21.09.2011 4:18:22 org.apache.tomcat.util.net.AprEndpoint
allocatePoller
    [junit] INFO: Failed to create poller with specified size of 8192


It is with JDK 6u26 on WinXP 32-bit.

Best regards,
Konstantin Kolinko

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


Re: svn commit: r1173082 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11NioProtocol.java test/org/apache/catalina/comet/TestCometProcessor.java

Posted by Mark Thomas <ma...@apache.org>.
On 20/09/2011 13:41, Konstantin Kolinko wrote:
> 2011/9/20 Mark Thomas <ma...@apache.org>:
>> On 20/09/2011 12:09, Konstantin Kolinko wrote:
>>> 2011/9/20  <ma...@apache.org>:
>>>> Author: markt
>>>> Date: Tue Sep 20 11:02:41 2011
>>>> New Revision: 1173082
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1173082&view=rev
>>>> Log:
>>>> Remove empty comment
>>>
>>> You did more than removed a comment (you've committed two files
>>> instead of one)...
>>
>> Thanks. I'll revert that now. If it isn't obvious, I'm working on fixing
>> the JUnit test failures.
>>
> 
> I see that, but it looks more like a temporary debug code.
> 
> BTW: I am unable to reproduce Gump failure for TestCometProcessor with NIO
> (running with JDK 6u26/WinXP),
> but this test fails for me when running it with APR connector.

I *think* I have all these issues fixed now. The unit tests pass for me
on Linux and Windows. We'll find out tomorrow if Gump is happy now. If
you could test APR as well that would be great.

Mark

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


Re: svn commit: r1173082 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11NioProtocol.java test/org/apache/catalina/comet/TestCometProcessor.java

Posted by Mark Thomas <ma...@apache.org>.
On 20/09/2011 13:41, Konstantin Kolinko wrote:
> 2011/9/20 Mark Thomas <ma...@apache.org>:
>> On 20/09/2011 12:09, Konstantin Kolinko wrote:
>>> 2011/9/20  <ma...@apache.org>:
>>>> Author: markt
>>>> Date: Tue Sep 20 11:02:41 2011
>>>> New Revision: 1173082
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1173082&view=rev
>>>> Log:
>>>> Remove empty comment
>>>
>>> You did more than removed a comment (you've committed two files
>>> instead of one)...
>>
>> Thanks. I'll revert that now. If it isn't obvious, I'm working on fixing
>> the JUnit test failures.
>>
> 
> I see that, but it looks more like a temporary debug code.
> 
> BTW: I am unable to reproduce Gump failure for TestCometProcessor with NIO
> (running with JDK 6u26/WinXP),

I can reproduce the NIO failure so I am working on that at the moment.
It is proving tricky to track down. It is at the stage where running
with and without debug enabled makes the difference between passing and
failure so just enabling debugging changes the result. I am narrowing
the cause down but it might take a while.

Mark

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


Re: svn commit: r1173082 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11NioProtocol.java test/org/apache/catalina/comet/TestCometProcessor.java

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/9/20 Mark Thomas <ma...@apache.org>:
> On 20/09/2011 12:09, Konstantin Kolinko wrote:
>> 2011/9/20  <ma...@apache.org>:
>>> Author: markt
>>> Date: Tue Sep 20 11:02:41 2011
>>> New Revision: 1173082
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1173082&view=rev
>>> Log:
>>> Remove empty comment
>>
>> You did more than removed a comment (you've committed two files
>> instead of one)...
>
> Thanks. I'll revert that now. If it isn't obvious, I'm working on fixing
> the JUnit test failures.
>

I see that, but it looks more like a temporary debug code.

BTW: I am unable to reproduce Gump failure for TestCometProcessor with NIO
(running with JDK 6u26/WinXP),
but this test fails for me when running it with APR connector.

trunk, @r1173101

[[[
    [junit] INFO: Stopping ProtocolHandler ["http-apr-8002"]
    [junit] 20.09.2011 16:36:49 org.apache.coyote.AbstractProtocol destroy
    [junit] INFO: Destroying ProtocolHandler ["http-apr-8002"]
    [junit] 20.09.2011 16:36:49
org.apache.catalina.connector.CoyoteAdapter event
    [junit] SEVERE: null
    [junit] java.lang.NullPointerException
    [junit] 	at
org.apache.catalina.connector.CoyoteAdapter.event(CoyoteAdapter.java:211)
    [junit] 	at
org.apache.coyote.http11.Http11AprProcessor.event(Http11AprProcessor.java:133)
    [junit] 	at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:513)
    [junit] 	at
org.apache.tomcat.util.net.AprEndpoint$SocketEventProcessor.run(AprEndpoint.java:1869)
    [junit] 	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    [junit] 	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    [junit] 	at java.lang.Thread.run(Thread.java:662)
    [junit] 20.09.2011 16:36:50
org.apache.catalina.core.StandardService stopInternal
    [junit] INFO: Stopping service Tomcat
]]]

Best regards,
Konstantin Kolinko

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


Re: svn commit: r1173082 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11NioProtocol.java test/org/apache/catalina/comet/TestCometProcessor.java

Posted by Mark Thomas <ma...@apache.org>.
On 20/09/2011 12:09, Konstantin Kolinko wrote:
> 2011/9/20  <ma...@apache.org>:
>> Author: markt
>> Date: Tue Sep 20 11:02:41 2011
>> New Revision: 1173082
>>
>> URL: http://svn.apache.org/viewvc?rev=1173082&view=rev
>> Log:
>> Remove empty comment
> 
> You did more than removed a comment (you've committed two files
> instead of one)...

Thanks. I'll revert that now. If it isn't obvious, I'm working on fixing
the JUnit test failures.

Mark

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


Re: svn commit: r1173082 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11NioProtocol.java test/org/apache/catalina/comet/TestCometProcessor.java

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/9/20  <ma...@apache.org>:
> Author: markt
> Date: Tue Sep 20 11:02:41 2011
> New Revision: 1173082
>
> URL: http://svn.apache.org/viewvc?rev=1173082&view=rev
> Log:
> Remove empty comment

You did more than removed a comment (you've committed two files
instead of one)...

>
> Modified:
>    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
>    tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java
>
> Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1173082&r1=1173081&r2=1173082&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
> +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Tue Sep 20 11:02:41 2011
> @@ -93,8 +93,6 @@ public class Http11NioProtocol extends A
>     public long getSelectorTimeout() {
>         return ((NioEndpoint)endpoint).getSelectorTimeout();
>     }
> -    // *
> -
>
>     public void setAcceptorThreadPriority(int threadPriority) {
>         ((NioEndpoint)endpoint).setAcceptorThreadPriority(threadPriority);
>
> Modified: tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java?rev=1173082&r1=1173081&r2=1173082&view=diff
> ==============================================================================
> --- tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java (original)
> +++ tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java Tue Sep 20 11:02:41 2011
> @@ -124,6 +124,7 @@ public class TestCometProcessor extends
>
>         // Setup Tomcat instance
>         Tomcat tomcat = getTomcatInstance();
> +        tomcat.getConnector().setAttribute("connectionTimeout", "200000");
>         Context root = tomcat.addContext("", TEMP_DIR);
>         Tomcat.addServlet(root, "comet", new SimpleCometServlet());
>         root.addServletMapping("/", "comet");
> @@ -132,7 +133,8 @@ public class TestCometProcessor extends
>         // Create connection to Comet servlet
>         final Socket socket =
>             SocketFactory.getDefault().createSocket("localhost", getPort());
> -        socket.setSoTimeout(10000);
> +        socket.setSoTimeout(100000);
> +        System.out.println(socket.getLocalPort());
>
>         final OutputStream os = socket.getOutputStream();
>         String requestLine = "POST http://localhost:" + getPort() +
> @@ -160,7 +162,12 @@ public class TestCometProcessor extends
>             Thread.sleep(100);
>             count ++;
>         }
> -
> +        System.out.println("Writer sent " + writeThread.getPingCount() +
> +                " pings");
> +        if (writeThread.isAlive()) {
> +            System.out.println("Writer not stopped");
> +        }
> +
>         // Wait for the read thread to stop
>         count = 0;
>         while (readThread.isAlive() && count < 100) {
> @@ -228,12 +235,13 @@ public class TestCometProcessor extends
>
>     private static class PingWriterThread extends Thread {
>
> -        private int pingCount;
> +        private int maxPingCount;
> +        private volatile int pingCount;
>         private OutputStream os;
>         private volatile Exception e = null;
>
> -        public PingWriterThread(int pingCount, OutputStream os) {
> -            this.pingCount = pingCount;
> +        public PingWriterThread(int maxPingCount, OutputStream os) {
> +            this.maxPingCount = maxPingCount;
>             this.os = os;
>         }
>
> @@ -241,10 +249,14 @@ public class TestCometProcessor extends
>             return e;
>         }
>
> +        public int getPingCount() {
> +            return pingCount;
> +        }
> +
>         @Override
>         public void run() {
>             try {
> -                for (int i = 0; i < pingCount; i++) {
> +                for (pingCount = 0; pingCount < maxPingCount; pingCount++) {
>                     os.write("4\r\n".getBytes());
>                     os.write("PING\r\n".getBytes());
>                     os.flush();
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

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