Issue Details (XML | Word | Printable)

Key: DERBY-1856
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Bernt M. Johnsen
Reporter: Sunitha Kambhampati
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Multiple communication failures when starting server with derby.drda.timeSlice

Created: 15/Sep/06 07:10 PM   Updated: 30/Jun/09 03:55 PM
Return to search
Component/s: Network Server
Affects Version/s: 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.3.1.4
Fix Version/s: 10.1.3.2, 10.2.2.0, 10.3.1.4

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works DERBY-1856-r126392-regressionfix-v2.diff 2006-12-08 12:26 PM Bernt M. Johnsen 0.5 kB
File Licensed for inclusion in ASF works DERBY-1856-r126392-regressionfix.diff 2006-12-08 09:02 AM Bernt M. Johnsen 0.5 kB
Environment: any ( but I tried on windows/2k/t40 laptop/jdk142).
Issue Links:
Reference
 

Bug behavior facts: Regression
Resolution Date: 11/Dec/06 02:03 PM


 Description  « Hide
In http://www.nabble.com/Problem%3A-Communication-Link-Failure--derby.drda.timeSlice-p5966781.html , Hannes Grund reported a problem with derby.drda.timeSlice property.

I tried this property in my environment on trunk (10.3) and hit several communication failure problems with the following errors below.

On server
------------
trunk2>java -Dderby.drda.maxThreads=100 -Dderby.drda.timeSlice=10000 org.apache.derby.drda.NetworkServerControl star>
Apache Derby Network Server - 10.3.0.0 alpha started and ready to accept connections on port 1527 at 2006-09-15 18:41:51.750 GMT
Execution failed because of Permanent Agent Error: SVRCOD = 40; RDBNAM = testdb5;create=true; diagnostic msg = Session in invalid state:4
org.apache.derby.impl.drda.DRDAProtocolException: Execution failed because of Permanent Agent Error: SVRCOD = 40; RDBNAM = testdb5;create=true; diagnostic msg = Session in invalid state:4
        at org.apache.derby.impl.drda.DRDAProtocolException.newAgentError(DRDAProtocolException.java:328)
        at org.apache.derby.impl.drda.DRDAConnThread.agentError(DRDAConnThread.java:476)
        at org.apache.derby.impl.drda.DRDAConnThread.run(DRDAConnThread.java:278)
Execution failed because of Permanent Agent Error: SVRCOD = 40; RDBNAM = testdb5;create=true; diagnostic msg = Session in invalid state:4
org.apache.derby.impl.drda.DRDAProtocolException: Execution failed because of Permanent Agent Error: SVRCOD = 40; RDBNAM = testdb5;create=true; diagnostic msg = Session in invalid state:4
        at org.apache.derby.impl.drda.DRDAProtocolException.newAgentError(DRDAProtocolException.java:328)
        at org.apache.derby.impl.drda.DRDAConnThread.agentError(DRDAConnThread.java:476)
        at org.apache.derby.impl.drda.DRDAConnThread.run(DRDAConnThread.java:278)


On client:
-----------
trunk2>java org.apache.derby.tools.ij
ij version 10.3
ij> connect 'jdbc:derby://localhost:1527/testdb5;create=true;';
ij> select * from t1;
ERROR 42X05: Table/View 'T1' does not exist.
ij> select * from t1;
ERROR 42X05: DERBY SQL error: SQLCODE: -1, SQLSTATE: 42X05, SQLERRMC: T1¶42X05
ij> select * from t1;
ERROR 58015: The DDM object 0x1232 is not supported. The connection has been terminated.
ij> select * from t1;
ERROR 08003: No current connection.


In some cases, the client gets the 58009 communications error.
trunk2>java org.apache.derby.tools.ij
ij version 10.3
ij> connect 'jdbc:derby://localhost:1527/testdb4;create=true;user=a;password=p';
ij> create table t1(i1 int);
ERROR 58009: A communications error has been detected: Software caused connection abort: recv failed.

I am opening this jira because it seems like the basic problem may be just in the way the timeSlice property is being handled. As part of this jira, make sure that the timeSlice property behaves the way it is expected to and also clarify the documentation.

The documentation currently states this "Use the derby.drda.timeslice property to set the number of milliseconds that each connection will use before yielding to another connection. " and the default value is 0. Not clear what it means to have a default of 0. I think it is good to explain the behavior here.
 

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #450508 Wed Sep 27 17:10:56 UTC 2006 mikem DERBY-1878
contributed by Sunitha Kambhampati
patch: derby1878.diff.txt

 I am attaching the patch (derby1878.diff.txt) to improve some error handling in some of the network server tests.

 1.The execCmdDumpResults used by the five tests timeslice.java,maxthreads.java,testij.java,runtimeinfo.java,sysinfo.java suffer from the same problems that was fixed for testProperties.java namely
 -- the outputstream for the sub process's is not flushed out
 -- there is no timeout handling for the ProcessStreamResult
 2.Eliminate duplication of code in these 5 tests for execCmdDumpResults(String[] args) method. The execCmdDumpResults method basically exec's a new process and then waits for the process to dump the results. A new utility class - ExecProcUtil is added with execCmdDumpResults that is generalized to take the necessary input from the tests as well as fixes the issues mentioned in #1. The OutputStream is flushed out by calling bos.flush and System.out.flush and the timeout is added for ProcessStreamResult.
 3.Make use of the TimedProcess to kill process if process does not exit within the timeout period.
 4.TestConnection.java test has some variation of the execCmdDumpResults and it also adds some testcases into this method. Hence this method in this test is left as is and timeout handling is added.
 5.testij.out has been updated. The previous master file was eating away the last line that was written to System.out, but now that the process's streams are flushed properly, the last line in testij.out test which prints out 'End test'
 is also seen in the output file.

 Also noticed that these tests - like timeslice.java, maxthreads.java all seem to set the properties for the server and then check if the property is set. The functionality of the server when these properties is set is not being tested. It will be good to add tests that test that the functionality itself is working as expected or not. Please note, recently connecting to server with timeslice options discovered some issues with server (see DERBY-1856).
Files Changed
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testij.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/testij.out
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/sysinfo.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testconnection.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/testij.out
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/runtimeinfo.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/timeslice.java
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ExecProcUtil.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/maxthreads.java

Repository Revision Date User Message
ASF #450884 Thu Sep 28 15:04:37 UTC 2006 mikem DERBY-1878
contributed by Sunitha Kambhampati
merging test only change 450508 from trunk to 10.2 branch

I am attaching the patch (derby1878.diff.txt) to improve some error handling in
some of the network server tests.

1.The execCmdDumpResults used by the five tests timeslice.java,maxthreads.java,
testij.java,runtimeinfo.java,sysinfo.java suffer from the same problems that was
fixed for testProperties.java namely
-- the outputstream for the sub process's is not flushed out
-- there is no timeout handling for the ProcessStreamResult
2.Eliminate duplication of code in these 5 tests for execCmdDumpResults(String[
] args) method. The execCmdDumpResults method basically exec's a new process and
then waits for the process to dump the results. A new utility class - ExecProcU
til is added with execCmdDumpResults that is generalized to take the necessary i
nput from the tests as well as fixes the issues mentioned in #1. The OutputStrea
m is flushed out by calling bos.flush and System.out.flush and the timeout is ad
ded for ProcessStreamResult.
3.Make use of the TimedProcess to kill process if process does not exit within
the timeout period.
4.TestConnection.java test has some variation of the execCmdDumpResults and it
also adds some testcases into this method. Hence this method in this test is lef
t as is and timeout handling is added.
5.testij.out has been updated. The previous master file was eating away the las
t line that was written to System.out, but now that the process's streams are fl
ushed properly, the last line in testij.out test which prints out 'End test'
is also seen in the output file.

Also noticed that these tests - like timeslice.java, maxthreads.java all seem t
o set the properties for the server and then check if the property is set. The f
unctionality of the server when these properties is set is not being tested. It
will be good to add tests that test that the functionality itself is working as
expected or not. Please note, recently connecting to server with timeslice optio
ns discovered some issues with server (see DERBY-1856).
Files Changed
MODIFY /db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testconnection.java
MODIFY /db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/testij.out
MODIFY /db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/testij.out
MODIFY /db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/sysinfo.java
ADD /db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/ExecProcUtil.java (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ExecProcUtil.java)
MODIFY /db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/runtimeinfo.java
MODIFY /db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/timeslice.java
MODIFY /db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/maxthreads.java
MODIFY /db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testij.java

Bernt M. Johnsen made changes - 07/Dec/06 02:36 PM
Field Original Value New Value
Assignee Bernt M. Johnsen [ bernt ]
Bernt M. Johnsen added a comment - 08/Dec/06 09:02 AM
The exception thrown is caused by a regression introduced in r126392
(2005-01-25) and is easily fixed by the attached
DERBY-1856-r126392-regressionfix.diff. The cause is that two session
states introduced (SECACC and CHKSEC) is missing in the switch in
DRDAConnThread.run().

Some comments:

1) Testing of maxThreads/timeSlice is obviously non-existing since a
   regression can live for nearly two years. I'll file an issue on
   this.

2) When timeSlice is defined, a timeout of the same size is set on the
   socket. It has been like this since the dawn of times (which in
   this case happens to be 2004-08-26 16:13:46), but Kathey added a
   comment that the timeout is "highly suspect", and I agree. Since
   SocketTimeoutException (introduced in J2SE 1.4) is not handled, the
   socket will be closed down when the timeout expires. This may be ok
   for applications using a connection pool which sanitychecks
   connections before reusing them, but disastrous for other
   applications. Without the timeout, a DRDAConnThread waiting for
   input, will not yield until another request comes from the
   client.

3) I experimented with catching the timeout in the DRDAConnThread as
   the only other change, and that seems to work. If the timeslice is
   setvery low (less than 100ms) I get problems which I guess stems
   from missing corner cases which may well appear with higher
   timeslices e.g. if the load is high or the query tekes a long time.


I guess the best approach is to let the timeout be as it is for the
moment and file a separate issue for proper handling of the
timeout.

Any comments?

Bernt M. Johnsen made changes - 08/Dec/06 09:02 AM
Attachment DERBY-1856-r126392-regressionfix.diff [ 12346744 ]
Bernt M. Johnsen made changes - 08/Dec/06 09:09 AM
Derby Info [Patch Available]
Bernt M. Johnsen made changes - 08/Dec/06 09:10 AM
Affects Version/s 10.2.1.6 [ 11187 ]
Bernt M. Johnsen made changes - 08/Dec/06 09:11 AM
Status Open [ 1 ] In Progress [ 3 ]
Bernt M. Johnsen made changes - 08/Dec/06 09:31 AM
Derby Info [Patch Available] [Patch Available, Regression]
Fix Version/s 10.2.2.0 [ 12312027 ]
Fix Version/s 10.3.0.0 [ 12310800 ]
Fix Version/s 10.1.3.2 [ 12311972 ]
Bernt M. Johnsen made changes - 08/Dec/06 10:12 AM
Link This issue relates to DERBY-2165 [ DERBY-2165 ]
Bernt M. Johnsen added a comment - 08/Dec/06 12:26 PM
Added a comment

Bernt M. Johnsen made changes - 08/Dec/06 12:26 PM
Bernt M. Johnsen made changes - 08/Dec/06 12:27 PM
Link This issue relates to DERBY-2166 [ DERBY-2166 ]
Øystein Grøvlen added a comment - 08/Dec/06 01:54 PM
The fix looks good. +1 to commit.
It would be great if you would make a test for timeSlice, too.

Bernt M. Johnsen added a comment - 08/Dec/06 02:13 PM
I have created DERBY-2165 for the test.

Repository Revision Date User Message
ASF #484615 Fri Dec 08 14:14:39 UTC 2006 bernt DERBY-1856 Added Session.SECACC and Session.CHKSEC to the switch in DRDAConnThread.run()
Files Changed
MODIFY /db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java

Bernt M. Johnsen added a comment - 08/Dec/06 02:15 PM
Committed revision 484615 on trunk

Repository Revision Date User Message
ASF #484616 Fri Dec 08 14:18:20 UTC 2006 bernt DERBY-1856 Did svn merge -r 484614:484615 https://svn.apache.org/repos/asf/db/derby/code/trunk
Files Changed
MODIFY /db/derby/code/branches/10.2/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java

Bernt M. Johnsen added a comment - 08/Dec/06 02:19 PM
Committed revision 484616 on 10.2

Bernt M. Johnsen made changes - 08/Dec/06 02:19 PM
Status In Progress [ 3 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Derby Info [Patch Available, Regression] [Regression]
Repository Revision Date User Message
ASF #485667 Mon Dec 11 14:01:30 UTC 2006 bernt DERBY-1856 Did svn merge -r 484614:484615 https://svn.apache.org/repos/asf/db/derby/code/trunk
Files Changed
MODIFY /db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java

Bernt M. Johnsen added a comment - 11/Dec/06 02:03 PM
Merge to 10.1

Bernt M. Johnsen made changes - 11/Dec/06 02:03 PM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
Bernt M. Johnsen added a comment - 11/Dec/06 02:03 PM
Committed revision 485667 on 10.1

Bernt M. Johnsen made changes - 11/Dec/06 02:03 PM
Status Reopened [ 4 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Repository Revision Date User Message
ASF #485671 Mon Dec 11 14:14:23 UTC 2006 rhillegas DERBY-2129: Add another bugfix to the Release Notes (DERBY-1856).
Files Changed
MODIFY /db/derby/code/branches/10.2/RELEASE-NOTES.html

Andrew McIntyre added a comment - 13/Dec/07 09:05 AM
This issue has been resolved for over a year with no further movement. Closing.

Andrew McIntyre made changes - 13/Dec/07 09:05 AM
Status Resolved [ 5 ] Closed [ 6 ]
Dag H. Wanvik made changes - 30/Jun/09 03:55 PM
Bug behavior facts [Regression]