[ 
https://issues.apache.org/jira/browse/DERBY-2871?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julius Stroffek updated DERBY-2871:
-----------------------------------

    Attachment: d2871-test.stat
                d2871-test.diff

I rewrote the test that it will not close the connections and they will not be 
garbage collected neither since I call the XAConnection.close method on every 
connection at the end of the test.

I ran all the tests (suites.All and derbyall) without failures on my box for 
'd2871-test' patch also with a patch for DERBY-2953 without any failures. I 
tried to run those test also on a HP-UX box where the test was originally 
failing. The rewritten test always fails with the message 

---
1) 
testXATransactionTimeout(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)java.sql.SQLException:
 A communications e
rror has been detected: Broken pipe (errno:32).
        at 
org.apache.derby.client.am.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:46)
        at 
org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:362)
        at 
org.apache.derby.client.ClientPooledConnection.<init>(ClientPooledConnection.java:115)
        at 
org.apache.derby.client.ClientXAConnection.<init>(ClientXAConnection.java:48)
        at 
org.apache.derby.client.net.ClientJDBCObjectFactoryImpl.newClientXAConnection(ClientJDBCObjectFactoryImpl.java:76)
        at 
org.apache.derby.jdbc.ClientXADataSource.getXAConnectionX(ClientXADataSource.java:88)
        at 
org.apache.derby.jdbc.ClientXADataSource.getXAConnection(ClientXADataSource.java:72)
        at 
org.apache.derby.jdbc.ClientXADataSource.getXAConnection(ClientXADataSource.java:65)
        at 
org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXATransactionTimeout(XATransactionTest.java:188)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at 
org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95)
        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 
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.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 
org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
Caused by: org.apache.derby.client.am.DisconnectException: A communications 
error has been detected: Broken pipe (errno:32).
        at 
org.apache.derby.client.net.NetAgent.throwCommunicationsFailure(NetAgent.java:413)
        at org.apache.derby.client.net.NetAgent.sendRequest(NetAgent.java:387)
        at org.apache.derby.client.net.NetAgent.flush_(NetAgent.java:265)
        at org.apache.derby.client.am.Agent.flowOutsideUOW(Agent.java:196)
        at 
org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(NetConnection.java:773)
        at 
org.apache.derby.client.net.NetConnection.flowUSRIDPWDconnect(NetConnection.java:617)
        at 
org.apache.derby.client.net.NetConnection.flowConnect(NetConnection.java:435)
        at 
org.apache.derby.client.net.NetConnection.initialize(NetConnection.java:296)
        at 
org.apache.derby.client.net.NetConnection.<init>(NetConnection.java:280)
        at 
org.apache.derby.client.net.ClientJDBCObjectFactoryImpl.newNetConnection(ClientJDBCObjectFactoryImpl.java:264)
        at 
org.apache.derby.client.net.NetXAConnection.createNetConnection(NetXAConnection.java:269)
        at 
org.apache.derby.client.net.NetXAConnection.<init>(NetXAConnection.java:73)
        at 
org.apache.derby.client.ClientPooledConnection.getNetXAConnection(ClientPooledConnection.java:331)
        at 
org.apache.derby.client.ClientPooledConnection.<init>(ClientPooledConnection.java:108)
        ... 44 more
Caused by: java.net.SocketException: Broken pipe (errno:32)
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:97)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:141)
        at org.apache.derby.client.net.Request.sendBytes(Request.java:1388)
        at org.apache.derby.client.net.Request.flush(Request.java:1382)
        at org.apache.derby.client.net.NetAgent.sendRequest(NetAgent.java:385)
        ... 56 more
---


I explored a problem a bit and discovered that the problem occurs due to the 
limit of the number of open files and I have created a simple code to verify 
this...

        int count = 1000;
        XAConnection xaConn[] = new XAConnection[count];

        try {
            // start-up the server
            NetworkServerControl server = new NetworkServerControl();
            server.start (null);

            for (int i=0; i < count; i++) {
                System.out.print("Creating connection number " + i + "...");
                xaConn[i] = createXAConnection(connString, "", "");
                System.out.println("Ok.");
            }

            for (int i=0; i < count; i++) {
                xaConn[i].close();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }

which will throw an exception after creating a connection number 391

org.apache.derby.client.am.DisconnectException: java.net.SocketException : 
Error connecting to server localhost on port 1527 with message File table 
overflow (errno:23).
        at org.apache.derby.client.net.NetAgent.<init>(NetAgent.java:129)
        at 
org.apache.derby.client.net.NetConnection.newAgent_(NetConnection.java:1086)
        at 
org.apache.derby.client.am.Connection.initConnection(Connection.java:218)
        at org.apache.derby.client.am.Connection.<init>(Connection.java:169)
        at 
org.apache.derby.client.net.NetConnection.<init>(NetConnection.java:278)
        at 
org.apache.derby.client.net.ClientJDBCObjectFactoryImpl.newNetConnection(ClientJDBCObjectFactoryImpl.java:264)
        at 
org.apache.derby.client.net.NetXAConnection.createNetConnection(NetXAConnection.java:269)
        at 
org.apache.derby.client.net.NetXAConnection.<init>(NetXAConnection.java:73)
        at 
org.apache.derby.client.ClientPooledConnection.getNetXAConnection(ClientPooledConnection.java:331)
        at 
org.apache.derby.client.ClientPooledConnection.<init>(ClientPooledConnection.java:108)
        ... 8 more
Caused by: java.net.SocketException: File table overflow (errno:23)
        at java.net.Socket.createImpl(Socket.java:397)
        at java.net.Socket.<init>(Socket.java:359)
        at java.net.Socket.<init>(Socket.java:178)
        at javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:196)
        at 
org.apache.derby.client.net.OpenSocketAction.run(OpenSocketAction.java:62)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.derby.client.net.NetAgent.<init>(NetAgent.java:127)
        ... 17 more
------

> XATransactionTest gets XaException: Error executing a XAResource.commit(), 
> server returned XAER_PROTO.
> ------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2871
>                 URL: https://issues.apache.org/jira/browse/DERBY-2871
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.3.1.0
>         Environment: OS: HP-UX v1.11 i 
> JDK: HP 1.5.0.03 
>            Reporter: Henri van de Scheur
>            Assignee: Julius Stroffek
>            Priority: Minor
>         Attachments: d2871-test.diff, d2871-test.stat, d2871.diff, d2871.stat
>
>
> Method: org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest
> Signature:
> %XAER_PROTO : Error executing a XAResource.commit(), server returned 
> XAER_PROTO%
> Also see: 
> http://dbtg.thresher.com/derby/test/10.3.1.0_RC/jvm1.5/testing/testlog/hpux/548006-suitesAll_diff.txt

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to