2

PageFile is not loaded在生产环境中生成预定消息时出现异常。在网上搜索并没有找到任何解决方案后,我编写了一个用于模拟生产环境的简单程序。我展示了我的程序并解释了抛出异常的场景:

public static void main(String[] args) throws Throwable
{
    final ActiveMQConnectionFactory conFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
    final QueueConnection connection = conFactory.createQueueConnection();
    final Session session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    final Destination destination = new ActiveMQQueue("MJ_SAF");
    final MessageProducer producer = session.createProducer(destination);

    ActiveMQMessage message = (ActiveMQMessage) session.createTextMessage("Hello World!");
    message.setPersistent(true);
    message.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, 1000);
    message.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_PERIOD, 0);
    message.setIntProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT, 1);
    producer.send(message);

    producer.close();
    session.close();
    connection.close();
}

执行此代码后,MJ_SAF当消息在调度队列中并且不发送主队列(MJ_SAF)时,我将其删除。然后我再次运行上面的程序,但出现以下异常:

DEBUG  [main] o.a.a.transport.WireFormatNegotiator - Sending: WireFormatInfo { version=9, properties={MaxFrameSize=9223372036854775807, CacheSize=1024, CacheEnabled=true, SizePrefixDisabled=false, MaxInactivityDurationInitalDelay=10000, TcpNoDelayEnabled=true, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
DEBUG  [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@2422] o.a.a.transport.InactivityMonitor - Using min of local: WireFormatInfo { version=9, properties={MaxFrameSize=9223372036854775807, CacheSize=1024, CacheEnabled=true, SizePrefixDisabled=false, MaxInactivityDurationInitalDelay=10000, TcpNoDelayEnabled=true, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]} and remote: WireFormatInfo { version=9, properties={CacheSize=1024, MaxFrameSize=9223372036854775807, CacheEnabled=true, SizePrefixDisabled=false, TcpNoDelayEnabled=true, MaxInactivityDurationInitalDelay=10000, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
DEBUG  [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@2422] o.a.a.transport.WireFormatNegotiator - Received WireFormat: WireFormatInfo { version=9, properties={CacheSize=1024, MaxFrameSize=9223372036854775807, CacheEnabled=true, SizePrefixDisabled=false, TcpNoDelayEnabled=true, MaxInactivityDurationInitalDelay=10000, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
DEBUG  [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@2422] o.a.a.transport.WireFormatNegotiator - tcp://localhost/127.0.0.1:61616@2422 before negotiation: OpenWireFormat{version=9, cacheEnabled=false, stackTraceEnabled=false, tightEncodingEnabled=false, sizePrefixDisabled=false, maxFrameSize=9223372036854775807}
DEBUG  [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@2422] o.a.a.transport.WireFormatNegotiator - tcp://localhost/127.0.0.1:61616@2422 after negotiation: OpenWireFormat{version=9, cacheEnabled=true, stackTraceEnabled=true, tightEncodingEnabled=true, sizePrefixDisabled=false, maxFrameSize=9223372036854775807}
DEBUG  [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@2422] o.a.activemq.util.ThreadPoolUtils - Shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@2f48d2 is shutdown: true and terminated: true took: 0.000 seconds.
DEBUG  [main] o.a.activemq.util.ThreadPoolUtils - Shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@296f76 is shutdown: true and terminated: false took: 0.000 seconds.
DEBUG  [main] o.a.a.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616@2422
DEBUG  [ActiveMQ Connection Executor: tcp://localhost/127.0.0.1:61616@2422] o.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.lang.IllegalStateException: PageFile is not loaded
java.lang.IllegalStateException: PageFile is not loaded
    at org.apache.kahadb.page.PageFile.assertLoaded(PageFile.java:809) ~[kahadb-5.7.0.jar:5.7.0]
    at org.apache.kahadb.page.PageFile.tx(PageFile.java:303) ~[kahadb-5.7.0.jar:5.7.0]
    at org.apache.activemq.store.kahadb.KahaDBStore$KahaDBMessageStore.getMessageCount(KahaDBStore.java:479) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.store.ProxyMessageStore.getMessageCount(ProxyMessageStore.java:101) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.store.ProxyMessageStore.getMessageCount(ProxyMessageStore.java:101) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.region.Queue.initialize(Queue.java:376) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.region.DestinationFactoryImpl.createDestination(DestinationFactoryImpl.java:86) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.region.AbstractRegion.createDestination(AbstractRegion.java:532) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.jmx.ManagedQueueRegion.createDestination(ManagedQueueRegion.java:56) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.region.AbstractRegion.addDestination(AbstractRegion.java:137) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.region.RegionBroker.addDestination(RegionBroker.java:283) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.MutableBrokerFilter.addDestination(MutableBrokerFilter.java:151) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.region.RegionBroker.addProducer(RegionBroker.java:361) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.jmx.ManagedRegionBroker.addProducer(ManagedRegionBroker.java:281) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.BrokerFilter.addProducer(BrokerFilter.java:93) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.CompositeDestinationBroker.addProducer(CompositeDestinationBroker.java:56) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.BrokerFilter.addProducer(BrokerFilter.java:93) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.MutableBrokerFilter.addProducer(MutableBrokerFilter.java:99) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.TransportConnection.processAddProducer(TransportConnection.java:511) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.command.ProducerInfo.visit(ProducerInfo.java:105) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:294) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:152) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:256) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:222) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:204) ~[activemq-core-5.7.0.jar:5.7.0]
    at java.lang.Thread.run(Thread.java:662) ~[na:1.6.0_13]
DEBUG  [main] o.a.a.thread.TaskRunnerFactory - Initialized TaskRunnerFactory[ActiveMQ Task] using ExecutorService: java.util.concurrent.ThreadPoolExecutor@6295eb
DEBUG  [ActiveMQ Task-1] o.a.a.transport.tcp.TcpTransport - Closed socket Socket[addr=localhost/127.0.0.1,port=61616,localport=2422]
DEBUG  [main] o.a.activemq.util.ThreadPoolUtils - Forcing shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@6295eb

我使用Apache ActiveMQ 5.7版本。

4

1 回答 1

1

ActiveMQ 中的 KahaDB 经历了最近几个版本的大量强化工作。我记得在这个领域修复了一些问题,即在使用的分页列表和树中,由于竞争条件可能导致这样的异常。最新版本 v5.8.0 刚刚发布,其中包含我们使用 KahaDB 完成的所有最新工作,我建议用户尽快迁移到该版本。

于 2013-02-16T11:49:32.580 回答