You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2023/03/02 13:18:09 UTC

[qpid-proton-j] branch 0.34.x created (now 63b49d65)

This is an automated email from the ASF dual-hosted git repository.

robbie pushed a change to branch 0.34.x
in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git


      at 63b49d65 PROTON-2688: clean up entries in transport work list for sender delivery that can no longer be sent

This branch includes the following new commits:

     new 262d7924 create 0.34.x branch, update versions and set tag ref accordingly
     new 2e10c072 PROTON-2605: set -noindex to exclude various .js files from javadoc output
     new 9e9ef143 NO-JIRA: update various actions versions to resolve deprecation warnings
     new 67ce555b NO-JIRA: remove travis jobs config, infra dropping support for it
     new b6de9b2e NO-JIRA: remove [stale] CI build badges
     new 32d7d3f5 NO-JIRA: update years in NOTICE files
     new a4420f60 PROTON-2687: clean up stale entries in transport work list that cant be actioned, and prevent them from entering where possible
     new 696d39d8 PROTON-2687: restore old gate to original structure, add additional protection to new gates, remove some extraneous leftovers from tests
     new 63b49d65 PROTON-2688: clean up entries in transport work list for sender delivery that can no longer be sent

The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-proton-j] 09/09: PROTON-2688: clean up entries in transport work list for sender delivery that can no longer be sent

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch 0.34.x
in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git

commit 63b49d65fdc4c1ea42e882f3771e41a938327153
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Wed Mar 1 16:24:12 2023 +0000

    PROTON-2688: clean up entries in transport work list for sender delivery that can no longer be sent
    
    (cherry picked from commit 8c1f2326d46b9a67ae14bc3431acc6cddfbb7524)
---
 .../qpid/proton/engine/impl/TransportImpl.java     |  6 ++
 .../qpid/proton/engine/impl/TransportLink.java     | 11 +++
 .../qpid/proton/engine/impl/TransportImplTest.java | 86 ++++++++++++++++++++++
 3 files changed, 103 insertions(+)

diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
index da2e9abb..b9f07dc0 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
@@ -469,6 +469,7 @@ public class TransportImpl extends EndpointImpl
                         }
 
                         writeFrame(transportSession.getLocalChannel(), detach, null, null);
+                        transportLink.sentDetach();
                     }
 
                     endpoint.clearModified();
@@ -699,6 +700,11 @@ public class TransportImpl extends EndpointImpl
             writeFrame(tpSession.getLocalChannel(), cachedDisposition, null, null);
         }
 
+        if(!wasDone && tpLink != null && tpLink.detachSent()) {
+            // Too late to action this work, clear it.
+            return true;
+        }
+
         return !delivery.isBuffered();
     }
 
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportLink.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportLink.java
index 836cf71c..0bd20cf1 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportLink.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportLink.java
@@ -37,6 +37,7 @@ class TransportLink<T extends LinkImpl>
     private UnsignedInteger _remoteLinkCredit;
     private boolean _detachReceived;
     private boolean _attachSent;
+    private boolean _detachSent;
 
     protected TransportLink(T link)
     {
@@ -226,4 +227,14 @@ class TransportLink<T extends LinkImpl>
     {
         _remoteDeliveryCount = remoteDeliveryCount;
     }
+
+    public boolean detachSent()
+    {
+        return _detachSent;
+    }
+
+    public void sentDetach()
+    {
+        _detachSent = true;
+    }
 }
diff --git a/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportImplTest.java b/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportImplTest.java
index 82ff4c81..87d845de 100644
--- a/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportImplTest.java
+++ b/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportImplTest.java
@@ -5109,4 +5109,90 @@ public class TransportImplTest
         assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 6, transport.writes.size());
         assertTrue("Unexpected frame type", transport.writes.get(5) instanceof Close);
     }
+
+    /**
+     * Verify that the transport work list doesnt retain delivery (+link+session) object when a sender link is closed
+     * closed and freed while there a buffered/not-transferred message outstanding, as they can no longer be transferred.
+     */
+    @Test
+    public void testTransportWorkListDoesntLeakDeliveriesEtcFromSenderLinkFreedWithBufferedSend()
+    {
+        MockTransportImpl transport = new MockTransportImpl();
+        ConnectionImpl connection = new ConnectionImpl();
+        transport.bind(connection);
+
+        connection.open();
+
+        Session session = connection.session();
+        session.open();
+
+        String linkName = "myClientSender";
+        Sender sender = session.sender(linkName);
+        sender.open();
+
+        pumpMockTransport(transport);
+
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 3, transport.writes.size());
+
+        assertTrue("Unexpected frame type", transport.writes.get(0) instanceof Open);
+        assertTrue("Unexpected frame type", transport.writes.get(1) instanceof Begin);
+        assertTrue("Unexpected frame type", transport.writes.get(2) instanceof Attach);
+
+        assertNull("Should not yet have a delivery", sender.current());
+
+        // Send the necessary responses to open/begin/attach. DO NOT give any credit.
+        transport.handleFrame(new TransportFrame(0, new Open(), null));
+
+        Begin begin = new Begin();
+        begin.setRemoteChannel(UnsignedShort.valueOf((short) 0));
+        begin.setNextOutgoingId(UnsignedInteger.ONE);
+        begin.setIncomingWindow(UnsignedInteger.valueOf(1024));
+        begin.setOutgoingWindow(UnsignedInteger.valueOf(1024));
+        transport.handleFrame(new TransportFrame(0, begin, null));
+
+        Attach attach = new Attach();
+        attach.setHandle(UnsignedInteger.ZERO);
+        attach.setRole(Role.RECEIVER);
+        attach.setName(linkName);
+        attach.setInitialDeliveryCount(UnsignedInteger.ZERO);
+        transport.handleFrame(new TransportFrame(0, attach, null));
+
+        assertEndpointState(sender, EndpointState.ACTIVE, EndpointState.ACTIVE);
+        assertEndpointState(session, EndpointState.ACTIVE, EndpointState.ACTIVE);
+
+        assertEquals("Expected the sender to have no credit", 0, sender.getCredit());
+
+        Delivery delivery = sendMessage(sender, "tag1", "content1");
+
+        assertEquals("Expected the delivery to be on the transport work list", delivery, connection.getTransportWorkHead());
+        assertEquals("Expected the sender to have queued message", 1 , sender.getQueued());
+
+        pumpMockTransport(transport);
+
+        // Expect no more frames to have been sent, delivery cant be sent without credit
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 3, transport.writes.size());
+
+        assertEquals("Expected the delivery to be on the transport work list", delivery, connection.getTransportWorkHead());
+
+        // Send a remote request to close the sender and action it
+        Detach detach = new Detach();
+        detach.setHandle(UnsignedInteger.ZERO);
+        detach.setClosed(true);
+        transport.handleFrame(new TransportFrame(0, detach, null));
+
+        assertEndpointState(sender, EndpointState.ACTIVE, EndpointState.CLOSED);
+
+        sender.close();
+        sender.free();
+
+        pumpMockTransport(transport);
+
+        assertEndpointState(sender, EndpointState.CLOSED, EndpointState.CLOSED);
+
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 4, transport.writes.size());
+        assertTrue("Unexpected frame type", transport.writes.get(3) instanceof Detach);
+
+        // Check the delivery isnt in the work list as it clearly cant be sent now the sender is closed.
+        assertNull("Expected the transport work list to be empty", connection.getTransportWorkHead());
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-proton-j] 06/09: NO-JIRA: update years in NOTICE files

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch 0.34.x
in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git

commit 32d7d3f57420a8cc631657984328670e191cfebc
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Mon Jan 9 15:20:34 2023 +0000

    NO-JIRA: update years in NOTICE files
    
    (cherry picked from commit 0d840b5695d02d39c48ccd040925026785ff8d8b)
---
 NOTICE                                        | 2 +-
 apache-qpid-proton-j/src/main/assembly/NOTICE | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/NOTICE b/NOTICE
index 15b83552..db4aaa0f 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 Apache Qpid Proton-J
-Copyright 2012-2022 The Apache Software Foundation
+Copyright 2012-2023 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
diff --git a/apache-qpid-proton-j/src/main/assembly/NOTICE b/apache-qpid-proton-j/src/main/assembly/NOTICE
index 15b83552..db4aaa0f 100644
--- a/apache-qpid-proton-j/src/main/assembly/NOTICE
+++ b/apache-qpid-proton-j/src/main/assembly/NOTICE
@@ -1,5 +1,5 @@
 Apache Qpid Proton-J
-Copyright 2012-2022 The Apache Software Foundation
+Copyright 2012-2023 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-proton-j] 02/09: PROTON-2605: set -noindex to exclude various .js files from javadoc output

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch 0.34.x
in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git

commit 2e10c072b87c2bed9ca72c5ab52713e9ac0903ca
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Thu Sep 8 16:33:10 2022 +0100

    PROTON-2605: set -noindex to exclude various .js files from javadoc output
    
    (cherry picked from commit eea1907ec4a793018574e24ac55fc3c53585d439)
---
 pom.xml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pom.xml b/pom.xml
index 8a99e0cb..dc849de7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -183,6 +183,13 @@
             <pushChanges>true</pushChanges>
           </configuration>
         </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-javadoc-plugin</artifactId>
+          <configuration>
+            <noindex>true</noindex>
+          </configuration>
+        </plugin>
         <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-proton-j] 04/09: NO-JIRA: remove travis jobs config, infra dropping support for it

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch 0.34.x
in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git

commit 67ce555b15986144876a00f4a2c308f2f076b9e8
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Mon Jan 9 15:05:28 2023 +0000

    NO-JIRA: remove travis jobs config, infra dropping support for it
    
    (cherry picked from commit 0e9d438ef709a9a067bb7a925410fd8b1b71f5c9)
---
 .travis.yml | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 292bd354..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-language: java
-matrix:
-  include:
-    - os: linux
-      jdk: openjdk8
-    - os: linux
-      jdk: openjdk11
-cache:
-  directories:
-  - $HOME/.m2
-before_cache:
-  - rm -rf $HOME/.m2/repository/org/apache/qpid/*


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-proton-j] 08/09: PROTON-2687: restore old gate to original structure, add additional protection to new gates, remove some extraneous leftovers from tests

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch 0.34.x
in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git

commit 696d39d8ea046024755bfb1c9d1e44a5cd369ff7
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Wed Mar 1 13:26:17 2023 +0000

    PROTON-2687: restore old gate to original structure, add additional protection to new gates, remove some extraneous leftovers from tests
    
    (cherry picked from commit 9a8979e893c9186fb55c24eb32584e3f6f2d4d0b)
---
 .../java/org/apache/qpid/proton/engine/impl/TransportImpl.java |  7 +++----
 .../org/apache/qpid/proton/engine/impl/TransportImplTest.java  | 10 +---------
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
index 6653bd79..da2e9abb 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
@@ -561,18 +561,17 @@ public class TransportImpl extends EndpointImpl
         SessionImpl session = snd.getSession();
         TransportSession tpSession = session.getTransportSession();
 
-        if (tpSession.endSent()) {
+        if (tpSession != null && tpSession.endSent()) {
             // Too late to action this work, clear it.
             return true;
         }
 
-        boolean localChannelSet = tpSession.isLocalChannelSet();
         boolean wasDone = delivery.isDone();
 
         if(!delivery.isDone() &&
            (delivery.getDataLength() > 0 || delivery != snd.current()) &&
            tpSession.hasOutgoingCredit() && tpLink.hasCredit() &&
-           localChannelSet &&
+           tpSession.isLocalChannelSet() &&
            tpLink.getLocalHandle() != null && !_frameWriter.isFull())
         {
             DeliveryImpl inProgress = tpLink.getInProgressDelivery();
@@ -682,7 +681,7 @@ public class TransportImpl extends EndpointImpl
             }
         }
 
-        if(wasDone && delivery.getLocalState() != null && localChannelSet)
+        if(wasDone && delivery.getLocalState() != null && tpSession.isLocalChannelSet())
         {
             TransportDelivery tpDelivery = delivery.getTransportDelivery();
             // Use cached object as holder of data for immediate write to the FrameWriter
diff --git a/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportImplTest.java b/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportImplTest.java
index 56e518bf..82ff4c81 100644
--- a/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportImplTest.java
+++ b/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportImplTest.java
@@ -4981,10 +4981,6 @@ public class TransportImplTest
 
         // Send the necessary responses to End
         End end = new End();
-        begin.setRemoteChannel(UnsignedShort.valueOf((short) 0));
-        begin.setNextOutgoingId(UnsignedInteger.ONE);
-        begin.setIncomingWindow(UnsignedInteger.valueOf(1024));
-        begin.setOutgoingWindow(UnsignedInteger.valueOf(1024));
         transport.handleFrame(new TransportFrame(0, end, null));
 
         assertEndpointState(session, EndpointState.CLOSED, EndpointState.CLOSED);
@@ -5035,7 +5031,7 @@ public class TransportImplTest
 
         assertNull("Should not yet have a delivery", sender.current());
 
-        // Send the necessary responses to open/begin/attach as well as a transfer
+        // Send the necessary responses to open/begin
         transport.handleFrame(new TransportFrame(0, new Open(), null));
 
         Begin begin = new Begin();
@@ -5094,10 +5090,6 @@ public class TransportImplTest
 
         // Send the necessary responses to End
         End end = new End();
-        begin.setRemoteChannel(UnsignedShort.valueOf((short) 0));
-        begin.setNextOutgoingId(UnsignedInteger.ONE);
-        begin.setIncomingWindow(UnsignedInteger.valueOf(1024));
-        begin.setOutgoingWindow(UnsignedInteger.valueOf(1024));
         transport.handleFrame(new TransportFrame(0, end, null));
 
         assertEndpointState(session, EndpointState.CLOSED, EndpointState.CLOSED);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-proton-j] 01/09: create 0.34.x branch, update versions and set tag ref accordingly

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch 0.34.x
in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git

commit 262d79247f590066164c2f6044b8a84e3d9a56ee
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Thu Mar 2 11:18:05 2023 +0000

    create 0.34.x branch, update versions and set tag ref accordingly
    
    Command used for version change:
    mvn release:update-versions -DdevelopmentVersion=0.34.1-SNAPSHOT -Pperformance-jmh
---
 apache-qpid-proton-j/pom.xml  | 2 +-
 examples/engine/pom.xml       | 2 +-
 examples/reactor/pom.xml      | 2 +-
 pom.xml                       | 6 +++---
 proton-j/pom.xml              | 2 +-
 tests/performance-jmh/pom.xml | 2 +-
 tests/pom.xml                 | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/apache-qpid-proton-j/pom.xml b/apache-qpid-proton-j/pom.xml
index 76560d65..872697df 100644
--- a/apache-qpid-proton-j/pom.xml
+++ b/apache-qpid-proton-j/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.qpid</groupId>
     <artifactId>proton-j-parent</artifactId>
-    <version>0.34.0</version>
+    <version>0.34.1-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>
diff --git a/examples/engine/pom.xml b/examples/engine/pom.xml
index 86da57fe..912ee64a 100644
--- a/examples/engine/pom.xml
+++ b/examples/engine/pom.xml
@@ -19,7 +19,7 @@
   <parent>
     <groupId>org.apache.qpid</groupId>
     <artifactId>proton-j-parent</artifactId>
-    <version>0.34.0</version>
+    <version>0.34.1-SNAPSHOT</version>
     <relativePath>../../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>
diff --git a/examples/reactor/pom.xml b/examples/reactor/pom.xml
index 0901e614..46b27544 100644
--- a/examples/reactor/pom.xml
+++ b/examples/reactor/pom.xml
@@ -19,7 +19,7 @@
   <parent>
     <groupId>org.apache.qpid</groupId>
     <artifactId>proton-j-parent</artifactId>
-    <version>0.34.0</version>
+    <version>0.34.1-SNAPSHOT</version>
     <relativePath>../../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>
diff --git a/pom.xml b/pom.xml
index abc1fdce..8a99e0cb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
 
   <groupId>org.apache.qpid</groupId>
   <artifactId>proton-j-parent</artifactId>
-  <version>0.34.0</version>
+  <version>0.34.1-SNAPSHOT</version>
   <packaging>pom</packaging>
 
   <name>Proton-J Parent</name>
@@ -49,7 +49,7 @@
     <!-- surefire forked jvm arguments -->
     <argLine>-Xmx2g -enableassertions ${jacoco-config}</argLine>
 
-    <project.build.outputTimestamp>2022-08-30T16:51:57Z</project.build.outputTimestamp>
+    <project.build.outputTimestamp>2023-03-02T11:16:13Z</project.build.outputTimestamp>
   </properties>
 
   <dependencyManagement>
@@ -205,7 +205,7 @@
     <connection>scm:git:https://gitbox.apache.org/repos/asf/qpid-proton-j.git</connection>
     <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/qpid-proton-j.git</developerConnection>
     <url>https://gitbox.apache.org/repos/asf?p=qpid-proton-j.git</url>
-    <tag>0.34.0</tag>
+    <tag>0.34.x</tag>
   </scm>
   <issueManagement>
     <url>https://issues.apache.org/jira/browse/PROTON</url>
diff --git a/proton-j/pom.xml b/proton-j/pom.xml
index a117ce52..16b0942d 100644
--- a/proton-j/pom.xml
+++ b/proton-j/pom.xml
@@ -19,7 +19,7 @@
   <parent>
     <groupId>org.apache.qpid</groupId>
     <artifactId>proton-j-parent</artifactId>
-    <version>0.34.0</version>
+    <version>0.34.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/tests/performance-jmh/pom.xml b/tests/performance-jmh/pom.xml
index 957bfc49..c96359a2 100644
--- a/tests/performance-jmh/pom.xml
+++ b/tests/performance-jmh/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.apache.qpid</groupId>
         <artifactId>proton-j-parent</artifactId>
-        <version>0.34.0</version>
+        <version>0.34.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
diff --git a/tests/pom.xml b/tests/pom.xml
index 1e4a315a..2793d0d8 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -23,7 +23,7 @@
   <parent>
     <groupId>org.apache.qpid</groupId>
     <artifactId>proton-j-parent</artifactId>
-    <version>0.34.0</version>
+    <version>0.34.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>proton-tests</artifactId>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-proton-j] 07/09: PROTON-2687: clean up stale entries in transport work list that cant be actioned, and prevent them from entering where possible

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch 0.34.x
in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git

commit a4420f60abc06cc39187e8680bf4b4c6996d7fb7
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Thu Feb 23 20:02:41 2023 +0000

    PROTON-2687: clean up stale entries in transport work list that cant be actioned, and prevent them from entering where possible
    
    (cherry picked from commit 077bc2d2d374a342ec5b82589486d10067a0b528)
---
 .../qpid/proton/engine/impl/DeliveryImpl.java      |   6 +
 .../qpid/proton/engine/impl/TransportImpl.java     |  16 +-
 .../qpid/proton/engine/impl/TransportSession.java  |  11 +
 .../qpid/proton/engine/impl/DeliveryImplTest.java  |   2 +
 .../qpid/proton/engine/impl/TransportImplTest.java | 222 +++++++++++++++++++++
 5 files changed, 255 insertions(+), 2 deletions(-)

diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/DeliveryImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/DeliveryImpl.java
index 2928d376..432e8aa8 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/DeliveryImpl.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/DeliveryImpl.java
@@ -291,6 +291,12 @@ public class DeliveryImpl implements Delivery
 
     void addToTransportWorkList()
     {
+        TransportSession transportSession = getLink().getSession().getTransportSession();
+        if (transportSession != null && transportSession.endSent()) {
+            // Too late to action this work, dont add it to the transport work list.
+            return;
+        }
+
         getLink().getConnectionImpl().addTransportWork(this);
     }
 
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
index aa304965..6653bd79 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
@@ -561,12 +561,18 @@ public class TransportImpl extends EndpointImpl
         SessionImpl session = snd.getSession();
         TransportSession tpSession = session.getTransportSession();
 
+        if (tpSession.endSent()) {
+            // Too late to action this work, clear it.
+            return true;
+        }
+
+        boolean localChannelSet = tpSession.isLocalChannelSet();
         boolean wasDone = delivery.isDone();
 
         if(!delivery.isDone() &&
            (delivery.getDataLength() > 0 || delivery != snd.current()) &&
            tpSession.hasOutgoingCredit() && tpLink.hasCredit() &&
-           tpSession.isLocalChannelSet() &&
+           localChannelSet &&
            tpLink.getLocalHandle() != null && !_frameWriter.isFull())
         {
             DeliveryImpl inProgress = tpLink.getInProgressDelivery();
@@ -676,7 +682,7 @@ public class TransportImpl extends EndpointImpl
             }
         }
 
-        if(wasDone && delivery.getLocalState() != null)
+        if(wasDone && delivery.getLocalState() != null && localChannelSet)
         {
             TransportDelivery tpDelivery = delivery.getTransportDelivery();
             // Use cached object as holder of data for immediate write to the FrameWriter
@@ -703,6 +709,11 @@ public class TransportImpl extends EndpointImpl
         SessionImpl session = rcv.getSession();
         TransportSession tpSession = session.getTransportSession();
 
+        if (tpSession.endSent()) {
+            // Too late to action this work, clear it.
+            return true;
+        }
+
         if (tpSession.isLocalChannelSet())
         {
             boolean settled = delivery.isSettled();
@@ -1055,6 +1066,7 @@ public class TransportImpl extends EndpointImpl
                         }
 
                         writeFrame(channel, end, null, null);
+                        transportSession.sentEnd();
                     }
 
                     endpoint.clearModified();
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportSession.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportSession.java
index 0bab2912..d657ba95 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportSession.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportSession.java
@@ -70,6 +70,7 @@ class TransportSession
     private int _unsettledIncomingSize;
     private boolean _endReceived;
     private boolean _beginSent;
+    private boolean _endSent;
 
     TransportSession(TransportImpl transport, SessionImpl session)
     {
@@ -527,4 +528,14 @@ class TransportSession
     {
         _beginSent = true;
     }
+
+    public boolean endSent()
+    {
+        return _endSent;
+    }
+
+    public void sentEnd()
+    {
+        _endSent = true;
+    }
 }
diff --git a/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/DeliveryImplTest.java b/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/DeliveryImplTest.java
index cd390ae1..18143af8 100644
--- a/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/DeliveryImplTest.java
+++ b/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/DeliveryImplTest.java
@@ -735,7 +735,9 @@ public class DeliveryImplTest
     private DeliveryImpl createSenderDelivery() {
         LinkImpl link = Mockito.mock(SenderImpl.class);
         ConnectionImpl connection = Mockito.mock(ConnectionImpl.class);
+        SessionImpl session = Mockito.mock(SessionImpl.class);
 
+        Mockito.when(link.getSession()).thenReturn(session);
         Mockito.when(link.getConnectionImpl()).thenReturn(connection);
 
         return new DeliveryImpl(null, link, null);
diff --git a/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportImplTest.java b/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportImplTest.java
index 4d65343b..56e518bf 100644
--- a/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportImplTest.java
+++ b/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportImplTest.java
@@ -4895,4 +4895,226 @@ public class TransportImplTest
 
         assertNoEvents(collector);
     }
+
+    /**
+     * Verify that the transport work list doesnt retain deliveries+link+session on when a session
+     * is closed and freed while there is an active receiver link with deliveries still outstanding.
+     */
+    @Test
+    public void testTransportWorkListDoesntLeakDeliveriesEtcFromSessionFreedWithActiveReceiverWithOutstandingDeliveries()
+    {
+        MockTransportImpl transport = new MockTransportImpl();
+        ConnectionImpl connection = new ConnectionImpl();
+        transport.bind(connection);
+
+        connection.open();
+
+        Session session = connection.session();
+        session.open();
+
+        String linkName = "myClientReceiver";
+        Receiver receiver = session.receiver(linkName);
+        receiver.flow(5);
+        receiver.open();
+
+        pumpMockTransport(transport);
+
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 4, transport.writes.size());
+
+        assertTrue("Unexpected frame type", transport.writes.get(0) instanceof Open);
+        assertTrue("Unexpected frame type", transport.writes.get(1) instanceof Begin);
+        assertTrue("Unexpected frame type", transport.writes.get(2) instanceof Attach);
+        assertTrue("Unexpected frame type", transport.writes.get(3) instanceof Flow);
+
+        Delivery delivery = receiver.current();
+        assertNull("Should not yet have a delivery", delivery);
+
+        // Send the necessary responses to open/begin/attach as well as a transfer
+        transport.handleFrame(new TransportFrame(0, new Open(), null));
+
+        Begin begin = new Begin();
+        begin.setRemoteChannel(UnsignedShort.valueOf((short) 0));
+        begin.setNextOutgoingId(UnsignedInteger.ONE);
+        begin.setIncomingWindow(UnsignedInteger.valueOf(1024));
+        begin.setOutgoingWindow(UnsignedInteger.valueOf(1024));
+        transport.handleFrame(new TransportFrame(0, begin, null));
+
+        Attach attach = new Attach();
+        attach.setHandle(UnsignedInteger.ZERO);
+        attach.setRole(Role.SENDER);
+        attach.setName(linkName);
+        attach.setInitialDeliveryCount(UnsignedInteger.ZERO);
+        transport.handleFrame(new TransportFrame(0, attach, null));
+
+        assertEndpointState(receiver, EndpointState.ACTIVE, EndpointState.ACTIVE);
+        assertEndpointState(session, EndpointState.ACTIVE, EndpointState.ACTIVE);
+
+        String deliveryTag = "tag1";
+        String messageContent = "content1";
+        handleTransfer(transport, 1, deliveryTag, messageContent);
+
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 4, transport.writes.size());
+
+        delivery = verifyDelivery(receiver, deliveryTag, messageContent);
+        assertNotNull("Should now have a delivery", delivery);
+
+        delivery.disposition(Accepted.getInstance());
+
+        assertEquals("Expected the delivery to be on the transport work list", delivery, connection.getTransportWorkHead());
+
+        pumpMockTransport(transport);
+
+        assertNull("Expected the delivery to cleared from the transport work list", connection.getTransportWorkHead());
+
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 5, transport.writes.size());
+        assertTrue("Unexpected frame type", transport.writes.get(4) instanceof Disposition);
+
+        session.close();
+
+        pumpMockTransport(transport);
+
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 6, transport.writes.size());
+        assertTrue("Unexpected frame type", transport.writes.get(5) instanceof End);
+
+        assertNull("Expected the transport work list to be empty", connection.getTransportWorkHead());
+        assertEndpointState(session, EndpointState.CLOSED, EndpointState.ACTIVE);
+
+        // Send the necessary responses to End
+        End end = new End();
+        begin.setRemoteChannel(UnsignedShort.valueOf((short) 0));
+        begin.setNextOutgoingId(UnsignedInteger.ONE);
+        begin.setIncomingWindow(UnsignedInteger.valueOf(1024));
+        begin.setOutgoingWindow(UnsignedInteger.valueOf(1024));
+        transport.handleFrame(new TransportFrame(0, end, null));
+
+        assertEndpointState(session, EndpointState.CLOSED, EndpointState.CLOSED);
+
+        assertNull("Expected the transport work list to be empty", connection.getTransportWorkHead());
+
+        session.free();
+
+        pumpMockTransport(transport);
+
+        assertNull("Expected the transport work list to be empty", connection.getTransportWorkHead());
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 6, transport.writes.size());
+
+        connection.close();
+        pumpMockTransport(transport);
+
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 7, transport.writes.size());
+        assertTrue("Unexpected frame type", transport.writes.get(6) instanceof Close);
+    }
+
+    /**
+     * Verify that the transport doesnt retain deliveries+link+session when a session is closed
+     * and freed while there is an active sender link with deliveries still outstanding.
+     */
+    @Test
+    public void testTransportWorkListDoesntLeakDeliveriesEtcFromSessionFreedWithActiveSenderWithOutstandingDeliveries()
+    {
+        MockTransportImpl transport = new MockTransportImpl();
+        ConnectionImpl connection = new ConnectionImpl();
+        transport.bind(connection);
+
+        connection.open();
+
+        Session session = connection.session();
+        session.open();
+
+        String linkName = "myClientSender";
+        Sender sender = session.sender(linkName);
+        sender.open();
+
+        pumpMockTransport(transport);
+
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 3, transport.writes.size());
+
+        assertTrue("Unexpected frame type", transport.writes.get(0) instanceof Open);
+        assertTrue("Unexpected frame type", transport.writes.get(1) instanceof Begin);
+        assertTrue("Unexpected frame type", transport.writes.get(2) instanceof Attach);
+
+        assertNull("Should not yet have a delivery", sender.current());
+
+        // Send the necessary responses to open/begin/attach as well as a transfer
+        transport.handleFrame(new TransportFrame(0, new Open(), null));
+
+        Begin begin = new Begin();
+        begin.setRemoteChannel(UnsignedShort.valueOf((short) 0));
+        begin.setNextOutgoingId(UnsignedInteger.ONE);
+        begin.setIncomingWindow(UnsignedInteger.valueOf(1024));
+        begin.setOutgoingWindow(UnsignedInteger.valueOf(1024));
+        transport.handleFrame(new TransportFrame(0, begin, null));
+
+        // Give the necessary response to attach for sender and grant some credit
+        Attach attach = new Attach();
+        attach.setHandle(UnsignedInteger.ZERO);
+        attach.setRole(Role.RECEIVER);
+        attach.setName(linkName);
+        attach.setInitialDeliveryCount(UnsignedInteger.ZERO);
+        transport.handleFrame(new TransportFrame(0, attach, null));
+
+        int credit = 10;
+        Flow flow = new Flow();
+        flow.setHandle(UnsignedInteger.ZERO);
+        flow.setDeliveryCount(UnsignedInteger.ZERO);
+        flow.setNextIncomingId(UnsignedInteger.ONE);
+        flow.setNextOutgoingId(UnsignedInteger.ZERO);
+        flow.setIncomingWindow(UnsignedInteger.valueOf(1024));
+        flow.setOutgoingWindow(UnsignedInteger.valueOf(1024));
+        flow.setLinkCredit(UnsignedInteger.valueOf(credit));
+
+        transport.handleFrame(new TransportFrame(0, flow, null));
+
+        assertEndpointState(sender, EndpointState.ACTIVE, EndpointState.ACTIVE);
+        assertEndpointState(session, EndpointState.ACTIVE, EndpointState.ACTIVE);
+
+        assertEquals("Expected the sender to have credit", credit, sender.getCredit());
+
+        Delivery delivery = sendMessage(sender, "tag1", "content1");
+
+        assertEquals("Expected the delivery to be on the transport work list", delivery, connection.getTransportWorkHead());
+        assertEquals("Expected the sender to have 1 less credit", credit -1 , sender.getCredit());
+
+        pumpMockTransport(transport);
+
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 4, transport.writes.size());
+        assertTrue("Unexpected frame type", transport.writes.get(3) instanceof Transfer);
+
+        assertNull("Expected the delivery to cleared from the transport work list", connection.getTransportWorkHead());
+
+        session.close();
+
+        pumpMockTransport(transport);
+
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 5, transport.writes.size());
+        assertTrue("Unexpected frame type", transport.writes.get(4) instanceof End);
+
+        assertNull("Expected the transport work list to be empty", connection.getTransportWorkHead());
+        assertEndpointState(session, EndpointState.CLOSED, EndpointState.ACTIVE);
+
+        // Send the necessary responses to End
+        End end = new End();
+        begin.setRemoteChannel(UnsignedShort.valueOf((short) 0));
+        begin.setNextOutgoingId(UnsignedInteger.ONE);
+        begin.setIncomingWindow(UnsignedInteger.valueOf(1024));
+        begin.setOutgoingWindow(UnsignedInteger.valueOf(1024));
+        transport.handleFrame(new TransportFrame(0, end, null));
+
+        assertEndpointState(session, EndpointState.CLOSED, EndpointState.CLOSED);
+
+        assertNull("Expected the transport work list to be empty", connection.getTransportWorkHead());
+
+        session.free();
+
+        pumpMockTransport(transport);
+
+        assertNull("Expected the transport work list to be empty", connection.getTransportWorkHead());
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 5, transport.writes.size());
+
+        connection.close();
+        pumpMockTransport(transport);
+
+        assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 6, transport.writes.size());
+        assertTrue("Unexpected frame type", transport.writes.get(5) instanceof Close);
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-proton-j] 03/09: NO-JIRA: update various actions versions to resolve deprecation warnings

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch 0.34.x
in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git

commit 9e9ef14384b1c7f704cf0ac9e6b7aa0436b2e5e1
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Fri Oct 28 15:25:15 2022 +0100

    NO-JIRA: update various actions versions to resolve deprecation warnings
    
    (cherry picked from commit 0062e1b103910610bce626d3bade6b6d976f47ad)
---
 .github/workflows/build.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index cb7448df..0ee25786 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -11,8 +11,8 @@ jobs:
         java: [ 8, 11, 17 ]
 
     steps:
-      - uses: actions/checkout@v2
-      - uses: actions/cache@v2
+      - uses: actions/checkout@v3
+      - uses: actions/cache@v3
         with:
           path: ~/.m2/repository
           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -20,7 +20,7 @@ jobs:
             ${{ runner.os }}-maven-
 
       - name: Install JDK ${{ matrix.java }}
-        uses: actions/setup-java@v2
+        uses: actions/setup-java@v3
         with:
           java-version: ${{ matrix.java }}
           distribution: 'temurin'


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-proton-j] 05/09: NO-JIRA: remove [stale] CI build badges

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch 0.34.x
in repository https://gitbox.apache.org/repos/asf/qpid-proton-j.git

commit b6de9b2e7ec8f7cc58dcc8d18fdc0ed91172f3c9
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Mon Jan 9 15:19:50 2023 +0000

    NO-JIRA: remove [stale] CI build badges
    
    (cherry picked from commit 21c2e343b5aca9a03f0948ebe6fc5f86f2fdf8e8)
---
 README.md | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/README.md b/README.md
index db534ff0..490fef62 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,5 @@
 # Apache Qpid Proton-J
 
-[![Linux Build Status](https://travis-ci.com/apache/qpid-proton-j.svg?branch=main)](https://travis-ci.com/github/apache/qpid-proton-j)
-[![Windows Build Status](https://ci.appveyor.com/api/projects/status/wh587qrxa3c22mh2/branch/main?svg=true)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/qpid-proton-j/branch/main)
-
-
 [Qpid Proton-J](https://qpid.apache.org/proton) is a high-performance, lightweight messaging
 library. It can be used in the widest range of messaging applications, including brokers,
 clients libraries, routers, bridges, proxies, and more.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org