[ 
https://issues.apache.org/jira/browse/DERBY-6337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13945457#comment-13945457
 ] 

Mamta A. Satoor commented on DERBY-6337:
----------------------------------------

I have spent some time understanding the test fixture ttestSetPortPriority and 
following is a brief description of it.

The test is trying to set the port number in 4 different way while starting the 
server.

1)First, it makes sure that if there are any instance of Network Server running 
on default port, then it is shutdown.
2)Then using the test harness(which uses NetworkServerControl to start the 
network server), the test starts the network server on the default port. As 
part of starting the server, the test makes canPingServer() call to make sure 
that the server is up. 
3)Next, the test finds another available port and creates derby.properties file 
and puts the new port number info in the derby.properties using 
derby.drda.portNumber property. 
4)In order for Derby to read the derby.properties file, the test shutdowns 
Derby engine and starts a new instance of network server which should use the 
port number specified in derby.properties file. Again, as part of starting the 
server, the test makes canPingServer() call to make sure that the server is up. 
5)By now, we have 2 instances of Network Server running.
6)Next, the test finds another available port but this time it sets the system 
property derby.drda.portNumber to the available port number and starts the 
server. Again, as part of starting the server, the test makes canPingServer() 
call to make sure that the server is up. Note that system property takes 
precedence over derby.properties file and hence even though there is a port 
number specified in derby.properties file, Network Server will be started on 
the port number specified by system property derby.drda.portNumber.
7)Next, the test finds another available port and starts the network server 
using the test harness but this time it passes the port number directly to 
NetworkServerControl(even though system property derby.drda.portNumber and 
derby.properties have different port numbers, the port number passed to 
NetworkServerControl supercedes system property and derby.properties). As 
usual, as part of starting the server, the test makes canPingServer() call to 
make sure that the server is up. The network server is started using following 
call by the test harness. Note the use of the port number. In all the other 
cases so far, the port number was not passed to NetworkServerControl 
constructor.
new NetworkServerControl(host, port, user, password)
8)Lastly, as the 4th variation of specifying the port number, the test finds 
another availble port number. But this time, it does not start the server using 
the test harness. Instead, it uses Java executable to start the network server 
as shown below
java -Dderby.system.home=homeDir org.apache.derby.drda.NetworkServerControl 
-pPortNumber -noSecurityManager start
9)After issuing this command, the test makes an attempt to ping the server and 
this is where the test has failed intermittently. None of the other way of 
attempting to start and ping the server ever run into intermittent Insufficient 
Data failure issue. All the intermittent failures have been after starting the 
server using Java executable. It appears that while doing protocol handshake 
with the server during the ping call, client side runs into Insufficient 
Data(normally this error means that client was expecting more data from server 
but instead it got end of data signal from the server. I hope my understanding 
of Insufficient Data is correct). And this error is just printed on the console 
and no error is thrown and ttestSetPortPriority continues with the rest of the 
testing. The rest of the test is as follows.
10)It issues another Java executable command to shutdown the server started in 
step 8). It pings the server to see if it is still up but the ping command 
returns false.
11)Next, it shuts down server started in step 7). It passes the port number to 
NetworkServerControl. It pings the server to see if it ia still up but the ping 
command returns false.
12)Next, it shuts down server started in step 6). It passes the port number 
using system property derby.drda.portNumber. After shutdown, it removes the 
system property derby.drda.portNumber. It pings the server to see if it is 
still up but the ping command returns false.
13)Next, it shuts down server started in step 4). It passes the port number 
using derby.properties file. It pings the server to see if it is still up but 
the ping command returns false. It removes the derby.properties file after this 
shutdown.
14)Next, it shuts down the only remaining network server instance which was 
started in step 2). It pings the server to see if it is still up but the ping 
command returns false. It removes the derby.properties file after this shutdown.

Hopefully, the above explanation of the test fixture is helpful. If I have 
missed anything in my understanding, please correct me.

I am not sure why we get intermittent insufficient data when the network server 
is started using Java executable rather than direct calls to instantiate 
NetworkServerControl in the test harness. One assumption could be that by the 
time we find an available port and use that port in Java executable command to 
start the server, the port is not available any more on slow machines. But in 
that case, should we be getting insufficient data? May be we can add some 
diagnostic information to the test after starting a Java executable server to 
see if Java executable network server start resulted in any failure. We should 
also test after starting the server if the port is still available(indicating 
server never got started). May be shutdown of that server using Java executable 
actually fails but we never see the output from the Java executable command. We 
should also find out if we can get output from the two Java executable calls to 
start and stop the server to see if we missed any failures from those commands. 
I will start to see how to gather up results from Java executable. If there is 
anything else I should pursue, please let me know. Thanks


> derbynet.ServerPropertiesTest.ttestSetPortPriority prints exception  
> java.lang.Exception: DRDA_InvalidReplyTooShort.S:Invalid reply f rom network 
> server: Insufficient data. but test passes
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-6337
>                 URL: https://issues.apache.org/jira/browse/DERBY-6337
>             Project: Derby
>          Issue Type: Bug
>         Environment: Windows 7, IBM java 7 
> java version "1.7.0"
> Java(TM) SE Runtime Environment (build pwi3270sr5-20130619_01(SR5))
> IBM J9 VM (build 2.6, JRE 1.7.0 Windows 7 x86-32 20130617_152572 (JIT 
> enabled, AOT enabled)
> J9VM - R26_Java726_SR5_20130617_1436_B152572
> JIT  - r11.b04_20130528_38954ifx1
> GC   - R26_Java726_SR5_20130617_1436_B152572
> J9CL - 20130617_152572)
> JCL - 20130616_01 based on Oracle 7u25-b12
> With IBM_JAVA_OPTIONS=-Xgcpolicy:optthruput -Xjit:count=0 -Xnocompressedrefs
>            Reporter: Kathey Marsden
>
> On Windows on IBM JVM with 
> IBM_JAVA_OPTIONS=-Xgcpolicy:optthruput -Xjit:count=0 -Xnocompressedrefs
> derbynet.ServerPropertiesTest prints the exception:
> (net)derbynet.ServerPropertiesTest.ttestSetPortPriority java.lang.Exception: 
> DRDA_InvalidReplyTooShort.S:Invalid reply f
> rom network server: Insufficient data.
>         at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessageWork(Unknown
>  Source)
>         at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessage(Unknown
>  Source)
>         at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.fillReplyBuffer(Unknown 
> Source)
>         at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.readResult(Unknown Source)
>         at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.pingWithNoOpen(Unknown 
> Source)
>         at org.apache.derby.impl.drda.NetworkServerControlImpl.ping(Unknown 
> Source)
>         at org.apache.derby.drda.NetworkServerControl.ping(Unknown Source)
>         at 
> org.apache.derbyTesting.junit.NetworkServerTestSetup.pingForServerUp(NetworkServerTestSetup.java:613)
>         at 
> org.apache.derbyTesting.functionTests.tests.derbynet.ServerPropertiesTest.canPingServer(ServerPropertiesTest.
> java:280)
>         at 
> org.apache.derbyTesting.functionTests.tests.derbynet.ServerPropertiesTest.ttestSetPortPriority(ServerProperti
> esTest.java:476)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:76)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:607)
>         at junit.framework.TestCase.runTest(TestCase.java:164)
>         at junit.framework.TestCase.runBare(TestCase.java:130)
>         at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:117)
>         at 
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:442)
>         at 
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:459)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:120)
>         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>         at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
>         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>         at junit.framework.TestSuite.runTest(TestSuite.java:230)
>         at junit.framework.TestSuite.run(TestSuite.java:225)
>         at junit.textui.TestRunner.doRun(TestRunner.java:121)
>         at junit.textui.TestRunner.start(TestRunner.java:185)
>         at junit.textui.TestRunner.main(TestRunner.java:143)
> java.lang.Exception: DRDA_InvalidReplyTooShort.S:Invalid reply from network 
> server: Insufficient data.
>         at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessageWork(Unknown
>  Source)
>         at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessage(Unknown
>  Source)
>         at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.fillReplyBuffer(Unknown 
> Source)
>         at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.readResult(Unknown Source)
>         at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.pingWithNoOpen(Unknown 
> Source)
>         at org.apache.derby.impl.drda.NetworkServerControlImpl.ping(Unknown 
> Source)
>         at org.apache.derby.drda.NetworkServerControl.ping(Unknown Source)
>         at 
> org.apache.derbyTesting.junit.NetworkServerTestSetup.pingForServerUp(NetworkServerTestSetup.java:613)
>         at 
> org.apache.derbyTesting.functionTests.tests.derbynet.ServerPropertiesTest.canPingServer(ServerPropertiesTest.
> java:280)
>         at 
> org.apache.derbyTesting.functionTests.tests.derbynet.ServerPropertiesTest.shutdownServer(ServerPropertiesTest
> .java:309)
>         at 
> org.apache.derbyTesting.functionTests.tests.derbynet.ServerPropertiesTest.ttestSetPortPriority(ServerProperti
> esTest.java:483)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:76)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:607)
>         at junit.framework.TestCase.runTest(TestCase.java:164)
>         at junit.framework.TestCase.runBare(TestCase.java:130)
>         at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:117)
>         at 
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:442)
>         at 
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:459)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:120)
>         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>         at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
>         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>         at junit.framework.TestSuite.runTest(TestSuite.java:230)
>         at junit.framework.TestSuite.run(TestSuite.java:225)
>         at junit.textui.TestRunner.doRun(TestRunner.java:121)
>         at junit.textui.TestRunner.start(TestRunner.java:185)
>         at junit.textui.TestRunner.main(TestRunner.java:143)
> used 53367 ms .
> (net)derbynet.ServerPropertiesTest.ttestDefaultProperties used 387 ms .
> (net)derbynet.ServerPropertiesTest.testToggleTrace used 34428 ms .
> (net)derbynet.ServerPropertiesTest.testToggleLogConnections used 34064 ms
> Time: 157.034
> OK (4 tests)
> but the test passes.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to