You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by clebertsuconic <gi...@git.apache.org> on 2017/03/27 22:50:08 UTC

[GitHub] activemq-artemis pull request #1140: ARTEMIS-1056 Better event processing

GitHub user clebertsuconic opened a pull request:

    https://github.com/apache/activemq-artemis/pull/1140

    ARTEMIS-1056 Better event processing

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/clebertsuconic/activemq-artemis improv

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq-artemis/pull/1140.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 #1140
    
----
commit 49705f6cfeb139194b1dd5556cddf4934605d4be
Author: Clebert Suconic <cl...@apache.org>
Date:   2017-03-27T21:45:01Z

    ARTEMIS-1056 Better event processing

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1140: ARTEMIS-1056 Better event processing

Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1140#discussion_r108398829
  
    --- Diff: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/handler/ProtonHandler.java ---
    @@ -322,17 +308,22 @@ private void dispatch() {
           // because we could have a distributed deadlock
           // while processing events (for instance onTransport)
           // while a client is also trying to write here
    -      while ((ev = popEvent()) != null) {
    -         for (EventHandler h : handlers) {
    -            if (log.isTraceEnabled()) {
    -               log.trace("Handling " + ev + " towards " + h);
    -            }
    -            try {
    -               Events.dispatch(ev, h);
    -            } catch (Exception e) {
    -               log.warn(e.getMessage(), e);
    -               connection.setCondition(new ErrorCondition());
    +
    +      synchronized (lock) {
    +         while ((ev = collector.peek()) != null) {
    +            for (EventHandler h : handlers) {
    +               if (log.isTraceEnabled()) {
    +                  log.trace("Handling " + ev + " towards " + h);
    +               }
    +               try {
    +                  Events.dispatch(ev, h);
    +               } catch (Exception e) {
    +                  log.warn(e.getMessage(), e);
    +                  connection.setCondition(new ErrorCondition());
    --- End diff --
    
    Its not clear what the intent is here (and in similar snippet further down the method), but I'm not sure this will be having the desired effect.
    
    Setting a brand new ErrorCondition like this will effectively clear any error details for the connection, which are actually the condition/description/info-map details stored inside an ErrorCondition object, which will be empty for the new instance. Setting a condition inside the ErrorCondition doesn't itself lead to it being sent, the endpoint subsequently needs closed before the details are included in the detach/end/close frame then being sent. The connection may not be the right endpoint to set an error, e.g it might be a particular link receiving a delivery event and so that link might be the endpoint to update.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1140: ARTEMIS-1056 Better event processing

Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1140#discussion_r108422248
  
    --- Diff: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/handler/ProtonHandler.java ---
    @@ -322,17 +308,22 @@ private void dispatch() {
           // because we could have a distributed deadlock
           // while processing events (for instance onTransport)
           // while a client is also trying to write here
    -      while ((ev = popEvent()) != null) {
    -         for (EventHandler h : handlers) {
    -            if (log.isTraceEnabled()) {
    -               log.trace("Handling " + ev + " towards " + h);
    -            }
    -            try {
    -               Events.dispatch(ev, h);
    -            } catch (Exception e) {
    -               log.warn(e.getMessage(), e);
    -               connection.setCondition(new ErrorCondition());
    +
    +      synchronized (lock) {
    +         while ((ev = collector.peek()) != null) {
    +            for (EventHandler h : handlers) {
    +               if (log.isTraceEnabled()) {
    +                  log.trace("Handling " + ev + " towards " + h);
    +               }
    +               try {
    +                  Events.dispatch(ev, h);
    +               } catch (Exception e) {
    +                  log.warn(e.getMessage(), e);
    +                  connection.setCondition(new ErrorCondition());
    --- End diff --
    
    Fair enough on that part then. As above though the code wont actually set an error here, but will instead clear any existing one, and even if it did no details would be sent until something else closes the connection.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1140: ARTEMIS-1056 Better event processing

Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1140#discussion_r108396438
  
    --- Diff: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/handler/ProtonHandler.java ---
    @@ -322,17 +308,22 @@ private void dispatch() {
           // because we could have a distributed deadlock
           // while processing events (for instance onTransport)
           // while a client is also trying to write here
    -      while ((ev = popEvent()) != null) {
    -         for (EventHandler h : handlers) {
    -            if (log.isTraceEnabled()) {
    -               log.trace("Handling " + ev + " towards " + h);
    -            }
    -            try {
    -               Events.dispatch(ev, h);
    -            } catch (Exception e) {
    -               log.warn(e.getMessage(), e);
    -               connection.setCondition(new ErrorCondition());
    +
    +      synchronized (lock) {
    --- End diff --
    
    The code now contradicts the comment above it, perhaps the comment should be removed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1140: ARTEMIS-1056 Better event processing

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/activemq-artemis/pull/1140


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1140: ARTEMIS-1056 Better event processing

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/1140#discussion_r108418250
  
    --- Diff: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/handler/ProtonHandler.java ---
    @@ -322,17 +308,22 @@ private void dispatch() {
           // because we could have a distributed deadlock
           // while processing events (for instance onTransport)
           // while a client is also trying to write here
    -      while ((ev = popEvent()) != null) {
    -         for (EventHandler h : handlers) {
    -            if (log.isTraceEnabled()) {
    -               log.trace("Handling " + ev + " towards " + h);
    -            }
    -            try {
    -               Events.dispatch(ev, h);
    -            } catch (Exception e) {
    -               log.warn(e.getMessage(), e);
    -               connection.setCondition(new ErrorCondition());
    +
    +      synchronized (lock) {
    +         while ((ev = collector.peek()) != null) {
    +            for (EventHandler h : handlers) {
    +               if (log.isTraceEnabled()) {
    +                  log.trace("Handling " + ev + " towards " + h);
    +               }
    +               try {
    +                  Events.dispatch(ev, h);
    +               } catch (Exception e) {
    +                  log.warn(e.getMessage(), e);
    +                  connection.setCondition(new ErrorCondition());
    --- End diff --
    
    @gemmellr  this is an extra safety measure.
    
    Each method down the road is supposed to take care of exceptions.. This is never supposed to happen.
    
    
    We have a similar code on Core... sending an error condition to the client in case any non treated exception happened.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---