2 Replies Latest reply on Aug 22, 2009 2:46 PM by clebert.suconic

    Persistent Problem in JBM 2.0.0 BETA4

    kazuno

      Hello.

      I'm evaluating JBoss Messaging 2.0.0 BETA4 .
      And, I tried the following procedure to check JBM's persistence functionality.

      1. Start up JBM.
      2. Check MessageCount of ExampleQue by jconsole. and 0 message found.
      3. Producer sends a hundred messages to ExampleQue by a single transaction. and commit.
      4. Check MessageCount of ExampleQue by jconsole. and 100 messages found.
      5. Kill JBM process by Windows Taskmanager.
      6. Start up JBM again.
      7. Check MessageCount of ExampleQue by jconsole. and 100 messages found. It's OK.

      ...and I tried once more.

      9. Procducer sends a hundred messages to ExampleQue by a single transaction. and commit.
      10. Check MessageCount of ExampleQue by jconsole. and 200s message found.
      11. Kill JBM process by Windows Taskmanager.
      12. Start up JBM again.
      13. Check MessageCount of ExampleQue by jconsole. and only 105s message found!

      My 95 messages have gone somewhere. persistence functionality does not seem to work properly.

      I confirmed following by jconsole.
      o JournalSyncTransactional is true.
      o ExampleQueie is durable.
      o DLQ and ExpilyQueue has no message. (MessageAdded, MessageCound are 0)

      And my environment is
      o Windows XP SP3
      o Sun JDK 1.6.0_15
      o JBoss Messaging 2.0.0 BETA4

      Any comments or suggestion?

      * Producer.java

      import java.util.HashMap;
      import java.util.Map;
      
      import javax.jms.Connection;
      import javax.jms.ConnectionFactory;
      import javax.jms.DeliveryMode;
      import javax.jms.Message;
      import javax.jms.MessageProducer;
      import javax.jms.Queue;
      import javax.jms.Session;
      
      import org.jboss.messaging.core.config.TransportConfiguration;
      import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
      import org.jboss.messaging.jms.JBossQueue;
      import org.jboss.messaging.jms.client.JBossConnectionFactory;
      
      /**
       * A Producer That connecto to JBM and send 100 messages then commits.
       */
      public class Producer {
      
       public static void main(String[] args) throws Exception {
      
       Connection connection = null;
       Queue queue = null;
       Session session = null;
       MessageProducer producer = null;
      
       try {
      
       // Step 1. Create a ConnectionFactory
       Map<String, Object> params = new HashMap<String, Object>();
       params.put("jbm.remoting.netty.host","localhost");
       params.put("jbm.remoting.netty.port","5445");
       TransportConfiguration transportConfiguration =
       new TransportConfiguration(NettyConnectorFactory.class.getName(), params);
       ConnectionFactory cf = new JBossConnectionFactory(transportConfiguration);
      
       // Step 2. Create a Connection and start.
       connection = cf.createConnection();
       connection.start();
      
       // Step 3. Create a Session that transactedl.
       session = connection.createSession(true, Session.SESSION_TRANSACTED);
      
       // Step 4. Create a Queue.
       queue = new JBossQueue("ExampleQueue");
      
       // Step 5. Create a Producer.
       producer = session.createProducer(queue);
      
       // Step 7. Set delivery mode to persistent.
       producer.setDeliveryMode(DeliveryMode.PERSISTENT);
      
       // Step 8. Send 100 messages.
       for (int i = 0; i < 100; i++) {
       Message message = session.createObjectMessage(new Integer(i));
       producer.send(message);
       System.out.println("message " + Integer.toString(i) + " sent.");
       }
      
       // Step 9. Commit.
       session.commit();
       System.out.println("commited!");
      
      
       } finally {
       if (producer != null) {
       producer.close();
       }
       if (session != null) {
       session.rollback();
       session.close();
       }
       if (connection != null) {
       connection.close();
       }
       }
      
       }
      }
      


      * jbm-configuration.xml
      <configuration xmlns="urn:jboss:messaging"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="urn:jboss:messaging /schema/jbm-configuration.xsd">
      
       <connectors>
       <connector name="netty">
       <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
       <param key="jbm.remoting.netty.host" value="${jbm.remoting.netty.host:localhost}" type="String"/>
       <param key="jbm.remoting.netty.port" value="${jbm.remoting.netty.port:5445}" type="Integer"/>
       </connector>
       </connectors>
      
       <acceptors>
       <acceptor name="netty">
       <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
       <param key="jbm.remoting.netty.host" value="${jbm.remoting.netty.host:localhost}" type="String"/>
       <param key="jbm.remoting.netty.port" value="${jbm.remoting.netty.port:5445}" type="Integer"/>
       </acceptor>
       </acceptors>
      
       <security-settings>
       <security-setting match="#">
       <permission type="createTempQueue" roles="guest"/>
       <permission type="deleteTempQueue" roles="guest"/>
       <permission type="consume" roles="guest"/>
       <permission type="send" roles="guest"/>
       </security-setting>
       </security-settings>
      
       <address-settings>
       <!--default for catch all-->
       <address-setting match="#">
       <clustered>false</clustered>
       <dead-letter-address>jms.queue.DLQ</dead-letter-address>
       <expiry-address>jms.queue.ExpiryQueue</expiry-address>
       <redelivery-delay>0</redelivery-delay>
       <max-size-bytes>-1</max-size-bytes>
       <page-size-bytes>10485760</page-size-bytes>
       <distribution-policy-class>org.jboss.messaging.core.server.impl.RoundRobinDistributor</distribution-policy-class>
       <message-counter-history-day-limit>10</message-counter-history-day-limit>
       </address-setting>
       </address-settings>
      
       <paging-directory>../data/paging</paging-directory>
       <bindings-directory>../data/bindings</bindings-directory>
       <journal-directory>../data/journal</journal-directory>
       <large-messages-directory>../data/large-messages</large-messages-directory>
      
      </configuration>
      


      * jbm-jms.xml
      <configuration xmlns="urn:jboss:messaging"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="urn:jboss:messaging /schema/jbm-jms.xsd">
      
       <connection-factory name="ConnectionFactory">
       <connector-ref connector-name="netty"/>
       <entries>
       <entry name="ConnectionFactory"/>
       <entry name="XAConnectionFactory"/>
       <entry name="java:/ConnectionFactory"/>
       <entry name="java:/XAConnectionFactory"/>
       </entries>
       </connection-factory>
      
       <queue name="DLQ">
       <entry name="/queue/DLQ"/>
       </queue>
       <queue name="ExpiryQueue">
       <entry name="/queue/ExpiryQueue"/>
       </queue>
       <queue name="ExampleQueue">
       <entry name="/queue/ExampleQueue"/>
       </queue>
       <topic name="ExampleTopic">
       <entry name="/topic/ExampleTopic"/>
       </topic>
      
      </configuration>
      


        • 1. Re: Persistent Problem in JBM 2.0.0 BETA4
          clebert.suconic

          I could replicate the issue here. Thanks for bringing it up.

          I always do this kind of test.. but this scenario slipped me through. (when using just a few messages)

          There is a counter on the journal, and I believe the counter got messed up on restart when you had just a few messages.


          It should be fixed by tomorrow. Thanks for this.

          • 2. Re: Persistent Problem in JBM 2.0.0 BETA4
            clebert.suconic

            There was a bug on ID generations.. When you crashed the VM the data was stlil there, but because of that bug the Journal was duplicating IDs causing a few issues.


            It will be available on Monday's release.


            thanks again