RE: Message lost due to NullpointerException in TopicConsumerEndpoint.deliverMessages

"Tim Anderson" <[email protected]>
Newsgroups gmane.comp.java.openjms.user
Message-ID <[email protected]>
It appears to be a race condition. The stopDelivery() test prior to
removeFirstMessage() returns true if there are no messages available 
(getMessageCount() == 0). 
However, a single message that expires between the call to stopDelivery() 
and removeFirstMessage() means that removeFirstMessage() will return null
and trigger an NPE.
Its not clear that a message is lost however. The only way I can
see it happening is if a message expires, in which case it wouldn't be
delivered anyway.

> From: A. Schiefke (ancosys)
> 
> I have an application with 4 processes on 4 different 
> WinXP-PCs on a private network using tcp connectors. The 
> OpenJMS-Server (0.7.6.1) runs on one of these PCs. There are 
> less than 10 messages per second. I am using a single 
> connection, a single session and single publisher (per 
> process). All messages are non persistent. Memory and cpu 
> load of the pc hosting the jms-server is very moderate.
> 
> The App runs in a production environment for months and it 
> runs fine. No messages have got lost - until last friday. 
> Then we experienced a lost message. The jms log told me that 
> at the same time two NullPointerExceptions were thrown (see below).
> 
> I looked up the code of TopicConsumerEndpoint and found the following:
> 
> The second Exception (that is not caught regulary) seems to 
> be just a follow up error during the error treatment.
> 
> The first exception occurs because there is no MessageHandle 
> though the method is expecting one. But deliverMessage makes 
> no attempt to verify that removeFirstMessage return not null.
> 
> Can anybody give me a hint what was going wrong there? Maybe 
> there is synchronisation problem between the scheduling 
> thread and the executing thread concerning the message cache?
> 
> Of course i could make these messages persistent but I am not 
> shure whether this really would solve this special kind of 
> problem. Moreover there seem to be a strong performance 
> penalty for that.
> 
> Any help is appreciated.
> 
> 40   	2005-08-06	11:16:02	ERROR	[Scheduler-Worker-11] 
> messagemgr.TopicConsumerEndpoint	java.lang.NullPointerException
> java.lang.NullPointerException
> 	at
> org.exolab.jms.messagemgr.TopicConsumerEndpoint.deliverMessage
> s(TopicConsumerEndpoint.java:192)
> 	at
> org.exolab.jms.messagemgr.ConsumerEndpoint.run(ConsumerEndpoin
> t.java:425)
> 	at
> org.exolab.core.threadPool.ThreadPoolWorker.runIt(ThreadPoolWo
> rker.java:191)
> 	at
> org.exolab.core.threadPool.ThreadPoolWorker.runWork(ThreadPool
> Worker.java:178)
> 	at
> org.exolab.core.threadPool.ThreadPoolWorker.access$000(ThreadP
> oolWorker.java:67)
> 	at
> org.exolab.core.threadPool.ThreadPoolWorker$1.run(ThreadPoolWo
> rker.java:122)
> 	at java.lang.Thread.run(Thread.java:536)
> 
> 
> 260  	2005-08-06	11:16:02	ERROR	[Scheduler-Worker-11] 
> threadPool.ThreadPoolWorker	Thread Scheduler-Worker-11: uncaught 
> exception fell through from run()
> java.lang.NullPointerException
> 	at
> org.exolab.jms.messagemgr.ConsumerEndpoint.addMessage(Consumer
> Endpoint.java:670)
> 	at
> org.exolab.jms.messagemgr.ConsumerEndpoint.returnMessage(Consu
> merEndpoint.java:585)
> 	at
> org.exolab.jms.messagemgr.TopicConsumerEndpoint.deliverMessage
> s(TopicConsumerEndpoint.java:211)
> 	at
> org.exolab.jms.messagemgr.ConsumerEndpoint.run(ConsumerEndpoin
> t.java:425)
> 	at
> org.exolab.core.threadPool.ThreadPoolWorker.runIt(ThreadPoolWo
> rker.java:191)
> 	at
> org.exolab.core.threadPool.ThreadPoolWorker.runWork(ThreadPool
> Worker.java:178)
> 	at
> org.exolab.core.threadPool.ThreadPoolWorker.access$000(ThreadP
> oolWorker.java:67)
> 	at
> org.exolab.core.threadPool.ThreadPoolWorker$1.run(ThreadPoolWo
> rker.java:122)
> 	at java.lang.Thread.run(Thread.java:536)
> -- 
> 
> Mit freundlichen Grüssen,
> 
> Andreas Schiefke
> Dr. rer. nat.
> 
> ancosys gmbh
> Büro Rhein-Ruhr
> Gerhard-Hebborn-Str. 31
> 42699 Solingen
> 
> Tel: 0212/38 24 661
> Fax: 0212/38 24 662
> email: [email protected]
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & 
> EXPO September 19-22, 2005 * San Francisco, CA * Development 
> Lifecycle Practices Agile & Plan-Driven Development * 
> Managing Projects & Teams * Testing & QA Security * Process 
> Improvement & Measurement * http://www.sqe.com/bsce5sf 
> _______________________________________________
> openjms-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openjms-user
> 



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.