db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1594435 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
Date Wed, 14 May 2014 00:34:31 GMT
Author: mamta
Date: Wed May 14 00:34:31 2014
New Revision: 1594435

URL: http://svn.apache.org/r1594435
Log:
DERBY-6337(derbynet.ServerPropertiesTest.ttestSetPortPriority prints exception java.lang.Exception:
DRDA_InvalidReplyTooShort.S:Invalid reply f rom network server: Insufficient data. but test
passes)

Basically the issue is that sometimes when server is shutting down and a ping is sent to it
around the same time, ping might be able to connect to server but before the ping hand shake
can complete, the server might shutdown thus resulting in the ping client receiving a DRDA_InvalidReplyTooShort.
This is probably why the test in this issue fails intermittently. To fix the issue, if ping
does run into DRDA_InvalidReplyTooShort.S:Invalidreply, we will send another ping after waiting
for a little time, and this time around we should get expected can't connect to server exception
because server is down by now.


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java?rev=1594435&r1=1594434&r2=1594435&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
Wed May 14 00:34:31 2014
@@ -623,6 +623,22 @@ final public class NetworkServerTestSetu
         boolean expectServerUp)
         throws InterruptedException
     {
+        //DERBY-6337(derbynet.ServerPropertiesTest.ttestSetPortPriority prints 
+        // exception java.lang.Exception: 
+        // DRDA_InvalidReplyTooShort.S:Invalidreply from network 
+        // server:Insufficent data. but test passes)
+        //Sometimes, when server is coming down and a ping is sent to it, ping
+        // may get DRDA_InvalidReplyTooShort.S:Invalidreply rather than server
+        // is down depending on the timing of the server shutdown. If we do run
+        // into DRDA_InvalidReplyTooShort.S:Invalidreply, we will now send 
+        // another ping after a little wait, and this time around we should 
+        // get expected server down exception.
+        //Following boolean will be set to true if we get reply too short
+        // during the ping and it will try to ping again. But if we get
+        // the reply too short on that ping attempt as well, we will just
+        // print the exception on the console and conclude that server is
+        // down.
+        boolean alreadyGotReplyTooShort=false;
         // If we expect the server to be or come up, then
         // it makes sense to sleep (if ping unsuccessful), then ping 
         // and repeat this for the duration of wait-time, but stop
@@ -647,8 +663,13 @@ final public class NetworkServerTestSetu
             } catch (Throwable e) {
                 if ( !vetPing( e ) )
                 {
+                    if ( !alreadyGotReplyTooShort && 
+                            (e.getMessage().startsWith( "DRDA_InvalidReplyTooShort.S:" )
) ){
+                        alreadyGotReplyTooShort = true;
+                        Thread.sleep(SLEEP_TIME);
+                        continue;
+                    }
                     e.printStackTrace( System.out );
-
                     // at this point, we don't have the usual "server not up
                     // yet" error. get out. at this point, you may have to
                     // manually kill the server.



Mime
View raw message