You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by andytaylor <gi...@git.apache.org> on 2018/09/12 15:23:02 UTC
[GitHub] activemq-artemis pull request #2306: ENTMQBR-1569 - make sure to send credit...
GitHub user andytaylor opened a pull request:
https://github.com/apache/activemq-artemis/pull/2306
ENTMQBR-1569 - make sure to send credits on rejected messages
And also to run the credit runnables once memory is free in fail mode
https://issues.jboss.org/browse/ENTMQBR-1569
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/andytaylor/activemq-artemis ENTMQBR-1569
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/activemq-artemis/pull/2306.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2306
----
commit 61c02625737d00d28180837c0edaa79f79496c8d
Author: andytaylor <an...@...>
Date: 2018-09-12T10:16:41Z
ENTMQBR-1569 - make sure tosend credits on rejected messages
And also to run the credit runnables once memory is free in fail mode
https://issues.jboss.org/browse/ENTMQBR-1569
----
---
[GitHub] activemq-artemis issue #2306: ENTMQBR-1569 - make sure to send credits on re...
Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on the issue:
https://github.com/apache/activemq-artemis/pull/2306
Seems like https://issues.apache.org/jira/browse/ARTEMIS-1898 might be relevant to one part of the changes.
---
[GitHub] activemq-artemis pull request #2306: ENTMQBR-1569 - make sure to send credit...
Posted by andytaylor <gi...@git.apache.org>.
Github user andytaylor commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2306#discussion_r217312411
--- Diff: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java ---
@@ -573,20 +575,38 @@ public void offerProducerCredit(final SimpleString address,
final int threshold,
final Receiver receiver) {
try {
+ /*
+ * The credit runnable will always be run in this thread unless the address or disc is full. If this is the case the
+ * runnable is run once the memory or disc is free, if this happens we don't want to keep adding runnables as this
+ * may cause a memory leak, one is enough.
+ * */
+ if (creditRunnable != null && !creditRunnable.isRun())
+ return;
PagingManager pagingManager = manager.getServer().getPagingManager();
- Runnable creditRunnable = () -> {
- connection.lock();
- try {
- if (receiver.getCredit() <= threshold) {
- int topUp = credits - receiver.getCredit();
- if (topUp > 0) {
- receiver.flow(topUp);
+ creditRunnable = new CreditRunnable() {
+ boolean isRun = false;
+ @Override
+ public boolean isRun() {
+ return isRun;
+ }
+
+ @Override
+ public void run() {
+ connection.lock();
+ try {
+ if (receiver.getCredit() <= threshold) {
+ int topUp = credits - receiver.getCredit();
+ System.out.println("topUp = " + topUp);
--- End diff --
my bad
---
[GitHub] activemq-artemis issue #2306: ARTEMIS-1898 - make sure to send credits on re...
Posted by andytaylor <gi...@git.apache.org>.
Github user andytaylor commented on the issue:
https://github.com/apache/activemq-artemis/pull/2306
fixed
---
[GitHub] activemq-artemis pull request #2306: ARTEMIS-1898 - make sure to send credit...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/activemq-artemis/pull/2306
---
[GitHub] activemq-artemis issue #2306: ENTMQBR-1569 - make sure to send credits on re...
Posted by tabish121 <gi...@git.apache.org>.
Github user tabish121 commented on the issue:
https://github.com/apache/activemq-artemis/pull/2306
This should be referencing some ActiveMQ Artemis JIRA issue and not an JIRA from an external tracker.
---
[GitHub] activemq-artemis pull request #2306: ENTMQBR-1569 - make sure to send credit...
Posted by tabish121 <gi...@git.apache.org>.
Github user tabish121 commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2306#discussion_r217160287
--- Diff: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java ---
@@ -573,20 +575,38 @@ public void offerProducerCredit(final SimpleString address,
final int threshold,
final Receiver receiver) {
try {
+ /*
+ * The credit runnable will always be run in this thread unless the address or disc is full. If this is the case the
+ * runnable is run once the memory or disc is free, if this happens we don't want to keep adding runnables as this
+ * may cause a memory leak, one is enough.
+ * */
+ if (creditRunnable != null && !creditRunnable.isRun())
+ return;
PagingManager pagingManager = manager.getServer().getPagingManager();
- Runnable creditRunnable = () -> {
- connection.lock();
- try {
- if (receiver.getCredit() <= threshold) {
- int topUp = credits - receiver.getCredit();
- if (topUp > 0) {
- receiver.flow(topUp);
+ creditRunnable = new CreditRunnable() {
+ boolean isRun = false;
+ @Override
+ public boolean isRun() {
+ return isRun;
+ }
+
+ @Override
+ public void run() {
+ connection.lock();
+ try {
+ if (receiver.getCredit() <= threshold) {
+ int topUp = credits - receiver.getCredit();
+ System.out.println("topUp = " + topUp);
--- End diff --
Either use a logger or remove this I'd think.
---
[GitHub] activemq-artemis pull request #2306: ENTMQBR-1569 - make sure to send credit...
Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2306#discussion_r217183988
--- Diff: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java ---
@@ -573,20 +575,38 @@ public void offerProducerCredit(final SimpleString address,
final int threshold,
final Receiver receiver) {
try {
+ /*
+ * The credit runnable will always be run in this thread unless the address or disc is full. If this is the case the
+ * runnable is run once the memory or disc is free, if this happens we don't want to keep adding runnables as this
+ * may cause a memory leak, one is enough.
+ * */
+ if (creditRunnable != null && !creditRunnable.isRun())
+ return;
PagingManager pagingManager = manager.getServer().getPagingManager();
- Runnable creditRunnable = () -> {
- connection.lock();
- try {
- if (receiver.getCredit() <= threshold) {
- int topUp = credits - receiver.getCredit();
- if (topUp > 0) {
- receiver.flow(topUp);
+ creditRunnable = new CreditRunnable() {
+ boolean isRun = false;
+ @Override
+ public boolean isRun() {
+ return isRun;
+ }
+
+ @Override
+ public void run() {
+ connection.lock();
+ try {
+ if (receiver.getCredit() <= threshold) {
+ int topUp = credits - receiver.getCredit();
+ System.out.println("topUp = " + topUp);
--- End diff --
+1, remove the system.out
---