You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Myrna van Lunteren (JIRA)" <ji...@apache.org> on 2014/09/15 23:33:33 UTC

[jira] [Comment Edited] (DERBY-6112) SSL Test (and network server ) can hang if serverSocket.accept() fails for something other than an IOException

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

Myrna van Lunteren edited comment on DERBY-6112 at 9/15/14 9:32 PM:
--------------------------------------------------------------------

I tried the experiment Kathey suggested and added the line to the run() method in org.apache.derby.impl.drda.ClientThread:acceptClientWithRetry:
{code}
    private Socket acceptClientWithRetry() {
        return AccessController.doPrivileged(
                new PrivilegedAction<Socket>() {
                    public Socket run() {
                        for (int trycount = 1; trycount <= 3; trycount++) {
                            try {
=> +                         System.getProperty("derby.system.home");
                                // DERBY-5347 Need to exit if
                                // accept fails with IOException
                                // Cannot just aimlessly loop
                                // writing errors
                                return serverSocket.accept();
                            } catch (IOException acceptE) {
....
{code}
Then I ran the test with sane jars using ibm 1.7. 
The test did not hang, instead, I got a number of jvm core dumps and the test failed with  OutOfMemoryErrors like this:

1) testSSLBasicDSConnect(org.apache.derbyTesting.functionTests.tests.derbynet.SSLTest)java.lang.OutOfMemoryError: Java heap space
        at java.lang.StringCoding.decode(StringCoding.java:508)
        at java.lang.StringCoding.decode(StringCoding.java:578)
        at java.lang.String.<init>(String.java:181)
        at com.ibm.jvm.io.ConsolePrintStream.write(ConsolePrintStream.java:177)
        at java.io.ByteArrayOutputStream.writeTo(ByteArrayOutputStream.java:165)
        at org.apache.derbyTesting.junit.SpawnedProcess.printDiagnostics(SpawnedProcess.java:367)
        at org.apache.derbyTesting.junit.SpawnedProcess.complete(SpawnedProcess.java:329)
        at org.apache.derbyTesting.junit.NetworkServerTestSetup.setUp(NetworkServerTestSetup.java:219)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:20)
        at junit.extensions.TestSetup.run(TestSetup.java:25)
        at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:58)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
        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.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.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.extensions.TestSetup.run(TestSetup.java:25)




was (Author: myrna):
I tried the experiment Kathey suggested and added the line to the run() method in org.apache.derby.impl.drda.ClientThread:acceptClientWithRetry:

    private Socket acceptClientWithRetry() {
        return AccessController.doPrivileged(
                new PrivilegedAction<Socket>() {
                    public Socket run() {
                        for (int trycount = 1; trycount <= 3; trycount++) {
                            try {
=> +                         System.getProperty("derby.system.home");
                                // DERBY-5347 Need to exit if
                                // accept fails with IOException
                                // Cannot just aimlessly loop
                                // writing errors
                                return serverSocket.accept();
                            } catch (IOException acceptE) {
....

Then I ran the test with sane jars using ibm 1.7. 
The test did not hang, instead, I got a number of jvm core dumps and the test failed with  OutOfMemoryErrors like this:

1) testSSLBasicDSConnect(org.apache.derbyTesting.functionTests.tests.derbynet.SSLTest)java.lang.OutOfMemoryError: Java heap space
        at java.lang.StringCoding.decode(StringCoding.java:508)
        at java.lang.StringCoding.decode(StringCoding.java:578)
        at java.lang.String.<init>(String.java:181)
        at com.ibm.jvm.io.ConsolePrintStream.write(ConsolePrintStream.java:177)
        at java.io.ByteArrayOutputStream.writeTo(ByteArrayOutputStream.java:165)
        at org.apache.derbyTesting.junit.SpawnedProcess.printDiagnostics(SpawnedProcess.java:367)
        at org.apache.derbyTesting.junit.SpawnedProcess.complete(SpawnedProcess.java:329)
        at org.apache.derbyTesting.junit.NetworkServerTestSetup.setUp(NetworkServerTestSetup.java:219)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:20)
        at junit.extensions.TestSetup.run(TestSetup.java:25)
        at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:58)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
        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.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.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.extensions.TestSetup.run(TestSetup.java:25)



> SSL Test (and network server )  can hang if serverSocket.accept() fails for something other than an IOException
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-6112
>                 URL: https://issues.apache.org/jira/browse/DERBY-6112
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server, Test
>    Affects Versions: 10.8.3.0
>            Reporter: Kathey Marsden
>              Labels: derby_triage10_11
>
> In starting a server with SSL as in SSLTest if serverSocket.accept() fails for some reason other than an IOException  it may just print the error to console and hang.  In this case it was:
> java.security.AccessControlException: Access denied (java.util.PropertyPermission
> I saw this when debugging a java  issue in serverSocket.accept() but I think it could be simulated by adding an unwrapped System.getProperty() of some sort before serverSocket.accept() to force a  permission error. e.g. 
>          System.getProperty("derby.system.home");
>          return serverSocket.accept();
>                             } catch (IOException acceptE) {
> I have not verified that would work.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)