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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to