You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Arthur Naseef (JIRA)" <ji...@apache.org> on 2011/01/28 06:37:43 UTC

[jira] Created: (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
--------------------------------------------------------------------------------------------------------

                 Key: AMQ-3166
                 URL: https://issues.apache.org/jira/browse/AMQ-3166
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker, JMS client
    Affects Versions: 5.4.2
            Reporter: Arthur Naseef


Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.

Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.

Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.

To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).

Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.

I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.

=== SAMPLE BROKER XML ===

<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

    <broker xmlns="http://activemq.apache.org/schema/core"
            brokerName="localhost"
            dataDirectory="${activemq.base}/data"
            destroyApplicationContextOnStop="true" >

        <persistenceAdapter>
            <kahaDB directory="${activemq.base}/data/kahadb"/>
        </persistenceAdapter>
        
        <plugins>
          <simpleAuthenticationPlugin anonymousAccessAllowed="true">
              <users>
                  <authenticationUser username="user" password="password"
                      groups="users"/>
              </users>
          </simpleAuthenticationPlugin>

          <authorizationPlugin>
              <map>
                  <authorizationMap>
                    <authorizationEntries>
                      <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
                      <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
                    </authorizationEntries>
                  </authorizationMap>
              </map>
          </authorizationPlugin>
        </plugins>

        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
        </transportConnectors>
    </broker>
</beans>



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


[jira] Updated: (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arthur Naseef updated AMQ-3166:
-------------------------------

    Description: 
Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.

Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.

Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.

To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).

Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.

I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.

=== SAMPLE BROKER XML ===

<pre>
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

    <broker xmlns="http://activemq.apache.org/schema/core"
            brokerName="localhost"
            dataDirectory="${activemq.base}/data"
            destroyApplicationContextOnStop="true" >

        <persistenceAdapter>
            <kahaDB directory="${activemq.base}/data/kahadb"/>
        </persistenceAdapter>
        
        <plugins>
          <simpleAuthenticationPlugin anonymousAccessAllowed="true">
              <users>
                  <authenticationUser username="user" password="password"
                      groups="users"/>
              </users>
          </simpleAuthenticationPlugin>

          <authorizationPlugin>
              <map>
                  <authorizationMap>
                    <authorizationEntries>
                      <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
                      <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
                    </authorizationEntries>
                  </authorizationMap>
              </map>
          </authorizationPlugin>
        </plugins>

        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
        </transportConnectors>
    </broker>
</beans>
</pre>


  was:
Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.

Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.

Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.

To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).

Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.

I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.

=== SAMPLE BROKER XML ===

<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

    <broker xmlns="http://activemq.apache.org/schema/core"
            brokerName="localhost"
            dataDirectory="${activemq.base}/data"
            destroyApplicationContextOnStop="true" >

        <persistenceAdapter>
            <kahaDB directory="${activemq.base}/data/kahadb"/>
        </persistenceAdapter>
        
        <plugins>
          <simpleAuthenticationPlugin anonymousAccessAllowed="true">
              <users>
                  <authenticationUser username="user" password="password"
                      groups="users"/>
              </users>
          </simpleAuthenticationPlugin>

          <authorizationPlugin>
              <map>
                  <authorizationMap>
                    <authorizationEntries>
                      <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
                      <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
                    </authorizationEntries>
                  </authorizationMap>
              </map>
          </authorizationPlugin>
        </plugins>

        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
        </transportConnectors>
    </broker>
</beans>




> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2
>            Reporter: Arthur Naseef
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <pre>
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>
> </pre>

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arthur Naseef updated AMQ-3166:
-------------------------------

    Attachment: FailedTransactionTracking.java

Broker Filter which remembers failures on transactions and fails all subsequent operations (except rollbacks), including commit().

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java, FailedTransactionTracking.java, FailedTransactionTrackingPlugin.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arthur Naseef updated AMQ-3166:
-------------------------------

    Affects Version/s: 5.5.0

Confirmed with 5.5.0 as well.  Note that an activemq-cpp client was tested with the same results.

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arthur Naseef updated AMQ-3166:
-------------------------------

    Attachment: AMQ3166Test.java

Corrected source.  The previous one contained a typo.

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arthur Naseef updated AMQ-3166:
-------------------------------

    Attachment: FailedTransactionTrackingPlugin.java

BrokerPlugin for the filter.

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java, FailedTransactionTracking.java, FailedTransactionTrackingPlugin.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arthur Naseef updated AMQ-3166:
-------------------------------

    Attachment: FailedTransactionTrackingPlugin.java

Corrected the package name.

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java, FailedTransactionTracking.java, FailedTransactionTrackingPlugin.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13042158#comment-13042158 ] 

Timothy Bish edited comment on AMQ-3166 at 6/1/11 1:21 PM:
-----------------------------------------------------------

The C\+\+ client doesn't respect the jms option prefix for a few reasons, foremost being that its not a JMS client it implements CMS a JMS-like API that can and does vary somewhat from the JMS spec.  Also because the options vary between the C\+\+, .NET and Java client having the URI syntax be identical presents a false equivalence about what behaviour your URI options will produce in the case where you specify options that don't currently exist in the client of your choosing.   In the .NET client we prefix URI options with nms.* for the same reason.  It could be argued that the C\+\+ client should offer its options as cms.* and that would be fine with me, however nobody has stepped up to do the work involved in writing a better URI option parser so its remained as it is now.

      was (Author: tabish121):
    The C++ client doesn't respect the jms option prefix for a few reasons, foremost being that its not a JMS client it implements CMS a JMS-like API that can and does vary somewhat from the JMS spec.  Also because the options vary between the C++, .NET and Java client having the URI syntax be identical presents a false equivalence about what behaviour your URI options will produce in the case where you specify options that don't currently exist in the client of your choosing.   In the .NET client we prefix URI options with nms.* for the same reason.  It could be argued that the C++ client should offer its options as cms.* and that would be fine with me, however nobody has stepped up to do the work involved in writing a better URI option parser so its remained as it is now.
  
> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13042158#comment-13042158 ] 

Timothy Bish commented on AMQ-3166:
-----------------------------------

The C++ client doesn't respect the jms option prefix for a few reasons, foremost being that its not a JMS client it implements CMS a JMS-like API that can and does vary somewhat from the JMS spec.  Also because the options vary between the C++, .NET and Java client having the URI syntax be identical presents a false equivalence about what behaviour your URI options will produce in the case where you specify options that don't currently exist in the client of your choosing.   In the .NET client we prefix URI options with nms.* for the same reason.  It could be argued that the C++ client should offer its options as cms.* and that would be fine with me, however nobody has stepped up to do the work involved in writing a better URI option parser so its remained as it is now.

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13042113#comment-13042113 ] 

Gary Tully commented on AMQ-3166:
---------------------------------

I agree, it would be better if the cpp client respected the same naming convention, not sure why that is not the case.

The logic for async send with transactions follows from a commit/rollback being sent sync. There is no real work done on the broker till the transaction completes, this sort of batching is expected with multiple message sends in a transaction.
For the use case where a broker filter throws an exception, having commit fail would make some sense for the transacted case.
For a producer, I am not sure of the value of local transactions unless there is batching.
Having said that, having a transacted send respect alwaysSyncSend is no harm as it defaults to false. 

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arthur Naseef updated AMQ-3166:
-------------------------------

    Attachment:     (was: FailedTransactionTracking.java)

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java, FailedTransactionTracking.java, FailedTransactionTrackingPlugin.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arthur Naseef updated AMQ-3166:
-------------------------------

    Description: 
Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.

Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.

Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.

To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).

Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.

I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.

=== SAMPLE BROKER XML ===

<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

    <broker xmlns="http://activemq.apache.org/schema/core"
            brokerName="localhost"
            dataDirectory="${activemq.base}/data"
            destroyApplicationContextOnStop="true" >

        <persistenceAdapter>
            <kahaDB directory="${activemq.base}/data/kahadb"/>
        </persistenceAdapter>
        
        <plugins>
          <simpleAuthenticationPlugin anonymousAccessAllowed="true">
              <users>
                  <authenticationUser username="user" password="password"
                      groups="users"/>
              </users>
          </simpleAuthenticationPlugin>

          <authorizationPlugin>
              <map>
                  <authorizationMap>
                    <authorizationEntries>
                      <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
                      <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
                    </authorizationEntries>
                  </authorizationMap>
              </map>
          </authorizationPlugin>
        </plugins>

        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
        </transportConnectors>
    </broker>
</beans>


  was:
Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.

Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.

Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.

To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).

Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.

I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.

=== SAMPLE BROKER XML ===

<pre>
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

    <broker xmlns="http://activemq.apache.org/schema/core"
            brokerName="localhost"
            dataDirectory="${activemq.base}/data"
            destroyApplicationContextOnStop="true" >

        <persistenceAdapter>
            <kahaDB directory="${activemq.base}/data/kahadb"/>
        </persistenceAdapter>
        
        <plugins>
          <simpleAuthenticationPlugin anonymousAccessAllowed="true">
              <users>
                  <authenticationUser username="user" password="password"
                      groups="users"/>
              </users>
          </simpleAuthenticationPlugin>

          <authorizationPlugin>
              <map>
                  <authorizationMap>
                    <authorizationEntries>
                      <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
                      <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
                    </authorizationEntries>
                  </authorizationMap>
              </map>
          </authorizationPlugin>
        </plugins>

        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
        </transportConnectors>
    </broker>
</beans>
</pre>



> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2
>            Reporter: Arthur Naseef
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arthur Naseef updated AMQ-3166:
-------------------------------

    Attachment:     (was: FailedTransactionTrackingPlugin.java)

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java, FailedTransactionTracking.java, FailedTransactionTrackingPlugin.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arthur Naseef updated AMQ-3166:
-------------------------------

    Attachment: FailedTransactionTracking.java

Corrected the package name.

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java, FailedTransactionTracking.java, FailedTransactionTracking.java, FailedTransactionTrackingPlugin.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041991#comment-13041991 ] 

Arthur Naseef edited comment on AMQ-3166 at 6/1/11 5:42 AM:
------------------------------------------------------------

I finally walked through the entire IntrospectionSupport and query handling for an ActiveMQConnection and found that the following on the URL works around the issue as well:

{code}
...?jms.alwaysSyncSend=true         (JAVA CLIENT)
...?connection.alwaysSyncSend=true  (C++ CLIENT: activemq-cpp)
{code}

For TRANSACTIONS, I recommend that the extra logic be added to use sync sends by default because that matches the the JMS standard - and what I believe clients expect across all JMS providers - but with a setting that allows clients to override that operation.  Perhaps the following:

{code}
...?jms.transactionAsyncSend=false    => (default) don't use async sends with transactions
...?jms.transactionAsyncSend=true     => use async sends with transactions
{code}

By the way, shouldn't the activemq-cpp library support "jms." as the prefix for connection parameters in the same way the Java code does?  Otherwise, we have to make sure URL's are client-implementation-specific.

The subset of logic for async sends on transactions would be as follows:

{code}
IF (session IS transacted ) AND ( not alwaysSyncSend ) AND ( transactionAsyncSend )
THEN
  SEND async
ELSE
  SEND sync
END IF
{code}

A patch with this update will be coming soon.

      was (Author: artnaseef):
    I finally walked through the entire IntrospectionSupport and query handling for an ActiveMQConnection and found that the following on the URL works around the issue as well:

{code}
...?jms.alwaysSyncSend=true         (JAVA CLIENT)
...?connection.alwaysSyncSend=true  (C++ CLIENT: activemq-cpp)
{code}

For TRANSACTIONS, I would argue that sync sends default to true because that matches the the JMS standard - and what I believe clients expect by default - but with a setting that allows clients to override that operation.  Perhaps the following:

{code}
...?jms.transactionAsyncSend=false    => (default) don't use async sends with transactions
...?jms.transactionAsyncSend=true     => use async sends with transactions
{code}

By the way, shouldn't the activemq-cpp library support "jms." as the prefix for connection parameters in the same way the Java code does?  Otherwise, we have to make sure URL's are client-implementation-specific.

The subset of logic for async sends on transactions would be as follows:

{code}
IF (session IS transacted ) AND ( not alwaysSyncSend ) AND ( transactionAsyncSend )
THEN
  SEND async
ELSE
  SEND sync
END IF
{code}

A patch with this update will be coming soon.
  
> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054554#comment-13054554 ] 

Arthur Naseef commented on AMQ-3166:
------------------------------------

Sorry for the slow response.

I think the fail-on-commit is a feasible solution and have attached a Broker Filter which makes that happen.  There are a couple of non-optimal aspects to this solution, but I wanted to put it out for consideration/feedback.

The two concerns I have with this solution are:
* Only failures that occur after the filter in the broker's filter chain will be detected and handled.
* Clients may continue for a while after a failure, likely performing throw-away work.
** I would like to address this with a new message back to the client specifically indicating the transaction failure.
** Client logic would then be needed to check the transaction on send() and receive()/acknowledge() calls.

Please let me know.  If this looks like a feasible solution, I'll create JUnit tests that incorporate this feature.

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java, FailedTransactionTracking.java, FailedTransactionTrackingPlugin.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arthur Naseef updated AMQ-3166:
-------------------------------

    Attachment: AMQ3166Test.java

JUnit test program with 3 test cases:
   1. Transacted sends which illustrate the problem
   2. Transacted sends using a work-around
   3. Non-transacted sends which do not have this problem

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12989833#comment-12989833 ] 

Arthur Naseef commented on AMQ-3166:
------------------------------------

Research found the following:
   - The exceptions are being sent over the transport from the broker to the client
   - Client handling does not propogate the exception back through send() or commit() calls

It appears this is caused by the producer using async sends.  Looking at ActiveMQSession:

            if (sendTimeout <= 0 && !msg.isResponseRequired() && !connection.isAlwaysSyncSend() &&
                (!msg.isPersistent() || connection.isUseAsyncSend() || txid != null)) {
                this.connection.asyncSendPacket(msg);

msg.isResponseRequire() defaults to false for most transport commands, including Message.  Taking advantage of the "isAlwaysSyncSend()" logic above, the following works-around the issue (when clients can be modified to use it):

                org.apache.activemq.ActiveMQConnectionFactory   conn_fact;
                ...
                conn_fact.setAlwaysSyncSend(true);

Attempts to use URI parameters, and searches through the code for URI parameters, have yielded no working solutions there.  If the connection URL could include a setting such as "?connection.alwaysSyncSend=true" would make this problem easier to solve since most clients use a configurable connection string.

However, with all of that said, it seems that transacted sends - as well as creating producers - should be synchronous.  That can be solved by taking out the "txid != null" logic.

For further performance improvement over transacted sends, if a client wants batch sending, which is not part of the JMS standard, it makes sense to require clients to use ActiveMQ-specific features.  Perhaps a batchSend() method followed by batchComplete().


> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2
>            Reporter: Arthur Naseef
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (AMQ-3166) client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions

Posted by "Arthur Naseef (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041991#comment-13041991 ] 

Arthur Naseef commented on AMQ-3166:
------------------------------------

I finally walked through the entire IntrospectionSupport and query handling for an ActiveMQConnection and found that the following on the URL works around the issue as well:

{code}
...?jms.alwaysSyncSend=true         (JAVA CLIENT)
...?connection.alwaysSyncSend=true  (C++ CLIENT: activemq-cpp)
{code}

For TRANSACTIONS, I would argue that sync sends default to true because that matches the the JMS standard - and what I believe clients expect by default - but with a setting that allows clients to override that operation.  Perhaps the following:

{code}
...?jms.transactionAsyncSend=false    => (default) don't use async sends with transactions
...?jms.transactionAsyncSend=true     => use async sends with transactions
{code}

By the way, shouldn't the activemq-cpp library support "jms." as the prefix for connection parameters in the same way the Java code does?  Otherwise, we have to make sure URL's are client-implementation-specific.

The subset of logic for async sends on transactions would be as follows:

{code}
IF (session IS transacted ) AND ( not alwaysSyncSend ) AND ( transactionAsyncSend )
THEN
  SEND async
ELSE
  SEND sync
END IF
{code}

A patch with this update will be coming soon.

> client calls to createProducer() and send() successful even though BrokerFilter methods throw exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3166
>                 URL: https://issues.apache.org/jira/browse/AMQ-3166
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.4.2, 5.5.0
>            Reporter: Arthur Naseef
>         Attachments: AMQ3166Test.java, AMQ3166Test.java
>
>
> Client calls to createProducer() always return without an error even though a BrokerFilter's addProducer() method throws an exception on the request. In contrast, createConsumer() throws an exception, as expected, when BrokerFilter's addConsumer() throws an exception.
> Clients using transacted sessions always return successfully from send() when a BrokerFilter's send() method throws an exception.
> Below is a broker configuration file using <authorizationPlugin> to illustrate the problem.
> To reproduce the problem With this configuration, a test client only needs to connect with user = "user" and password = "password", and then attempt to produce messages with a transacted session to any queue other than ABC (e.g. DEF).
> Tracing the cause of the issue has lead to finding that the client code for creating a producer uses an Async send for the producer information.  The analogous code for consumers uses a Sync send.
> I will work on a patch.  It would be very helpful to have feedback on the operation of the bus and the best way to resolve this problem.  Based on my research, it seems that createProducer() should be using a Sync send in place of the Async one.  Not yet sure about send().  Another possibility is to move the security operations to earlier in the internal broker flow.
> === SAMPLE BROKER XML ===
> <beans
>   xmlns="http://www.springframework.org/schema/beans"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
>     <broker xmlns="http://activemq.apache.org/schema/core"
>             brokerName="localhost"
>             dataDirectory="${activemq.base}/data"
>             destroyApplicationContextOnStop="true" >
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         
>         <plugins>
>           <simpleAuthenticationPlugin anonymousAccessAllowed="true">
>               <users>
>                   <authenticationUser username="user" password="password"
>                       groups="users"/>
>               </users>
>           </simpleAuthenticationPlugin>
>           <authorizationPlugin>
>               <map>
>                   <authorizationMap>
>                     <authorizationEntries>
>                       <authorizationEntry queue="ABC" read="users" write="users" admin="users" />
>                       <authorizationEntry topic="ActiveMQ.Advisory.>" read="users" write="users" admin="users" />
>                     </authorizationEntries>
>                   </authorizationMap>
>               </map>
>           </authorizationPlugin>
>         </plugins>
>         <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>     </broker>
> </beans>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira